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

Proposed by GunChleoc
Status: Merged
Merged at revision: 8784
Proposed branch: lp:~widelands-dev/widelands/lenient_allowed_buildings
Merge into: lp:widelands
Diff against target: 12 lines (+1/-1)
1 file modified
src/map_io/map_allowed_building_types_packet.cc (+1/-1)
To merge this branch: bzr merge lp:~widelands-dev/widelands/lenient_allowed_buildings
Reviewer Review Type Date Requested Status
Notabilis code Approve
Review via email: mp+351749@code.launchpad.net

Commit message

When loading a game, simply skip buildings in the allowed list if they no longer exist

Description of the change

Removing the market made savegames incompatible, even if they didn't have any market buildings in it. This will fix it - a warning is enough. The change should also make tribe prototyping a bit easier.

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

Continuous integration builds have changed state:

Travis build 3736. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/409767340.
Appveyor build 3536. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_lenient_allowed_buildings-3536.

Revision history for this message
GunChleoc (gunchleoc) wrote :

Test run log with AppVeyor buld:

 Reading Resources Data ... took 7ms
 Reading Map Version Data ... took 1ms
 Reading Allowed Worker Types Data ... took 3ms
 Reading Allowed Building Types Data ... WARNING: MapAllowedBuildingTypesPacket - tribe barbarians does not define building type "barbarians_market"
took 2ms
 Reading Node Ownership Data ... took 4ms

Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 3766. State: errored. Details: https://travis-ci.org/widelands/widelands/builds/414411279.
Appveyor build 3565. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_lenient_allowed_buildings-3565.

Revision history for this message
Notabilis (notabilis27) wrote :

I haven't tested it, but the code looks okay.

One could consider displaying an in-game message instead/additionally to the console output. The console is probably overlooked by players, but a change in the building definitions could lead to broken scenario save games. Personally I don't think that this is important, though, if such a case happens loading will probably break in other steps as well.

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

Yes, if scenarios actually use nonexistent buildings, saveloading will tell the player so via UI if such a building has been built.

@bunnybot merge

Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 3787. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/415539866.
Appveyor build 3586. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_lenient_allowed_buildings-3586.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/map_io/map_allowed_building_types_packet.cc'
2--- src/map_io/map_allowed_building_types_packet.cc 2018-07-08 15:16:16 +0000
3+++ src/map_io/map_allowed_building_types_packet.cc 2018-08-13 15:57:31 +0000
4@@ -78,7 +78,7 @@
5 if (tribe.has_building(index)) {
6 player->allow_building_type(index, allowed);
7 } else {
8- throw GameDataError("tribe %s does not define building type \"%s\"",
9+ log("WARNING: MapAllowedBuildingTypesPacket - tribe %s does not define building type \"%s\"\n",
10 tribe.name().c_str(), name);
11 }
12 }

Subscribers

People subscribed via source and target branches

to status/vote changes: