Skip to content

Get rid of warnings CS0618#2800

Open
Daneel53 wants to merge 1 commit into
Interkarma:masterfrom
Daneel53:Upgrade-to-2022.3.62f3
Open

Get rid of warnings CS0618#2800
Daneel53 wants to merge 1 commit into
Interkarma:masterfrom
Daneel53:Upgrade-to-2022.3.62f3

Conversation

@Daneel53

Copy link
Copy Markdown
Collaborator

Must replace obsolete AddItems() by AddItemsAsync()

Must replace obsolete AddItems() by AddItemsAsync()
@Daneel53 Daneel53 changed the title Ger rid of warnings CS0618 Get rid of warnings CS0618 Jun 14, 2026
@Daneel53

Daneel53 commented Jun 14, 2026

Copy link
Copy Markdown
Collaborator Author

These changes need the modified file DaggerfallBillboardBatch.cs that is into PR #2733.
Cannot be merged as is if PR 2733 is not merged.

int record = Random.Range(1, 32);
if (terrainDist > 1 || !MeshReplacement.ImportNatureGameObject(dfBillboardBatch.TextureArchive, record, terrain, x, y))
dfBillboardBatch.AddItem(record, pos);
//dfBillboardBatch.AddItem(record, pos);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd remove those commented lines, that's what versioning is for

float maxTerrainHeight = DaggerfallUnity.Instance.TerrainSampler.MaxTerrainHeight;
float beachLine = DaggerfallUnity.Instance.TerrainSampler.BeachElevation;

List<DaggerfallBillboardBatch.BasicInfo> basicItems = new List<DaggerfallBillboardBatch.BasicInfo>();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be worth it to give that list an initial capacity, to avoid reallocations.
Otherwise, worse case when all nature billboards are present, with tDim = 128, you get log2(tDim * tDim / 4) = 12 reallocations.
tDim * tDim prevents any reallocation, and is probably okay for a temporary list

Suggested change
List<DaggerfallBillboardBatch.BasicInfo> basicItems = new List<DaggerfallBillboardBatch.BasicInfo>();
List<DaggerfallBillboardBatch.BasicInfo> basicItems = new List<DaggerfallBillboardBatch.BasicInfo>(tDim * tDim);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants