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

Proposed by GunChleoc
Status: Merged
Merged at revision: 8913
Proposed branch: lp:~widelands-dev/widelands/fix_immovabledescr_unpersist
Merge into: lp:widelands
Diff against target: 21 lines (+7/-4)
1 file modified
src/scripting/lua_map.cc (+7/-4)
To merge this branch: bzr merge lp:~widelands-dev/widelands/fix_immovabledescr_unpersist
Reviewer Review Type Date Requested Status
Widelands Developers Pending
Review via email: mp+357941@code.launchpad.net

Commit message

Fix unpersisting of LuaImmovableDescription for tribe immovables.

Description of the change

This bug does not seem to be triggered currently; I found it while looking at the code.

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

Continuous integration builds have changed state:

Travis build 4177. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/447739050.
Appveyor build 3975. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_fix_immovabledescr_unpersist-3975.

Revision history for this message
Notabilis (notabilis27) wrote :

I haven't tested it, but code is looking good.

Revision history for this message
GunChleoc (gunchleoc) wrote :

Since we've never actually run into the bug, I guess testing will be a bit difficult anyway. Thanks for the review!

@bunnybot merge

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/scripting/lua_map.cc'
--- src/scripting/lua_map.cc 2018-10-27 09:45:14 +0000
+++ src/scripting/lua_map.cc 2018-10-29 11:05:36 +0000
@@ -1868,10 +1868,13 @@
1868 UNPERS_STRING("name", name);1868 UNPERS_STRING("name", name);
1869 const World& world = get_egbase(L).world();1869 const World& world = get_egbase(L).world();
1870 DescriptionIndex idx = world.get_immovable_index(name);1870 DescriptionIndex idx = world.get_immovable_index(name);
1871 if (idx == INVALID_INDEX) {1871 if (idx != INVALID_INDEX) {
1872 throw LuaError((boost::format("Immovable '%s' doesn't exist.") % name).str());1872 set_description_pointer(world.get_immovable_descr(idx));
1873 }1873 } else {
1874 set_description_pointer(world.get_immovable_descr(idx));1874 const Tribes& tribes = get_egbase(L).tribes();
1875 idx = tribes.safe_immovable_index(name);
1876 set_description_pointer(tribes.get_immovable_descr(idx));
1877 }
1875}1878}
18761879
1877/* RST1880/* RST

Subscribers

People subscribed via source and target branches

to status/vote changes: