widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #04471
[Merge] lp:~widelands-dev/widelands/map_building_packet_version into lp:widelands
GunChleoc has proposed merging lp:~widelands-dev/widelands/map_building_packet_version into lp:widelands.
Requested reviews:
Widelands Developers (widelands-dev)
For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/map_building_packet_version/+merge/274941
We need some compatibility code for Barbarian campaign scenario 2.
--
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/map_building_packet_version into lp:widelands.
=== modified file 'src/map_io/map_building_packet.cc'
--- src/map_io/map_building_packet.cc 2015-04-15 10:06:45 +0000
+++ src/map_io/map_building_packet.cc 2015-10-19 19:54:50 +0000
@@ -38,6 +38,8 @@
namespace Widelands {
constexpr uint16_t kCurrentPacketVersion = 3;
+constexpr uint16_t kLowestSupportedVersion = 1;
+constexpr uint16_t kPrioritiesIntroducedInVersion = 2;
// constants to handle special building types
constexpr uint8_t kTypeBuilding = 0;
@@ -55,7 +57,7 @@
InteractiveBase & ibase = *egbase.get_ibase();
try {
uint16_t const packet_version = fr.unsigned_16();
- if (packet_version == kCurrentPacketVersion) {
+ if (packet_version >= kLowestSupportedVersion && packet_version <= kCurrentPacketVersion) {
Map & map = egbase.map();
uint16_t const width = map.get_width ();
uint16_t const height = map.get_height();
@@ -94,7 +96,9 @@
mol.register_object<Building> (serial, *building);
- read_priorities (*building, fr);
+ if (packet_version >= kPrioritiesIntroducedInVersion) {
+ read_priorities (*building, fr);
+ }
// Reference the players tribe if in editor.
if (g_gr) // but not on dedicated servers ;)
Follow ups