OutpostUniverse / OP2Utility

C++ library for working with Outpost 2 related files and tasks.
MIT License
4 stars 0 forks source link

Allow Map::Read to read saved game portions without crashing #241

Closed Brett208 closed 5 years ago

Brett208 commented 5 years ago

I'm not sure our documentation is correct for a saved game after unitID2 is read. However, this will parse without throwing an error and properly reads in map data from a saved game.

-Brett

Brett208 commented 5 years ago

Okay, pushed some more changes. I'll let @DanRStevens take a pass on these changes and if looks good, I'm happy merging.

Thanks, Brett

Brett208 commented 5 years ago

Okay, the placeholder struct makes more sense seeing it in the code. Thanks for fixing up. I went ahead and made UnitRecord a std::array to document that it is a fixed length field. Will merge shortly.

-Brett

DanRStevens commented 5 years ago

I have mixed feeling if unitRecord should be an std::array or a std::vector. If we want to be able to support the older saved game file format, then it's not really fixed size anymore, at least not in the compile time sense. Though I'm also not looking to worry about that level of complexity at this time.

On the other hand, if it's fixed at the larger size, we could just do a partial load of data for older saved game files. Plus, there's no room left to expand the bitfields that index into that array, so it's unlikely the array will ever grow to be any larger.

Ok, I think I just talked myself into liking the change.

DanRStevens commented 5 years ago

Tagging issue #239.