LogicAndTrick / sledge-formats

C# parsers and formats for Half-Life 1 and related engines.
MIT License
71 stars 10 forks source link

BSP Entities lump writes "classname" and "model" keys twice on write #5

Closed SamVanheer closed 2 years ago

SamVanheer commented 3 years ago

When a BSP file's entities lump is written it writes the classname and model keys twice. This is because it writes both all keyvalues and these keyvalues explicitly: https://github.com/LogicAndTrick/sledge-formats/blob/72abe60b0199ebbad06c688914ebde552d358363/Sledge.Formats.Bsp/Lumps/Entities.cs#L157-L170

Both keyvalues are added to the list of keyvalues on load: https://github.com/LogicAndTrick/sledge-formats/blob/72abe60b0199ebbad06c688914ebde552d358363/Sledge.Formats.Bsp/Lumps/Entities.cs#L124-L136

It should use one or the other to save these keyvalues. It might be better to remove the explicit keyvalue properties for classname and model and rely solely on the keyvalues dictionary, since users will likely have their own wrapper around this data.