widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #01975
[Merge] lp:~widelands-dev/widelands/bug-1292828-cleanup into lp:widelands
Teppo Mäenpää has proposed merging lp:~widelands-dev/widelands/bug-1292828-cleanup into lp:widelands.
Requested reviews:
Widelands Developers (widelands-dev)
Related bugs:
Bug #1292828 in widelands: "src/map_io/widelands_map_buildingdata_data_packet.cc has a variable rel17comp which can be removed"
https://bugs.launchpad.net/widelands/+bug/1292828
For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1292828-cleanup/+merge/216705
removed few no-longer-needed lines of code.
--
https://code.launchpad.net/~widelands-dev/widelands/bug-1292828-cleanup/+merge/216705
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1292828-cleanup into lp:widelands.
=== modified file 'src/map_io/widelands_map_buildingdata_data_packet.cc'
--- src/map_io/widelands_map_buildingdata_data_packet.cc 2014-04-21 10:47:03 +0000
+++ src/map_io/widelands_map_buildingdata_data_packet.cc 2014-04-22 12:20:24 +0000
@@ -744,10 +744,7 @@
{
try {
uint16_t const packet_version = fr.Unsigned16();
- bool rel17comp = false;
- if (3 == packet_version and 4 == CURRENT_MILITARYSITE_PACKET_VERSION)
- rel17comp = true;
- if (packet_version == CURRENT_MILITARYSITE_PACKET_VERSION or rel17comp)
+ if (packet_version == CURRENT_MILITARYSITE_PACKET_VERSION)
{
read_productionsite(militarysite, fr, game, mol);
@@ -765,9 +762,6 @@
else
militarysite.m_normal_soldier_request.reset();
- if (rel17comp) // compatibility with release 17 savegames
- militarysite.m_upgrade_soldier_request.reset();
- else
if (fr.Unsigned8())
{
militarysite.m_upgrade_soldier_request.reset
@@ -803,26 +797,14 @@
// capacity (modified by user)
militarysite.m_capacity = fr.Unsigned8();
militarysite.m_nexthealtime = fr.Signed32();
- if (not (rel17comp)) // compatibility with release 17 savegames
- {
- uint16_t reqmin = fr.Unsigned16();
- uint16_t reqmax = fr.Unsigned16();
- militarysite.m_soldier_upgrade_requirements = RequireAttribute(atrTotal, reqmin, reqmax);
- militarysite.m_soldier_preference = static_cast<MilitarySite::SoldierPreference>(fr.Unsigned8());
- militarysite.m_next_swap_soldiers_time = fr.Signed32();
- militarysite.m_soldier_upgrade_try = 0 != fr.Unsigned8() ? true : false;
- militarysite.m_doing_upgrade_request = 0 != fr.Unsigned8() ? true : false;
- }
- else // Release 17 compatibility branch. Some safe values.
- {
- militarysite.m_soldier_preference = MilitarySite::kPrefersRookies;
- if (2 < militarysite.m_capacity)
- militarysite.m_soldier_preference = MilitarySite::kPrefersHeroes;
- militarysite.m_next_swap_soldiers_time = militarysite.m_nexthealtime;
- militarysite.m_soldier_upgrade_try = false;
- militarysite.m_doing_upgrade_request = false;
- }
+ uint16_t reqmin = fr.Unsigned16();
+ uint16_t reqmax = fr.Unsigned16();
+ militarysite.m_soldier_upgrade_requirements = RequireAttribute(atrTotal, reqmin, reqmax);
+ militarysite.m_soldier_preference = static_cast<MilitarySite::SoldierPreference>(fr.Unsigned8());
+ militarysite.m_next_swap_soldiers_time = fr.Signed32();
+ militarysite.m_soldier_upgrade_try = 0 != fr.Unsigned8() ? true : false;
+ militarysite.m_doing_upgrade_request = 0 != fr.Unsigned8() ? true : false;
} else
throw game_data_error
@@ -1086,11 +1068,7 @@
try {
uint16_t const trainingsite_packet_version = fr.Unsigned16();
- bool rel17comp = false; // compatibility with release 17
- if (4 == CURRENT_TRAININGSITE_PACKET_VERSION && 3 == trainingsite_packet_version)
- rel17comp = true;
-
- if (trainingsite_packet_version == CURRENT_TRAININGSITE_PACKET_VERSION or rel17comp)
+ if (trainingsite_packet_version == CURRENT_TRAININGSITE_PACKET_VERSION)
{
read_productionsite(trainingsite, fr, game, mol);
@@ -1127,20 +1105,17 @@
fr.Signed32();
}
}
- // load premature kick-out state, was not in release 17..
- if (not rel17comp)
+
+ uint16_t mapsize = fr.Unsigned16(); // map of training levels (not _the_ map)
+ while (mapsize)
{
- uint16_t mapsize = fr.Unsigned16();
- while (mapsize)
- {
- uint16_t traintype = fr.Unsigned16();
- uint16_t trainlevel = fr.Unsigned16();
- uint16_t trainstall = fr.Unsigned16();
- uint16_t spresence = fr.Unsigned8();
- mapsize--;
- std::pair<uint16_t, uint8_t> t = std::make_pair(trainstall, spresence);
- trainingsite.training_failure_count[std::make_pair(traintype, trainlevel)] = t;
- }
+ uint16_t traintype = fr.Unsigned16();
+ uint16_t trainlevel = fr.Unsigned16();
+ uint16_t trainstall = fr.Unsigned16();
+ uint16_t spresence = fr.Unsigned8();
+ mapsize--;
+ std::pair<uint16_t, uint8_t> t = std::make_pair(trainstall, spresence);
+ trainingsite.training_failure_count[std::make_pair(traintype, trainlevel)] = t;
}
} else
throw game_data_error
Follow ups