BlindMindStudios / StarRuler2-Source

4X Space Strategy game Star Ruler 2's open source distribution.
http://starruler2.com
Other
1.45k stars 244 forks source link

Tell the client the LevelChainId before it uses it to read a variable bit length message #75

Open Skeletonxf opened 3 years ago

Skeletonxf commented 3 years ago

Fixes very serious dormant vanilla bug where any planet with a level chain that had a different max level to the level chain with an id of 0 would read the wrong number of bits from the message, and offset the rest of the message by a number of bits, breaking all later decoding (and before I started patching to get my way to here, also risk CTDing the client due to trying to create data with stupidly large sizes on the graphics code). This bug is part of vanilla, but could not be triggered without mods, as all level chains in vanilla had 5 levels, so the bug occurred but didn't break the decoding due to the incorrect number and correct number coinciding to be the same