SiegeEngineers / genie-rs

Rust libraries for reading/writing various Age of Empires I/II files.
https://docs.rs/genie
GNU General Public License v3.0
18 stars 9 forks source link

drs: make ResourceType act more like a &str #15

Closed goto-bus-stop closed 5 years ago

goto-bus-stop commented 5 years ago

So it's easier to compare, and we don't need to allocate to convert it to a string like in DRSTable.resource_ext(). You can now just do something like table.resource_type() == "slp".

This flips the internal representation of ResourceType so it's more useful and it's less like the representation on disk. We instead flip it again when writing to disk. It's just swapping 4 bytes, so it's much cheaper than having to allocate every time resource_ext() is used!