Merge lp://staging/~widelands-dev/widelands/formerbuildings_index into lp://staging/widelands

Proposed by cghislai
Status: Merged
Merged at revision: 6718
Proposed branch: lp://staging/~widelands-dev/widelands/formerbuildings_index
Merge into: lp://staging/widelands
Diff against target: 404 lines (+72/-65)
10 files modified
src/logic/building.cc (+2/-2)
src/logic/building.h (+6/-6)
src/logic/constructionsite.cc (+7/-3)
src/logic/dismantlesite.cc (+10/-8)
src/logic/militarysite.cc (+4/-4)
src/logic/player.cc (+9/-8)
src/logic/player.h (+9/-9)
src/logic/playercommand.cc (+1/-1)
src/map_io/widelands_map_building_data_packet.cc (+1/-2)
src/map_io/widelands_map_buildingdata_data_packet.cc (+23/-22)
To merge this branch: bzr merge lp://staging/~widelands-dev/widelands/formerbuildings_index
Reviewer Review Type Date Requested Status
Nasenbaer Approve
Review via email: mp+179570@code.staging.launchpad.net

Description of the change

Previously former building information was stored as Building_Descr pointers.
Here it is stored as building_Index values.
It prevents the crash to happen on Ubuntu 12.04.

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

Generally the changes look good (beside of the already elsewhere mentioned copyright year in the header :) ).

However I tested the change with all my savegames and quite some savegames failed to load. I even got a segfault:

 Reading Building Data ...
Program received signal SIGSEGV, Segmentation fault.
0x087401f4 in Widelands::Player::tribe (this=0x0) at /home/drehatlas/widelands/widelands/src/logic/player.h:116
116 const Tribe_Descr & tribe() const throw () {return m_tribe;}
(gdb) bt
#0 0x087401f4 in Widelands::Player::tribe (this=0x0) at /home/drehatlas/widelands/widelands/src/logic/player.h:116
#1 0x0890fb1a in Widelands::DismantleSite::DismantleSite (this=0xb362150, gdescr=..., egbase=..., c=..., plr=..., loading=true,
    former_buildings=std::vector of length 1, capacity 1 = {...}) at /home/drehatlas/widelands/widelands/src/logic/dismantlesite.cc:77
#2 0x089084cf in Widelands::Editor_Game_Base::warp_dismantlesite (this=0xbfffc3a4, c=..., owner=1 '\001', loading=true,
    former_buildings=std::vector of length 1, capacity 1 = {...}) at /home/drehatlas/widelands/widelands/src/logic/editor_game_base.cc:349
#3 0x08a2945b in Widelands::Map_Building_Data_Packet::Read (this=0xbfffc0dc, fs=..., egbase=..., skip=false, mol=...)
    at /home/drehatlas/widelands/widelands/src/map_io/widelands_map_building_data_packet.cc:91
#4 0x08a1e7a0 in Widelands::WL_Map_Loader::load_map_complete (this=0x956f888, egbase=..., scenario=true)
    at /home/drehatlas/widelands/widelands/src/map_io/widelands_map_loader.cc:246
#5 0x08a739a7 in Widelands::Game_Map_Data_Packet::Read_Complete (this=0xbfffc218, game=...) at /home/drehatlas/widelands/widelands/src/game_io/game_map_data_packet.cc:56
#6 0x087ee732 in Widelands::Game_Loader::load_game (this=0xbfffc340, multiplayer=false) at /home/drehatlas/widelands/widelands/src/game_io/game_loader.cc:82
#7 0x0892dc13 in Widelands::Game::run_load_game (this=0xbfffc3a4, filename="save/Katy.wgf") at /home/drehatlas/widelands/widelands/src/logic/game.cc:415
#8 0x086e6cf6 in WLApplication::load_game (this=0x920a838) at /home/drehatlas/widelands/widelands/src/wlapplication.cc:2063
#9 0x086e5fd9 in WLApplication::mainmenu_singleplayer (this=0x920a838) at /home/drehatlas/widelands/widelands/src/wlapplication.cc:1650
#10 0x086e5b94 in WLApplication::mainmenu (this=0x920a838) at /home/drehatlas/widelands/widelands/src/wlapplication.cc:1567
#11 0x086e11b2 in WLApplication::run (this=0x920a838) at /home/drehatlas/widelands/widelands/src/wlapplication.cc:469
#12 0x086df695 in main (argc=1, argv=0xbfffed64) at /home/drehatlas/widelands/widelands/src/main.cc:103

I will send you the savegame I triggered this crash with per mail

review: Needs Fixing
Revision history for this message
cghislai (charlyghislain) wrote :

The change should work fine with build17 savegames. However, if you have savegames from former trunk, with the descr pointer, it will fail.

Revision history for this message
cghislai (charlyghislain) wrote :

Wait I'm speaking too fast - as only string are stored in savegames it should work fine

Revision history for this message
Nasenbaer (nasenbaer) wrote :

> Wait I'm speaking too fast - as only string are stored in savegames it should
> work fine

and it (the savegame) does with current trunk - but unfortunally not with this branch merged into trunk

Revision history for this message
cghislai (charlyghislain) wrote :

ah, I used the owner field right before setting it up :/

Revision history for this message
Nasenbaer (nasenbaer) wrote :

Thanks for the fast answer.
I checked the fixed version over here with a quick source code overview and of course loading of tons of save games - everything seems to be alright. :)

Again, thank you a lot for the good work cghislai :)!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to status/vote changes: