Merge lp:~widelands-dev/widelands/map_building_packet_version into lp:widelands

Proposed by GunChleoc
Status: Merged
Merged at revision: 7563
Proposed branch: lp:~widelands-dev/widelands/map_building_packet_version
Merge into: lp:widelands
Diff against target: 32 lines (+6/-2)
1 file modified
src/map_io/map_building_packet.cc (+6/-2)
To merge this branch: bzr merge lp:~widelands-dev/widelands/map_building_packet_version
Reviewer Review Type Date Requested Status
TiborB Approve
Review via email: mp+274941@code.launchpad.net

Description of the change

We need some compatibility code for Barbarian campaign scenario 2.

To post a comment you must log in.
Revision history for this message
TiborB (tiborb95) wrote :

lgtm

review: Approve
Revision history for this message
GunChleoc (gunchleoc) wrote :

Thanks for the 2 reviews :)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/map_io/map_building_packet.cc'
2--- src/map_io/map_building_packet.cc 2015-04-15 10:06:45 +0000
3+++ src/map_io/map_building_packet.cc 2015-10-19 19:54:50 +0000
4@@ -38,6 +38,8 @@
5 namespace Widelands {
6
7 constexpr uint16_t kCurrentPacketVersion = 3;
8+constexpr uint16_t kLowestSupportedVersion = 1;
9+constexpr uint16_t kPrioritiesIntroducedInVersion = 2;
10
11 // constants to handle special building types
12 constexpr uint8_t kTypeBuilding = 0;
13@@ -55,7 +57,7 @@
14 InteractiveBase & ibase = *egbase.get_ibase();
15 try {
16 uint16_t const packet_version = fr.unsigned_16();
17- if (packet_version == kCurrentPacketVersion) {
18+ if (packet_version >= kLowestSupportedVersion && packet_version <= kCurrentPacketVersion) {
19 Map & map = egbase.map();
20 uint16_t const width = map.get_width ();
21 uint16_t const height = map.get_height();
22@@ -94,7 +96,9 @@
23
24 mol.register_object<Building> (serial, *building);
25
26- read_priorities (*building, fr);
27+ if (packet_version >= kPrioritiesIntroducedInVersion) {
28+ read_priorities (*building, fr);
29+ }
30
31 // Reference the players tribe if in editor.
32 if (g_gr) // but not on dedicated servers ;)

Subscribers

People subscribed via source and target branches

to status/vote changes: