Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] WAE removes valid INI sections with the same name #188

Open
Crimsonum opened this issue Aug 11, 2024 · 2 comments
Open

[Bug] WAE removes valid INI sections with the same name #188

Crimsonum opened this issue Aug 11, 2024 · 2 comments

Comments

@Crimsonum
Copy link
Contributor

TS and RA2 are (in most cases) case-sensitive when it comes to parsing INI sections. For example, [Rock] and [ROCK] are identified as different types. WAE incorrectly treats these as duplicates and removes all but one of them.

Example:

[UMAGON] ;InfantryType
Name=Mutant Sniper
Strength=100
etc.

[Umagon] ;House
Color=Green
Side=Mutant
etc.

In this example, WAE removes [UMAGON] when saving the map.

The game can even parse data from multiple identically named sections for different object types. For example, a map could contain multiple instances of [Sniper]; one for a weapon, one for a unit, and another for a house type. Though it's questionable design and can lead to overlapping data being discarded (i.e. when the same key is defined multiple times), it's still technically possible.

@Starkku
Copy link
Contributor

Starkku commented Aug 14, 2024

The claim that game can read keys for distinct object types from different identically named sections seems dubious to me, it should have no way of knowing which one belongs to which. Reading keys for different object types from one section with shared name? Sure, vanilla game already does it with wall buildings and overlays.

@Crimsonum
Copy link
Contributor Author

The claim that game can read keys for distinct object types from different identically named sections seems dubious to me, it should have no way of knowing which one belongs to which. Reading keys for different object types from one section with shared name? Sure, vanilla game already does it with wall buildings and overlays.

It doesn't, but it basically combines identically named sections into one and, in case of duplicate keys, preserves only the last defined key's value. This logic is what, for example, the CnCNet spawner's spawnmap feature relies on.

Example:

[Sniper] ;InfantryType
Name=Sniper
Strength=100
Speed=5

[Sniper] ;WeaponType
Damage=100
ROF=60
Speed=100

The game parses the above as follows and uses relevant keys from this section for both object types:

[Sniper]
Name=Sniper
Strength=100
Damage=100
ROF=60
Speed=100

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

No branches or pull requests

2 participants