widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #04499
[Merge] lp:~widelands-dev/widelands/unhandled_version_error into lp:widelands
GunChleoc has proposed merging lp:~widelands-dev/widelands/unhandled_version_error into lp:widelands.
Requested reviews:
Widelands Developers (widelands-dev)
For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/unhandled_version_error/+merge/275630
Added packet names to UnhandledVersionError to make debugging easier.
The important bit to review is in src/logic/game_data_error.cc:
http://bazaar.launchpad.net/~widelands-dev/widelands/unhandled_version_error/revision/7567#src/logic/game_data_error.cc
--
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/unhandled_version_error into lp:widelands.
=== modified file 'src/economy/cmd_call_economy_balance.cc'
--- src/economy/cmd_call_economy_balance.cc 2014-10-12 07:35:42 +0000
+++ src/economy/cmd_call_economy_balance.cc 2015-10-24 15:45:00 +0000
@@ -65,7 +65,7 @@
m_flag = &mol.get<Flag>(serial);
m_timerid = fr.unsigned_32();
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("CmdCallEconomyBalance", packet_version, kCurrentPacketVersion);
}
} catch (const WException & e) {
throw wexception("call economy balance: %s", e.what());
=== modified file 'src/economy/economy_data_packet.cc'
--- src/economy/economy_data_packet.cc 2014-10-12 07:35:42 +0000
+++ src/economy/economy_data_packet.cc 2015-10-24 15:45:00 +0000
@@ -89,7 +89,7 @@
}
m_eco->m_request_timerid = fr.unsigned_32();
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("EconomyDataPacket", packet_version, kCurrentPacketVersion);
}
} catch (const std::exception & e) {
throw GameDataError("economy: %s", e.what());
=== modified file 'src/economy/fleet.cc'
--- src/economy/fleet.cc 2015-10-04 18:30:05 +0000
+++ src/economy/fleet.cc 2015-10-24 15:45:00 +0000
@@ -972,7 +972,7 @@
loader->init(egbase, mol, *(new Fleet(*owner)));
loader->load(fr);
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("Fleet", packet_version, kCurrentPacketVersion);
}
} catch (const std::exception & e) {
throw wexception("loading portdock: %s", e.what());
=== modified file 'src/economy/portdock.cc'
--- src/economy/portdock.cc 2015-10-04 18:30:05 +0000
+++ src/economy/portdock.cc 2015-10-24 15:45:00 +0000
@@ -544,7 +544,7 @@
loader->init(egbase, mol, *new PortDock(nullptr));
loader->load(fr);
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("PortDock", packet_version, kCurrentPacketVersion);
}
} catch (const std::exception& e) {
throw wexception("loading portdock: %s", e.what());
=== modified file 'src/economy/request.cc'
--- src/economy/request.cc 2014-10-12 07:35:42 +0000
+++ src/economy/request.cc 2015-10-24 15:45:00 +0000
@@ -168,7 +168,7 @@
if (!is_open() && m_economy)
m_economy->remove_request(*this);
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("Request", packet_version, kCurrentPacketVersion);
}
} catch (const WException & e) {
throw wexception("request: %s", e.what());
=== modified file 'src/economy/shippingitem.cc'
--- src/economy/shippingitem.cc 2015-04-15 10:06:45 +0000
+++ src/economy/shippingitem.cc 2015-10-24 15:45:00 +0000
@@ -172,7 +172,7 @@
if (packet_version == kCurrentPacketVersion) {
m_serial = fr.unsigned_32();
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("ShippingItem", packet_version, kCurrentPacketVersion);
}
} catch (const WException & e) {
throw GameDataError("shipping item: %s", e.what());
=== modified file 'src/economy/transfer.cc'
--- src/economy/transfer.cc 2014-10-12 07:35:42 +0000
+++ src/economy/transfer.cc 2015-10-24 15:45:00 +0000
@@ -321,7 +321,7 @@
if (packet_version == kCurrentPacketVersion) {
rd.destination = fr.unsigned_32();
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("Transfer", packet_version, kCurrentPacketVersion);
}
} catch (const WException & e) {
throw wexception("transfer: %s", e.what());
=== modified file 'src/economy/ware_instance.cc'
--- src/economy/ware_instance.cc 2015-04-15 12:59:16 +0000
+++ src/economy/ware_instance.cc 2015-10-24 15:45:00 +0000
@@ -642,7 +642,7 @@
return loader.release();
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("WareInstance", packet_version, kCurrentPacketVersion);
}
} catch (const std::exception & e) {
throw wexception("WareInstance: %s", e.what());
=== modified file 'src/economy/wares_queue.cc'
--- src/economy/wares_queue.cc 2015-04-11 21:03:05 +0000
+++ src/economy/wares_queue.cc 2015-10-24 15:45:00 +0000
@@ -282,7 +282,7 @@
if (m_owner.get_economy())
add_to_economy(*m_owner.get_economy());
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("WaresQueue", packet_version, kCurrentPacketVersion);
}
} catch (const GameDataError & e) {
throw GameDataError("waresqueue: %s", e.what());
=== modified file 'src/game_io/game_class_packet.cc'
--- src/game_io/game_class_packet.cc 2015-06-06 09:48:42 +0000
+++ src/game_io/game_class_packet.cc 2015-10-24 15:45:00 +0000
@@ -38,7 +38,7 @@
if (packet_version == kCurrentPacketVersion) {
game.gametime_ = fr.unsigned_32();
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("GameClassPacket", packet_version, kCurrentPacketVersion);
}
} catch (const WException & e) {
throw GameDataError("game class: %s", e.what());
=== modified file 'src/game_io/game_cmd_queue_packet.cc'
--- src/game_io/game_cmd_queue_packet.cc 2014-10-12 07:35:42 +0000
+++ src/game_io/game_cmd_queue_packet.cc 2015-10-24 15:45:00 +0000
@@ -69,7 +69,7 @@
++ cmdq.m_ncmds;
}
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("GameCmdQueuePacket", packet_version, kCurrentPacketVersion);
}
} catch (const WException & e) {
throw GameDataError("command queue: %s", e.what());
=== modified file 'src/game_io/game_interactive_player_packet.cc'
--- src/game_io/game_interactive_player_packet.cc 2014-10-12 07:35:42 +0000
+++ src/game_io/game_interactive_player_packet.cc 2015-10-24 15:45:00 +0000
@@ -77,7 +77,7 @@
ipl->set_player_number(player_number);
}
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("GameInteractivePlayerPacket", packet_version, kCurrentPacketVersion);
}
} catch (const WException & e) {
throw GameDataError("interactive player: %s", e.what());
=== modified file 'src/game_io/game_player_economies_packet.cc'
--- src/game_io/game_player_economies_packet.cc 2015-05-10 15:25:34 +0000
+++ src/game_io/game_player_economies_packet.cc 2015-10-24 15:45:00 +0000
@@ -85,7 +85,7 @@
throw GameDataError("player %u: %s", p, e.what());
}
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("GamePlayerEconomiesPacket", packet_version, kCurrentPacketVersion);
}
} catch (const WException & e) {
throw GameDataError("economies: %s", e.what());
=== modified file 'src/game_io/game_player_info_packet.cc'
--- src/game_io/game_player_info_packet.cc 2014-10-12 07:35:42 +0000
+++ src/game_io/game_player_info_packet.cc 2015-10-24 15:45:00 +0000
@@ -72,7 +72,7 @@
}
game.read_statistics(fr);
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("GamePlayerInfoPacket", packet_version, kCurrentPacketVersion);
}
} catch (const WException & e) {
throw GameDataError("player info: %s", e.what());
=== modified file 'src/game_io/game_preload_packet.cc'
--- src/game_io/game_preload_packet.cc 2015-06-06 14:24:16 +0000
+++ src/game_io/game_preload_packet.cc 2015-10-24 15:45:00 +0000
@@ -70,7 +70,7 @@
m_savetimestamp = static_cast<time_t>(s.get_natural("savetimestamp"));
m_gametype = static_cast<GameController::GameType>(s.get_natural("gametype"));
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("GamePreloadPacket", packet_version, kCurrentPacketVersion);
}
} catch (const WException & e) {
throw GameDataError("preload: %s", e.what());
=== modified file 'src/logic/battle.cc'
--- src/logic/battle.cc 2015-10-04 18:30:05 +0000
+++ src/logic/battle.cc 2015-10-24 15:45:00 +0000
@@ -425,7 +425,7 @@
loader->init(egbase, mol, *new Battle);
loader->load(fr);
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("Battle", packet_version, kCurrentPacketVersion);
}
} catch (const std::exception & e) {
throw wexception("Loading Battle: %s", e.what());
=== modified file 'src/logic/bob.cc'
--- src/logic/bob.cc 2015-04-11 21:03:05 +0000
+++ src/logic/bob.cc 2015-10-24 15:45:00 +0000
@@ -1146,7 +1146,7 @@
state.program = get_program(programname);
}
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("Bob", packet_version, kCurrentPacketVersion);
}
} catch (const WException & e) {
throw wexception("loading bob: %s", e.what());
=== modified file 'src/logic/carrier.cc'
--- src/logic/carrier.cc 2015-04-11 21:03:05 +0000
+++ src/logic/carrier.cc 2015-10-24 15:45:00 +0000
@@ -603,7 +603,7 @@
Carrier & carrier = get<Carrier>();
carrier.m_promised_pickup_to = fr.signed_32();
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("Carrier", packet_version, kCurrentPacketVersion);
}
} catch (const WException & e) {
throw wexception("loading carrier: %s", e.what());
=== modified file 'src/logic/cmd_calculate_statistics.cc'
--- src/logic/cmd_calculate_statistics.cc 2014-10-12 07:35:42 +0000
+++ src/logic/cmd_calculate_statistics.cc 2015-10-24 15:45:00 +0000
@@ -44,7 +44,7 @@
if (packet_version == kCurrentPacketVersion) {
GameLogicCommand::read(fr, egbase, mol);
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("CmdCalculateStatistics", packet_version, kCurrentPacketVersion);
}
} catch (const WException & e) {
throw GameDataError("calculate statistics function: %s", e.what());
=== modified file 'src/logic/cmd_incorporate.cc'
--- src/logic/cmd_incorporate.cc 2014-10-12 07:35:42 +0000
+++ src/logic/cmd_incorporate.cc 2015-10-24 15:45:00 +0000
@@ -44,7 +44,7 @@
throw wexception("worker %u: %s", worker_serial, e.what());
}
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("CmdIncorporate", packet_version, kCurrentPacketVersion);
}
} catch (const WException & e) {
=== modified file 'src/logic/cmd_luacoroutine.cc'
--- src/logic/cmd_luacoroutine.cc 2015-04-11 21:03:05 +0000
+++ src/logic/cmd_luacoroutine.cc 2015-10-24 15:45:00 +0000
@@ -72,7 +72,7 @@
m_cr = lgi->read_coroutine(fr);
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("CmdLuaCoroutine", packet_version, kCurrentPacketVersion);
}
} catch (const WException & e) {
throw GameDataError("lua function: %s", e.what());
=== modified file 'src/logic/cmd_luascript.cc'
--- src/logic/cmd_luascript.cc 2015-04-11 21:03:05 +0000
+++ src/logic/cmd_luascript.cc 2015-10-24 15:45:00 +0000
@@ -55,7 +55,7 @@
GameLogicCommand::read(fr, egbase, mol);
script_ = fr.string();
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("CmdLuaScript", packet_version, kCurrentPacketVersion);
}
} catch (const WException & e) {
throw GameDataError("lua: %s", e.what());
=== modified file 'src/logic/cmd_queue.cc'
--- src/logic/cmd_queue.cc 2014-10-12 07:35:42 +0000
+++ src/logic/cmd_queue.cc 2015-10-24 15:45:00 +0000
@@ -178,7 +178,7 @@
throw GameDataError
("duetime (%i) < gametime (%i)", duetime(), gametime);
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("GameLogicCommand", packet_version, kCurrentPacketVersion);
}
} catch (const WException & e) {
throw GameDataError("game logic: %s", e.what());
=== modified file 'src/logic/critter.cc'
--- src/logic/critter.cc 2015-04-11 21:03:05 +0000
+++ src/logic/critter.cc 2015-10-24 15:45:00 +0000
@@ -432,7 +432,7 @@
loader->init(egbase, mol, descr->create_object());
loader->load(fr);
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("Critter", packet_version, kCurrentPacketVersion);
}
} catch (const std::exception & e) {
throw wexception("loading critter: %s", e.what());
=== modified file 'src/logic/game_data_error.cc'
--- src/logic/game_data_error.cc 2014-10-12 07:35:42 +0000
+++ src/logic/game_data_error.cc 2015-10-24 15:45:00 +0000
@@ -41,12 +41,14 @@
}
-UnhandledVersionError::UnhandledVersionError(int32_t packet_version,
+UnhandledVersionError::UnhandledVersionError(const char* packet_name, int32_t packet_version,
int32_t current_packet_version)
{
- m_what = (boost::format("\n\nUnhandledVersionError: %s\n\nSaved Version: %i\nCurrent Version: %i")
+ m_what = (boost::format
+ ("\n\nUnhandledVersionError: %s\n\nPacket Name: %s\nSaved Version: %i\nCurrent Version: %i")
% _("This game was saved using an older version of Widelands and cannot be loaded anymore, "
"or it's a new version that can't be handled yet.")
+ % packet_name
% static_cast<int>(packet_version)
% static_cast<int>(current_packet_version)).str();
}
=== modified file 'src/logic/game_data_error.h'
--- src/logic/game_data_error.h 2014-10-12 07:35:42 +0000
+++ src/logic/game_data_error.h 2015-10-24 15:45:00 +0000
@@ -40,7 +40,7 @@
/// \param packet_version: The version of the packet that Widelands is trying to load.
/// \param current_packet_version: The packet version that Widelands is currently using.
struct UnhandledVersionError : public GameDataError {
- explicit UnhandledVersionError(int32_t packet_version,
+ explicit UnhandledVersionError(const char* packet_name, int32_t packet_version,
int32_t current_packet_version);
char const * what() const noexcept override {return m_what.c_str();}
=== modified file 'src/logic/immovable.cc'
--- src/logic/immovable.cc 2015-10-04 18:30:05 +0000
+++ src/logic/immovable.cc 2015-10-24 15:45:00 +0000
@@ -790,7 +790,7 @@
loader->init(egbase, mol, *imm);
loader->load(fr, packet_version);
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersionImmovable);
+ throw UnhandledVersionError("Immovable", packet_version, kCurrentPacketVersionImmovable);
}
} catch (const std::exception & e) {
throw wexception("immovable type: %s", e.what());
@@ -1171,7 +1171,8 @@
if (packet_version == kCurrentPacketVersionConstructionData) {
d->delivered.load(fr, *imm.descr().get_owner_tribe());
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersionConstructionData);
+ throw UnhandledVersionError("ActConstructionData",
+ packet_version, kCurrentPacketVersionConstructionData);
}
} catch (const WException & e) {
delete d;
@@ -1471,7 +1472,7 @@
imm.m_owner = owner;
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersionPlayerImmovable);
+ throw UnhandledVersionError("PlayerImmovable", packet_version, kCurrentPacketVersionPlayerImmovable);
}
} catch (const std::exception & e) {
throw wexception("loading player immovable: %s", e.what());
=== modified file 'src/logic/instances.cc'
--- src/logic/instances.cc 2015-05-10 15:25:34 +0000
+++ src/logic/instances.cc 2015-10-24 15:45:00 +0000
@@ -68,7 +68,8 @@
else
obj_serial = 0;
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersionDestroyMapObject);
+ throw UnhandledVersionError("CmdDestroyMapObject",
+ packet_version, kCurrentPacketVersionDestroyMapObject);
}
} catch (const WException & e) {
throw GameDataError("destroy map object: %s", e.what());
@@ -121,7 +122,7 @@
obj_serial = 0;
arg = fr.unsigned_32();
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersionCmdAct);
+ throw UnhandledVersionError("CmdAct", packet_version, kCurrentPacketVersionCmdAct);
}
} catch (const WException & e) {
throw wexception("act: %s", e.what());
@@ -517,7 +518,7 @@
uint8_t const packet_version = fr.unsigned_8();
if (packet_version <= 0 || packet_version > kCurrentPacketVersionMapObject) {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersionMapObject);
+ throw UnhandledVersionError("MapObject", packet_version, kCurrentPacketVersionMapObject);
}
Serial const serial = fr.unsigned_32();
=== modified file 'src/logic/path.cc'
--- src/logic/path.cc 2014-10-12 07:35:42 +0000
+++ src/logic/path.cc 2015-10-24 15:45:00 +0000
@@ -95,7 +95,7 @@
while (steps--)
append(map, read_direction_8(&fr));
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("Path", packet_version, kCurrentPacketVersion);
}
} catch (const WException & e) {
throw GameDataError("player names and tribes: %s", e.what());
=== modified file 'src/logic/playercommand.cc'
--- src/logic/playercommand.cc 2015-04-15 12:13:52 +0000
+++ src/logic/playercommand.cc 2015-10-24 15:45:00 +0000
@@ -164,7 +164,7 @@
throw GameDataError("player %u does not exist", m_sender);
m_cmdserial = fr.unsigned_32();
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersionPlayerCommand);
+ throw UnhandledVersionError("PlayerCommand", packet_version, kCurrentPacketVersionPlayerCommand);
}
} catch (const WException & e) {
throw GameDataError("player command: %s", e.what());
@@ -205,7 +205,8 @@
serial = get_object_serial_or_zero<PlayerImmovable>(fr.unsigned_32(), mol);
recurse = 2 <= packet_version ? fr.unsigned_8() : false;
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersionCmdBulldoze);
+ throw UnhandledVersionError("CmdBulldoze",
+ packet_version, kCurrentPacketVersionCmdBulldoze);
}
} catch (const WException & e) {
throw GameDataError("bulldoze: %s", e.what());
@@ -258,7 +259,8 @@
bi = fr.unsigned_16();
coords = read_coords_32(&fr, egbase.map().extent());
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersionCmdBuild);
+ throw UnhandledVersionError("CmdBuild",
+ packet_version, kCurrentPacketVersionCmdBuild);
}
} catch (const WException & e) {
@@ -309,7 +311,8 @@
PlayerCommand::read(fr, egbase, mol);
coords = read_coords_32(&fr, egbase.map().extent());
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersionCmdBuildFlag);
+ throw UnhandledVersionError("CmdBuildFlag",
+ packet_version, kCurrentPacketVersionCmdBuildFlag);
}
} catch (const WException & e) {
throw GameDataError("build flag: %s", e.what());
@@ -398,7 +401,8 @@
for (Path::StepVector::size_type i = 0; i < nsteps; ++i)
steps[i] = fr.unsigned_8();
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersionCmdBuildRoad);
+ throw UnhandledVersionError("CmdBuildRoad",
+ packet_version, kCurrentPacketVersionCmdBuildRoad);
}
} catch (const WException & e) {
throw GameDataError("build road: %s", e.what());
@@ -454,7 +458,8 @@
fr .unsigned_8 ();
serial = get_object_serial_or_zero<Flag>(fr.unsigned_32(), mol);
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersionCmdFlagAction);
+ throw UnhandledVersionError("CmdFlagAction",
+ packet_version, kCurrentPacketVersionCmdFlagAction);
}
} catch (const WException & e) {
throw GameDataError("flag action: %s", e.what());
@@ -506,7 +511,8 @@
PlayerCommand::read(fr, egbase, mol);
serial = get_object_serial_or_zero<Building>(fr.unsigned_32(), mol);
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersionCmdStartStopBuilding);
+ throw UnhandledVersionError("CmdStartStopBuilding",
+ packet_version, kCurrentPacketVersionCmdStartStopBuilding);
}
} catch (const WException & e) {
throw GameDataError("start/stop building: %s", e.what());
@@ -574,7 +580,8 @@
preference = fr.unsigned_8();
serial = get_object_serial_or_zero<MilitarySite>(fr.unsigned_32(), mol);
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersionSoldierPreference);
+ throw UnhandledVersionError("CmdMilitarySiteSetSoldierPreference",
+ packet_version, kCurrentPacketVersionSoldierPreference);
}
} catch (const WException & e) {
throw GameDataError("start/stop building: %s", e.what());
@@ -614,7 +621,8 @@
PlayerCommand::read(fr, egbase, mol);
serial = get_object_serial_or_zero<Warehouse>(fr.unsigned_32(), mol);
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersionExpedition);
+ throw UnhandledVersionError("CmdStartOrCancelExpedition",
+ packet_version, kCurrentPacketVersionExpedition);
}
} catch (const WException & e) {
throw GameDataError("start/stop building: %s", e.what());
@@ -668,7 +676,8 @@
serial = get_object_serial_or_zero<Building>(fr.unsigned_32(), mol);
bi = fr.unsigned_16();
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersionCmdEnhanceBuilding);
+ throw UnhandledVersionError("CmdEnhanceBuilding",
+ packet_version, kCurrentPacketVersionCmdEnhanceBuilding);
}
} catch (const WException & e) {
throw GameDataError("enhance building: %s", e.what());
@@ -721,7 +730,8 @@
PlayerCommand::read(fr, egbase, mol);
serial = get_object_serial_or_zero<Building>(fr.unsigned_32(), mol);
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersionDismantleBuilding);
+ throw UnhandledVersionError("CmdDismantleBuilding",
+ packet_version, kCurrentPacketVersionDismantleBuilding);
}
} catch (const WException & e) {
throw GameDataError("dismantle building: %s", e.what());
@@ -772,7 +782,8 @@
PlayerCommand::read(fr, egbase, mol);
serial = get_object_serial_or_zero<Worker>(fr.unsigned_32(), mol);
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersionCmdEvictWorker);
+ throw UnhandledVersionError("CmdEvictWorker",
+ packet_version, kCurrentPacketVersionCmdEvictWorker);
}
} catch (const WException & e) {
throw GameDataError("evict worker: %s", e.what());
@@ -840,7 +851,8 @@
// direction
dir = static_cast<WalkingDir>(fr.unsigned_8());
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersionShipScoutDirection);
+ throw UnhandledVersionError("CmdShipScoutDirection",
+ packet_version, kCurrentPacketVersionShipScoutDirection);
}
} catch (const WException & e) {
throw GameDataError("Ship scout: %s", e.what());
@@ -908,7 +920,8 @@
// Coords
coords = read_coords_32(&fr);
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersionShipConstructPort);
+ throw UnhandledVersionError("CmdShipConstructPort",
+ packet_version, kCurrentPacketVersionShipConstructPort);
}
} catch (const WException & e) {
throw GameDataError("Ship construct port: %s", e.what());
@@ -978,7 +991,8 @@
serial = get_object_serial_or_zero<Ship>(fr.unsigned_32(), mol);
island_explore_direction = static_cast<IslandExploreDirection>(fr.unsigned_8());
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersionShipExploreIsland);
+ throw UnhandledVersionError("CmdShipExploreIsland",
+ packet_version, kCurrentPacketVersionShipExploreIsland);
}
} catch (const WException & e) {
throw GameDataError("Ship explore: %s", e.what());
@@ -1033,7 +1047,8 @@
PlayerCommand::read(fr, egbase, mol);
serial = get_object_serial_or_zero<Ship>(fr.unsigned_32(), mol);
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersionCmdShipSink);
+ throw UnhandledVersionError("CmdShipSink", packet_version,
+ kCurrentPacketVersionCmdShipSink);
}
} catch (const WException & e) {
throw GameDataError("Ship explore: %s", e.what());
@@ -1085,7 +1100,8 @@
PlayerCommand::read(fr, egbase, mol);
serial = get_object_serial_or_zero<Ship>(fr.unsigned_32(), mol);
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersionShipCancelExpedition);
+ throw UnhandledVersionError("CmdShipCancelExpedition",
+ packet_version, kCurrentPacketVersionShipCancelExpedition);
}
} catch (const WException & e) {
throw GameDataError("Ship explore: %s", e.what());
@@ -1156,7 +1172,8 @@
m_index = fr.signed_32();
m_priority = fr.signed_32();
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersionCmdSetWarePriority);
+ throw UnhandledVersionError("CmdSetWarePriority",
+ packet_version, kCurrentPacketVersionCmdSetWarePriority);
}
} catch (const WException & e) {
@@ -1231,7 +1248,8 @@
m_index = fr.signed_32();
m_max_fill = fr.unsigned_32();
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersionCmdSetWareMaxFill);
+ throw UnhandledVersionError("CmdSetWareMaxFill",
+ packet_version, kCurrentPacketVersionCmdSetWareMaxFill);
}
} catch (const WException & e) {
throw GameDataError("set ware max fill: %s", e.what());
@@ -1339,7 +1357,8 @@
CmdChangeTargetQuantity::read(fr, egbase, mol);
m_permanent = fr.unsigned_32();
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersionSetWareTargetQuantity);
+ throw UnhandledVersionError("CmdSetWareTargetQuantity",
+ packet_version, kCurrentPacketVersionSetWareTargetQuantity);
}
} catch (const WException & e) {
throw GameDataError("set ware target quantity: %s", e.what());
@@ -1402,7 +1421,8 @@
if (packet_version == kCurrentPacketVersionResetWareTargetQuantity) {
CmdChangeTargetQuantity::read(fr, egbase, mol);
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersionResetWareTargetQuantity);
+ throw UnhandledVersionError("CmdResetWareTargetQuantity",
+ packet_version, kCurrentPacketVersionResetWareTargetQuantity);
}
} catch (const WException & e) {
throw GameDataError("reset target quantity: %s", e.what());
@@ -1459,7 +1479,8 @@
CmdChangeTargetQuantity::read(fr, egbase, mol);
m_permanent = fr.unsigned_32();
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersionSetWorkerTargetQuantity);
+ throw UnhandledVersionError("CmdSetWorkerTargetQuantity",
+ packet_version, kCurrentPacketVersionSetWorkerTargetQuantity);
}
} catch (const WException & e) {
throw GameDataError("set worker target quantity: %s", e.what());
@@ -1522,7 +1543,8 @@
if (packet_version == kCurrentPacketVersionResetWorkerTargetQuantity) {
CmdChangeTargetQuantity::read(fr, egbase, mol);
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersionResetWorkerTargetQuantity);
+ throw UnhandledVersionError("CmdResetWorkerTargetQuantity",
+ packet_version, kCurrentPacketVersionResetWorkerTargetQuantity);
}
} catch (const WException & e) {
throw GameDataError("reset worker target quantity: %s", e.what());
@@ -1578,7 +1600,8 @@
attribute = fr.unsigned_16();
value = fr.unsigned_16();
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersionChangeTrainingOptions);
+ throw UnhandledVersionError("CmdChangeTrainingOptions",
+ packet_version, kCurrentPacketVersionChangeTrainingOptions);
}
} catch (const WException & e) {
throw GameDataError("change training options: %s", e.what());
@@ -1636,7 +1659,8 @@
serial = get_object_serial_or_zero<PlayerImmovable>(fr.unsigned_32(), mol);
soldier = get_object_serial_or_zero<Soldier>(fr.unsigned_32(), mol);
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersionCmdDropSoldier);
+ throw UnhandledVersionError("CmdDropSoldier",
+ packet_version, kCurrentPacketVersionCmdDropSoldier);
}
} catch (const WException & e) {
throw GameDataError("drop soldier: %s", e.what());
@@ -1696,7 +1720,8 @@
serial = get_object_serial_or_zero<Building>(fr.unsigned_32(), mol);
val = fr.signed_16();
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersionChangeSoldierCapacity);
+ throw UnhandledVersionError("CmdChangeSoldierCapacity",
+ packet_version, kCurrentPacketVersionChangeSoldierCapacity);
}
} catch (const WException & e) {
throw GameDataError("change soldier capacity: %s", e.what());
@@ -1781,7 +1806,8 @@
fr .unsigned_8 ();
number = fr.unsigned_8 ();
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersionCmdEnemyFlagAction);
+ throw UnhandledVersionError("CmdEnemyFlagAction",
+ packet_version, kCurrentPacketVersionCmdEnemyFlagAction);
}
} catch (const WException & e) {
throw GameDataError("enemy flag action: %s", e.what());
@@ -1826,7 +1852,8 @@
throw GameDataError
("(player %u): message id is null", sender());
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersionPlayerMessageCommand);
+ throw UnhandledVersionError("PlayerMessageCommand",
+ packet_version, kCurrentPacketVersionPlayerMessageCommand);
}
} catch (const WException & e) {
throw GameDataError("player message: %s", e.what());
@@ -1977,7 +2004,8 @@
m_ware = WareIndex(fr.unsigned_8());
m_policy = static_cast<Warehouse::StockPolicy>(fr.unsigned_8());
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersionCmdSetStockPolicy);
+ throw UnhandledVersionError("CmdSetStockPolicy",
+ packet_version, kCurrentPacketVersionCmdSetStockPolicy);
}
} catch (const std::exception & e) {
throw GameDataError("Cmd_SetStockPolicy: %s", e.what());
=== modified file 'src/logic/replay.cc'
--- src/logic/replay.cc 2015-04-15 12:59:16 +0000
+++ src/logic/replay.cc 2015-10-24 15:45:00 +0000
@@ -106,7 +106,7 @@
const uint8_t packet_version = m_cmdlog->unsigned_8();
if (packet_version != kCurrentPacketVersion) {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("ReplayReader", packet_version, kCurrentPacketVersion);
}
game.rng().read_state(*m_cmdlog);
}
=== modified file 'src/logic/requirements.cc'
--- src/logic/requirements.cc 2015-04-11 21:03:05 +0000
+++ src/logic/requirements.cc 2015-10-24 15:45:00 +0000
@@ -45,7 +45,7 @@
if (packet_version == kCurrentPacketVersion) {
*this = RequirementsStorage::read(fr, egbase, mol);
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("Requirements", packet_version, kCurrentPacketVersion);
}
} catch (const WException & e) {
throw wexception("requirements: %s", e.what());
=== modified file 'src/logic/ship.cc'
--- src/logic/ship.cc 2015-10-18 18:31:35 +0000
+++ src/logic/ship.cc 2015-10-24 15:45:00 +0000
@@ -1117,7 +1117,7 @@
loader->init(egbase, mol, descr->create_object());
loader->load(fr);
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("Ship", packet_version, kCurrentPacketVersion);
}
} catch (const std::exception& e) {
throw wexception("loading ship: %s", e.what());
=== modified file 'src/logic/soldier.cc'
--- src/logic/soldier.cc 2015-04-14 18:34:40 +0000
+++ src/logic/soldier.cc 2015-10-24 15:45:00 +0000
@@ -1882,7 +1882,7 @@
m_battle = fr.unsigned_32();
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("Soldier", packet_version, kCurrentPacketVersion);
}
} catch (const std::exception & e) {
throw wexception("loading soldier: %s", e.what());
=== modified file 'src/logic/worker.cc'
--- src/logic/worker.cc 2015-05-10 15:25:34 +0000
+++ src/logic/worker.cc 2015-10-24 15:45:00 +0000
@@ -2980,7 +2980,7 @@
worker.m_transfer->read(fr, m_transfer);
}
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("Worker", packet_version, kCurrentPacketVersion);
}
} catch (const std::exception& e) {
throw wexception("loading worker: %s", e.what());
=== modified file 'src/map_io/map_allowed_building_types_packet.cc'
--- src/map_io/map_allowed_building_types_packet.cc 2014-10-31 07:46:04 +0000
+++ src/map_io/map_allowed_building_types_packet.cc 2015-10-24 15:45:00 +0000
@@ -90,7 +90,7 @@
}
}
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("MapAllowedBuildingTypesPacket", packet_version, kCurrentPacketVersion);
}
} catch (const WException & e) {
throw GameDataError("allowed buildings: %s", e.what());
=== modified file 'src/map_io/map_allowed_worker_types_packet.cc'
--- src/map_io/map_allowed_worker_types_packet.cc 2014-10-31 07:46:04 +0000
+++ src/map_io/map_allowed_worker_types_packet.cc 2015-10-24 15:45:00 +0000
@@ -75,7 +75,7 @@
}
}
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("MapAllowedWorkerTypesPacket", packet_version, kCurrentPacketVersion);
}
} catch (const WException & e) {
throw GameDataError("allowed worker types: %s", e.what());
=== modified file 'src/map_io/map_bob_packet.cc'
--- src/map_io/map_bob_packet.cc 2014-10-12 07:35:42 +0000
+++ src/map_io/map_bob_packet.cc 2015-10-24 15:45:00 +0000
@@ -87,7 +87,7 @@
}
}
else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("MapBobPacket", packet_version, kCurrentPacketVersion);
}
} catch (const WException& e) {
throw GameDataError("bobs: %s", e.what());
=== modified file 'src/map_io/map_building_packet.cc'
--- src/map_io/map_building_packet.cc 2015-10-19 19:43:19 +0000
+++ src/map_io/map_building_packet.cc 2015-10-24 15:45:00 +0000
@@ -109,7 +109,7 @@
}
}
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("MapBuildingPacket", packet_version, kCurrentPacketVersion);
}
} catch (const WException & e) {
throw GameDataError("buildings: %s", e.what());
=== modified file 'src/map_io/map_buildingdata_packet.cc'
--- src/map_io/map_buildingdata_packet.cc 2015-04-15 12:59:16 +0000
+++ src/map_io/map_buildingdata_packet.cc 2015-10-24 15:45:00 +0000
@@ -209,7 +209,7 @@
}
}
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("MapBuildingdataPacket", packet_version, kCurrentPacketVersion);
}
} catch (const WException & e) {
throw GameDataError("buildingdata: %s", e.what());
@@ -270,7 +270,8 @@
pfb.m_work_completed = fr.unsigned_32();
pfb.m_work_steps = fr.unsigned_32();
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketPFBuilding);
+ throw UnhandledVersionError("MapBuildingdataPacket - Partially Finished Building",
+ packet_version, kCurrentPacketPFBuilding);
}
} catch (const WException & e) {
throw GameDataError("partially_constructed_buildings: %s", e.what());
@@ -298,7 +299,8 @@
constructionsite.m_fetchfromflag = fr. signed_32();
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersionConstructionsite);
+ throw UnhandledVersionError("MapBuildingdataPacket - Constructionsite",
+ packet_version, kCurrentPacketVersionConstructionsite);
}
} catch (const WException & e) {
throw GameDataError("constructionsite: %s", e.what());
@@ -318,7 +320,8 @@
// Nothing to do
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersionDismantlesite);
+ throw UnhandledVersionError("MapBuildingdataPacket - Dismantlesite",
+ packet_version, kCurrentPacketVersionDismantlesite);
}
} catch (const WException & e) {
throw GameDataError("dismantlesite: %s", e.what());
@@ -500,7 +503,8 @@
warehouse.m_next_military_act = game.get_gametime();
//log("Read warehouse stuff for %p\n", &warehouse);
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersionWarehouse);
+ throw UnhandledVersionError("MapBuildingdataPacket - Warehouse",
+ packet_version, kCurrentPacketVersionWarehouse);
}
} catch (const WException & e) {
throw GameDataError("warehouse: %s", e.what());
@@ -578,7 +582,8 @@
militarysite.m_doing_upgrade_request = 0 != fr.unsigned_8() ? true : false;
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersionMilitarysite);
+ throw UnhandledVersionError("MapBuildingdataPacket - Militarysite",
+ packet_version, kCurrentPacketVersionMilitarysite);
}
// If the site's capacity is outside the allowed range (can happen if
@@ -777,7 +782,8 @@
productionsite.m_statistics_string_on_changed_statistics = fr.c_string();
productionsite.m_production_result = fr.c_string();
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersionProductionsite);
+ throw UnhandledVersionError("MapBuildingdataPacket - Productionsite",
+ packet_version, kCurrentPacketVersionProductionsite);
}
} catch (const WException & e) {
@@ -845,7 +851,8 @@
trainingsite.training_failure_count[std::make_pair(traintype, trainlevel)] = t;
}
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersionTrainingsite);
+ throw UnhandledVersionError("MapBuildingdataPacket - Trainingsite",
+ packet_version, kCurrentPacketVersionTrainingsite);
}
// If the site's capacity is outside the allowed range (can happen if
=== modified file 'src/map_io/map_elemental_packet.cc'
--- src/map_io/map_elemental_packet.cc 2015-04-11 21:03:05 +0000
+++ src/map_io/map_elemental_packet.cc 2015-10-24 15:45:00 +0000
@@ -103,7 +103,7 @@
teamsection_key = (boost::format("teams%02i") % team_section_id).str().c_str();
}
} else
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("MapElementalPacket", packet_version, kCurrentPacketVersion);
} catch (const WException & e) {
throw GameDataError("elemental data: %s", e.what());
}
=== modified file 'src/map_io/map_exploration_packet.cc'
--- src/map_io/map_exploration_packet.cc 2014-10-12 07:35:42 +0000
+++ src/map_io/map_exploration_packet.cc 2015-10-24 15:45:00 +0000
@@ -73,7 +73,7 @@
}
}
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("MapExplorationPacket", packet_version, kCurrentPacketVersion);
}
} catch (const WException & e) {
throw GameDataError("seen: %s", e.what());
=== modified file 'src/map_io/map_extradata_packet.cc'
--- src/map_io/map_extradata_packet.cc 2015-04-11 21:03:05 +0000
+++ src/map_io/map_extradata_packet.cc 2015-10-24 15:45:00 +0000
@@ -66,7 +66,7 @@
}
}
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("MapExtradataPacket", packet_version, kCurrentPacketVersion);
}
} catch (const WException & e) {
throw GameDataError("extradata: %s", e.what());
=== modified file 'src/map_io/map_flag_packet.cc'
--- src/map_io/map_flag_packet.cc 2015-04-11 21:03:05 +0000
+++ src/map_io/map_flag_packet.cc 2015-10-24 15:45:00 +0000
@@ -118,7 +118,7 @@
}
}
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("MapFlagPacket", packet_version, kCurrentPacketVersion);
}
} catch (const WException & e) {
throw GameDataError("flags: %s", e.what());
=== modified file 'src/map_io/map_flagdata_packet.cc'
--- src/map_io/map_flagdata_packet.cc 2015-04-11 21:03:05 +0000
+++ src/map_io/map_flagdata_packet.cc 2015-10-24 15:45:00 +0000
@@ -167,7 +167,7 @@
}
}
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("MapFlagdataPacket", packet_version, kCurrentPacketVersion);
}
} catch (const WException & e) {
throw GameDataError("flagdata: %s", e.what());
=== modified file 'src/map_io/map_heights_packet.cc'
--- src/map_io/map_heights_packet.cc 2014-10-12 07:35:42 +0000
+++ src/map_io/map_heights_packet.cc 2015-10-24 15:45:00 +0000
@@ -45,7 +45,7 @@
for (MapIndex i = 0; i < max_index; ++i)
map[i].set_height(fr.unsigned_8());
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("MapHeightsPacket", packet_version, kCurrentPacketVersion);
}
} catch (const WException & e) {
throw GameDataError("heights: %s", e.what());
=== modified file 'src/map_io/map_node_ownership_packet.cc'
--- src/map_io/map_node_ownership_packet.cc 2014-10-12 07:35:42 +0000
+++ src/map_io/map_node_ownership_packet.cc 2015-10-24 15:45:00 +0000
@@ -57,7 +57,7 @@
for (MapIndex i = 0; i < max_index; ++i)
map[i].set_owned_by(fr.unsigned_8());
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("MapNodeOwnershipPacket", packet_version, kCurrentPacketVersion);
}
} catch (const WException & e) {
throw GameDataError("ownership: %s", e.what());
=== modified file 'src/map_io/map_object_packet.cc'
--- src/map_io/map_object_packet.cc 2014-10-12 07:35:42 +0000
+++ src/map_io/map_object_packet.cc 2015-10-24 15:45:00 +0000
@@ -98,7 +98,7 @@
throw GameDataError("unknown object header %u", header);
}
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("MapObjectPacket", packet_version, kCurrentPacketVersion);
}
} catch (const std::exception & e) {
throw GameDataError("map objects: %s", e.what());
=== modified file 'src/map_io/map_objective_packet.cc'
--- src/map_io/map_objective_packet.cc 2014-10-12 07:35:42 +0000
+++ src/map_io/map_objective_packet.cc 2015-10-24 15:45:00 +0000
@@ -64,7 +64,7 @@
}
}
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("MapObjectivePacket", packet_version, kCurrentPacketVersion);
}
} catch (const WException & e) {
throw GameDataError("Objectives: %s", e.what());
=== modified file 'src/map_io/map_player_names_and_tribes_packet.cc'
--- src/map_io/map_player_names_and_tribes_packet.cc 2014-10-31 07:46:04 +0000
+++ src/map_io/map_player_names_and_tribes_packet.cc 2015-10-24 15:45:00 +0000
@@ -75,7 +75,7 @@
map->set_scenario_player_closeable(p, s.get_bool ("closeable", false));
}
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("MapPlayerNamesAndTribesPacket", packet_version, kCurrentPacketVersion);
}
} catch (const WException & e) {
throw GameDataError("player names and tribes: %s", e.what());
=== modified file 'src/map_io/map_player_position_packet.cc'
--- src/map_io/map_player_position_packet.cc 2014-10-31 07:46:04 +0000
+++ src/map_io/map_player_position_packet.cc 2015-10-24 15:45:00 +0000
@@ -58,7 +58,7 @@
}
}
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("MapPlayerPositionPacket", packet_version, kCurrentPacketVersion);
}
} catch (const WException & e) {
throw GameDataError("player positions: %s", e.what());
=== modified file 'src/map_io/map_players_view_packet.cc'
--- src/map_io/map_players_view_packet.cc 2015-04-15 17:52:52 +0000
+++ src/map_io/map_players_view_packet.cc 2015-10-24 15:45:00 +0000
@@ -347,7 +347,7 @@
m.csi.completedtime = immovables_file.unsigned_32();
}
} else {
- throw UnhandledVersionError(version, kCurrentPacketVersionImmovables);
+ throw UnhandledVersionError("MapPlayersViewPacket", version, kCurrentPacketVersionImmovables);
}
break;
case 4: // The player sees a port dock
@@ -660,7 +660,8 @@
if (node_immovable_kinds_file_version == kCurrentPacketVersionImmovableKinds) {
imm_kind = node_immovable_kinds_file.unsigned_8();
} else {
- throw UnhandledVersionError(node_immovable_kinds_file_version,
+ throw UnhandledVersionError("MapPlayersViewPacket - Node Immovable kinds",
+ node_immovable_kinds_file_version,
kCurrentPacketVersionImmovableKinds);
}
MapObjectData mod =
@@ -677,7 +678,8 @@
f_player_field.border_br = borders & 4;
f_player_field.border_bl = borders & 8;
} else {
- throw UnhandledVersionError(border_file_version, kCurrentPacketVersionBorder);
+ throw UnhandledVersionError("MapPlayersViewPacket - Border file",
+ border_file_version, kCurrentPacketVersionBorder);
}
break;
}
@@ -720,13 +722,15 @@
if (terrains_file_version == kCurrentPacketVersionTerrains) {
f_player_field.terrains.d = terrains_file.unsigned_8();
} else {
- throw UnhandledVersionError(terrains_file_version, kCurrentPacketVersionTerrains);
+ throw UnhandledVersionError("MapPlayersViewPacket - Terrains",
+ terrains_file_version, kCurrentPacketVersionTerrains);
}
uint8_t im_kind = 0;
if (triangle_immovable_kinds_file_version == kCurrentPacketVersionImmovableKinds) {
im_kind = triangle_immovable_kinds_file.unsigned_8();
} else {
- throw UnhandledVersionError(triangle_immovable_kinds_file_version,
+ throw UnhandledVersionError("MapPlayersViewPacket - Triangle Immovable kinds",
+ triangle_immovable_kinds_file_version,
kCurrentPacketVersionImmovableKinds);
}
MapObjectData mod =
@@ -747,13 +751,15 @@
if (terrains_file_version == kCurrentPacketVersionTerrains) {
f_player_field.terrains.r = terrains_file.unsigned_8();
} else {
- throw UnhandledVersionError(terrains_file_version, kCurrentPacketVersionTerrains);
+ throw UnhandledVersionError("MapPlayersViewPacket - Terrains",
+ terrains_file_version, kCurrentPacketVersionTerrains);
}
uint8_t im_kind = 0;
if (triangle_immovable_kinds_file_version == kCurrentPacketVersionImmovableKinds) {
im_kind = triangle_immovable_kinds_file.unsigned_8();
} else {
- throw UnhandledVersionError(triangle_immovable_kinds_file_version,
+ throw UnhandledVersionError("MapPlayersViewPacket - Triangle Immovable kinds",
+ triangle_immovable_kinds_file_version,
kCurrentPacketVersionImmovableKinds);
}
MapObjectData mod =
@@ -772,7 +778,8 @@
if (road_file_version == kCurrentPacketVersionRoads) {
roads = roads_file.unsigned_8();
} else {
- throw UnhandledVersionError(road_file_version, kCurrentPacketVersionRoads);
+ throw UnhandledVersionError("MapPlayersViewPacket - Road file",
+ road_file_version, kCurrentPacketVersionRoads);
}
}
if (f_seen | br_seen) {
@@ -783,7 +790,8 @@
if (road_file_version == kCurrentPacketVersionRoads) {
roads |= roads_file.unsigned_8();
} else {
- throw UnhandledVersionError(road_file_version, kCurrentPacketVersionRoads);
+ throw UnhandledVersionError("MapPlayersViewPacket - Road file",
+ road_file_version, kCurrentPacketVersionRoads);
}
}
if (f_seen | r_seen) {
@@ -794,7 +802,8 @@
if (road_file_version == kCurrentPacketVersionRoads) {
roads |= roads_file.unsigned_8();
} else {
- throw UnhandledVersionError(road_file_version, kCurrentPacketVersionRoads);
+ throw UnhandledVersionError("MapPlayersViewPacket - Road file",
+ road_file_version, kCurrentPacketVersionRoads);
}
}
roads |= f.field->get_roads() & mask;
@@ -811,13 +820,15 @@
survey = (f_everseen & bl_everseen & br_everseen)
&& surveys_file.unsigned_8();
} else {
- throw UnhandledVersionError(surveys_file_version, kCurrentPacketVersionSurveys);
+ throw UnhandledVersionError("MapPlayersViewPacket - Surveys file",
+ surveys_file_version, kCurrentPacketVersionSurveys);
}
if (survey) {
if (survey_amounts_file_version == kCurrentPacketVersionSurveyAmounts) {
f_player_field.resource_amounts.d = survey_amounts_file.unsigned_8();
} else {
- throw UnhandledVersionError(survey_amounts_file_version,
+ throw UnhandledVersionError("MapPlayersViewPacket - Survey amounts",
+ survey_amounts_file_version,
kCurrentPacketVersionSurveyAmounts);
}
try {
@@ -847,13 +858,15 @@
survey = (f_everseen & br_everseen & r_everseen)
&& surveys_file.unsigned_8();
} else {
- throw UnhandledVersionError(surveys_file_version, kCurrentPacketVersionSurveys);
+ throw UnhandledVersionError("MapPlayersViewPacket - Surveys file",
+ surveys_file_version, kCurrentPacketVersionSurveys);
}
if (survey) {
if (survey_amounts_file_version == kCurrentPacketVersionSurveyAmounts) {
f_player_field.resource_amounts.r = survey_amounts_file.unsigned_8();
} else {
- throw UnhandledVersionError(survey_amounts_file_version,
+ throw UnhandledVersionError("MapPlayersViewPacket - Survey amounts",
+ survey_amounts_file_version,
kCurrentPacketVersionSurveyAmounts);
}
try {
=== modified file 'src/map_io/map_port_spaces_packet.cc'
--- src/map_io/map_port_spaces_packet.cc 2015-04-11 21:03:05 +0000
+++ src/map_io/map_port_spaces_packet.cc 2015-10-24 15:45:00 +0000
@@ -56,7 +56,7 @@
map.set_port_space(get_safe_coords(std::to_string(static_cast<unsigned int>(i)), ext, &s2), true);
}
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("MapPortSpacesPacket", packet_version, kCurrentPacketVersion);
}
} catch (const WException & e) {
throw GameDataError("port_spaces data: %s", e.what());
=== modified file 'src/map_io/map_resources_packet.cc'
--- src/map_io/map_resources_packet.cc 2015-04-11 21:03:05 +0000
+++ src/map_io/map_resources_packet.cc 2015-10-24 15:45:00 +0000
@@ -90,7 +90,7 @@
}
}
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("MapResourcesPacket", packet_version, kCurrentPacketVersion);
}
} catch (const WException & e) {
throw GameDataError("port spaces: %s", e.what());
=== modified file 'src/map_io/map_road_packet.cc'
--- src/map_io/map_road_packet.cc 2014-10-12 07:35:42 +0000
+++ src/map_io/map_road_packet.cc 2015-10-24 15:45:00 +0000
@@ -61,7 +61,7 @@
}
}
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("MapRoadPacket", packet_version, kCurrentPacketVersion);
}
} catch (const WException & e) {
throw GameDataError("road: %s", e.what());
=== modified file 'src/map_io/map_roaddata_packet.cc'
--- src/map_io/map_roaddata_packet.cc 2015-04-11 21:03:05 +0000
+++ src/map_io/map_roaddata_packet.cc 2015-10-24 15:45:00 +0000
@@ -177,7 +177,7 @@
}
}
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("MapRoaddataPacket", packet_version, kCurrentPacketVersion);
}
} catch (const WException & e) {
throw GameDataError("roaddata: %s", e.what());
=== modified file 'src/map_io/map_scripting_packet.cc'
--- src/map_io/map_scripting_packet.cc 2015-04-11 21:03:05 +0000
+++ src/map_io/map_scripting_packet.cc 2015-10-24 15:45:00 +0000
@@ -64,7 +64,7 @@
upcast(LuaGameInterface, lgi, &g->lua());
lgi->read_global_env(fr, mol, fr.unsigned_32());
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("MapScriptingPacket", packet_version, kCurrentPacketVersion);
}
} catch (const WException & e) {
throw GameDataError("scripting: %s", e.what());
=== modified file 'src/map_io/map_terrain_packet.cc'
--- src/map_io/map_terrain_packet.cc 2014-10-12 07:35:42 +0000
+++ src/map_io/map_terrain_packet.cc 2015-10-24 15:45:00 +0000
@@ -74,7 +74,7 @@
f.set_terrain_d(smap[fr.unsigned_8()]);
}
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("MapTerrainPacket", packet_version, kCurrentPacketVersion);
}
} catch (const WException & e) {
throw GameDataError("terrain: %s", e.what());
=== modified file 'src/map_io/map_version_packet.cc'
--- src/map_io/map_version_packet.cc 2014-10-12 07:35:42 +0000
+++ src/map_io/map_version_packet.cc 2015-10-24 15:45:00 +0000
@@ -68,7 +68,7 @@
uint32_t ts = static_cast<uint32_t>(globv.get_safe_int("map_version_timestamp"));
map.m_map_version.m_map_version_timestamp = ts;
} else {
- throw UnhandledVersionError(packet_version, kCurrentPacketVersion);
+ throw UnhandledVersionError("MapVersionPacket", packet_version, kCurrentPacketVersion);
}
} catch (const WException & e) {
throw GameDataError("version: %s", e.what());
Follow ups