Andrettin / Wyrmsun

Strategy game based on history, mythology and fiction
http://andrettin.github.io/
GNU General Public License v2.0
307 stars 48 forks source link

Crash when choosing custom map created in Editor #29

Closed KroArtem closed 9 years ago

KroArtem commented 9 years ago

Wyrmsun and Wyrmgus as always the latest. If you choose Custom game in Worlds, maps are shown. I've created a map .smp (yes, without a name) and it was displayed in Map menu as a blank field. I chose it and tried to start a map, this is what happened:

Program received signal SIGSEGV, Segmentation fault.
0x000000000064b78f in CMapFieldPlayerInfo::IsVisible (this=0x7fffdd785568, 
    player=...) at /home/kroartem/SVN/Wyrmgus/src/map/mapfield.cpp:397
397     return Visible[player.Index] >= 2 || (!fogOfWar && IsExplored(player));
(gdb) bt
#0  0x000000000064b78f in CMapFieldPlayerInfo::IsVisible (this=0x7fffdd785568, 
    player=...) at /home/kroartem/SVN/Wyrmgus/src/map/mapfield.cpp:397
#1  0x000000000064b674 in CMapFieldPlayerInfo::TeamVisibilityState (
    this=0x7fffdd785568, player=...)
    at /home/kroartem/SVN/Wyrmgus/src/map/mapfield.cpp:368
#2  0x000000000064b7f7 in CMapFieldPlayerInfo::IsTeamVisible (
    this=0x7fffdd785568, player=...)
    at /home/kroartem/SVN/Wyrmgus/src/map/mapfield.cpp:402
#3  0x0000000000646af6 in MapMarkTileSight (player=..., index=18020)
    at /home/kroartem/SVN/Wyrmgus/src/map/map_fog.cpp:229
#4  0x0000000000647049 in MapSight (player=..., pos=..., w=1, h=1, range=1, 
    marker=0x646a47 <MapMarkTileSight(CPlayer const&, unsigned int)>)
    at /home/kroartem/SVN/Wyrmgus/src/map/map_fog.cpp:353
#5  0x000000000078d239 in MapMarkUnitSightRec (unit=..., pos=..., width=1, 
    height=1, f=0x646a47 <MapMarkTileSight(CPlayer const&, unsigned int)>, 
    f2=0x646d19 <MapMarkTileDetectCloak(CPlayer const&, unsigned int)>)
    at /home/kroartem/SVN/Wyrmgus/src/unit/unit.cpp:1136
#6  0x000000000078d3fa in MapMarkUnitSight (unit=...)
    at /home/kroartem/SVN/Wyrmgus/src/unit/unit.cpp:1180
#7  0x000000000078e051 in CUnit::Place (this=0x86eca70, pos=...)
    at /home/kroartem/SVN/Wyrmgus/src/unit/unit.cpp:1506
#8  0x000000000076c1b9 in CclCreateUnit (l=0x2487780)
    at /home/kroartem/SVN/Wyrmgus/src/unit/script_unit.cpp:729
---Type <return> to continue, or q <return> to quit---
#9  0x00007ffff7bb7360 in ?? () from /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
#10 0x00007ffff7bc1e97 in ?? () from /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
#11 0x00007ffff7bb77bd in ?? () from /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
#12 0x00007ffff7bb6a9e in ?? () from /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
#13 0x00007ffff7bb792b in ?? () from /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
#14 0x00007ffff7bb33e8 in lua_pcall ()
   from /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
#15 0x00000000006e6ae6 in LuaCall (narg=0, clear=1, exitOnError=true)
    at /home/kroartem/SVN/Wyrmgus/src/stratagus/script.cpp:168
#16 0x00000000006e6e26 in LuaLoadFile (file="./maps/.sms")
    at /home/kroartem/SVN/Wyrmgus/src/stratagus/script.cpp:225
#17 0x00000000005fd0f6 in LoadStratagusMap (smpname="maps/.smp", 
    mapname="maps/.sms") at /home/kroartem/SVN/Wyrmgus/src/game/game.cpp:257
#18 0x00000000005ff99e in LoadMap (filename="maps/.smp", map=...)
    at /home/kroartem/SVN/Wyrmgus/src/game/game.cpp:761
#19 0x000000000060036c in CreateGame (filename="maps/.smp", map=0xb41f20 <Map>)
    at /home/kroartem/SVN/Wyrmgus/src/game/game.cpp:1019
#20 0x00000000005fcbb4 in StartMap (filename="maps/.smp", clean=true)
    at /home/kroartem/SVN/Wyrmgus/src/game/game.cpp:158
#21 0x00000000007efe88 in tolua_stratagus_StartMap00 (tolua_S=0x2487780)
    at /home/kroartem/SVN/Wyrmgus/tolua.cpp:1064
#22 0x00007ffff7bb7360 in ?? () from /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
#23 0x00007ffff7bc1efa in ?? () from /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
---Type <return> to continue, or q <return> to quit---
#24 0x00007ffff7bb77bd in ?? () from /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
#25 0x00007ffff7bb6a9e in ?? () from /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
#26 0x00007ffff7bb792b in ?? () from /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
#27 0x00007ffff7bb33e8 in lua_pcall ()
   from /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
#28 0x00000000006da797 in LuaCallback::run (this=0x86b8e48, results=0)
    at /home/kroartem/SVN/Wyrmgus/src/stratagus/luacallback.cpp:149
#29 0x0000000000753dc0 in LuaActionListener::action (this=0x86b8e40, 
    eventId="") at /home/kroartem/SVN/Wyrmgus/src/ui/widgets.cpp:392
#30 0x0000000000618c64 in gcn::Widget::generateAction (this=0x86b8c00)
    at /home/kroartem/SVN/Wyrmgus/src/guichan/widget.cpp:616
#31 0x000000000061c2c5 in gcn::Button::mouseClick (this=0x86b8c00, button=1)
    at /home/kroartem/SVN/Wyrmgus/src/guichan/widgets/button.cpp:254
#32 0x000000000061869d in gcn::Widget::_mouseInputMessage (this=0x86b8c00, 
    mouseInput=...) at /home/kroartem/SVN/Wyrmgus/src/guichan/widget.cpp:502
#33 0x000000000061de2f in gcn::Container::_mouseInputMessage (this=0x7c945c0, 
    mouseInput=...)
    at /home/kroartem/SVN/Wyrmgus/src/guichan/widgets/container.cpp:394
#34 0x000000000060ffbc in gcn::Gui::logic (this=0x816b2d0)
    at /home/kroartem/SVN/Wyrmgus/src/guichan/gui.cpp:155
#35 0x0000000000753bef in handleInput (event=0x0)
    at /home/kroartem/SVN/Wyrmgus/src/ui/widgets.cpp:341
#36 0x00000000007d6799 in WaitEventsOneFrame ()
---Type <return> to continue, or q <return> to quit---
    at /home/kroartem/SVN/Wyrmgus/src/video/sdl.cpp:989
#37 0x000000000075f9bc in MenuScreen::run (this=0x7c945c0, loop=true)
    at /home/kroartem/SVN/Wyrmgus/src/ui/widgets.cpp:3115
#38 0x0000000000834eeb in tolua_stratagus_CMenuScreen_run00 (tolua_S=0x2487780)
    at /home/kroartem/SVN/Wyrmgus/tolua.cpp:25142
#39 0x00007ffff7bb7360 in ?? () from /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
#40 0x00007ffff7bc1efa in ?? () from /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
#41 0x00007ffff7bb77bd in ?? () from /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
#42 0x00007ffff7bb6a9e in ?? () from /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
#43 0x00007ffff7bb792b in ?? () from /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
#44 0x00007ffff7bb33e8 in lua_pcall ()
   from /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
#45 0x00000000006da797 in LuaCallback::run (this=0x8610b18, results=0)
    at /home/kroartem/SVN/Wyrmgus/src/stratagus/luacallback.cpp:149
#46 0x0000000000753dc0 in LuaActionListener::action (this=0x8610b10, 
    eventId="") at /home/kroartem/SVN/Wyrmgus/src/ui/widgets.cpp:392
#47 0x0000000000618c64 in gcn::Widget::generateAction (this=0x86108b0)
    at /home/kroartem/SVN/Wyrmgus/src/guichan/widget.cpp:616
#48 0x000000000061c2c5 in gcn::Button::mouseClick (this=0x86108b0, button=1)
    at /home/kroartem/SVN/Wyrmgus/src/guichan/widgets/button.cpp:254
#49 0x000000000061869d in gcn::Widget::_mouseInputMessage (this=0x86108b0, 
    mouseInput=...) at /home/kroartem/SVN/Wyrmgus/src/guichan/widget.cpp:502
#50 0x000000000061de2f in gcn::Container::_mouseInputMessage (this=0x8671d50, 
---Type <return> to continue, or q <return> to quit---
    mouseInput=...)
    at /home/kroartem/SVN/Wyrmgus/src/guichan/widgets/container.cpp:394
#51 0x000000000060ffbc in gcn::Gui::logic (this=0x816b2d0)
    at /home/kroartem/SVN/Wyrmgus/src/guichan/gui.cpp:155
#52 0x0000000000753bef in handleInput (event=0x0)
    at /home/kroartem/SVN/Wyrmgus/src/ui/widgets.cpp:341
#53 0x00000000007d6799 in WaitEventsOneFrame ()
    at /home/kroartem/SVN/Wyrmgus/src/video/sdl.cpp:989
#54 0x000000000075f9bc in MenuScreen::run (this=0x8671d50, loop=true)
    at /home/kroartem/SVN/Wyrmgus/src/ui/widgets.cpp:3115
#55 0x0000000000834eeb in tolua_stratagus_CMenuScreen_run00 (tolua_S=0x2487780)
    at /home/kroartem/SVN/Wyrmgus/tolua.cpp:25142
#56 0x00007ffff7bb7360 in ?? () from /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
#57 0x00007ffff7bc1e97 in ?? () from /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
#58 0x00007ffff7bb77bd in ?? () from /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
#59 0x00007ffff7bb6a9e in ?? () from /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
#60 0x00007ffff7bb792b in ?? () from /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
#61 0x00007ffff7bb33e8 in lua_pcall ()
   from /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
#62 0x00000000006da797 in LuaCallback::run (this=0x7c98548, results=0)
    at /home/kroartem/SVN/Wyrmgus/src/stratagus/luacallback.cpp:149
#63 0x0000000000753dc0 in LuaActionListener::action (this=0x7c98540, 
    eventId="") at /home/kroartem/SVN/Wyrmgus/src/ui/widgets.cpp:392
---Type <return> to continue, or q <return> to quit---
#64 0x0000000000618c64 in gcn::Widget::generateAction (this=0x7c982a0)
    at /home/kroartem/SVN/Wyrmgus/src/guichan/widget.cpp:616
#65 0x000000000061c2c5 in gcn::Button::mouseClick (this=0x7c982a0, button=1)
    at /home/kroartem/SVN/Wyrmgus/src/guichan/widgets/button.cpp:254
#66 0x000000000061869d in gcn::Widget::_mouseInputMessage (this=0x7c982a0, 
    mouseInput=...) at /home/kroartem/SVN/Wyrmgus/src/guichan/widget.cpp:502
#67 0x000000000061de2f in gcn::Container::_mouseInputMessage (this=0x7c970d0, 
    mouseInput=...)
    at /home/kroartem/SVN/Wyrmgus/src/guichan/widgets/container.cpp:394
#68 0x000000000060ffbc in gcn::Gui::logic (this=0x816b2d0)
    at /home/kroartem/SVN/Wyrmgus/src/guichan/gui.cpp:155
#69 0x0000000000753bef in handleInput (event=0x0)
    at /home/kroartem/SVN/Wyrmgus/src/ui/widgets.cpp:341
#70 0x00000000007d6799 in WaitEventsOneFrame ()
    at /home/kroartem/SVN/Wyrmgus/src/video/sdl.cpp:989
#71 0x000000000075f9bc in MenuScreen::run (this=0x7c970d0, loop=true)
    at /home/kroartem/SVN/Wyrmgus/src/ui/widgets.cpp:3115
#72 0x0000000000834eeb in tolua_stratagus_CMenuScreen_run00 (tolua_S=0x2487780)
    at /home/kroartem/SVN/Wyrmgus/tolua.cpp:25142
#73 0x00007ffff7bb7360 in ?? () from /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
#74 0x00007ffff7bc1e97 in ?? () from /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
#75 0x00007ffff7bb77bd in ?? () from /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
#76 0x00007ffff7bb6a9e in ?? () from /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
---Type <return> to continue, or q <return> to quit---
#77 0x00007ffff7bb792b in ?? () from /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
#78 0x00007ffff7bb33e8 in lua_pcall ()
   from /usr/lib/x86_64-linux-gnu/liblua5.1.so.0
#79 0x00000000006e6ae6 in LuaCall (narg=0, clear=1, exitOnError=true)
    at /home/kroartem/SVN/Wyrmgus/src/stratagus/script.cpp:168
#80 0x00000000006e6e26 in LuaLoadFile (file="scripts/guichan.lua")
    at /home/kroartem/SVN/Wyrmgus/src/stratagus/script.cpp:225
#81 0x0000000000710cae in MenuLoop ()
    at /home/kroartem/SVN/Wyrmgus/src/stratagus/stratagus.cpp:305
#82 0x0000000000711645 in stratagusMain (argc=1, argv=0x7fffffffdf38)
    at /home/kroartem/SVN/Wyrmgus/src/stratagus/stratagus.cpp:787
#83 0x00000000006da87d in main (argc=1, argv=0x7fffffffdf38)
    at /home/kroartem/SVN/Wyrmgus/src/stratagus/main.cpp:37
KroArtem commented 9 years ago

If a map has to satisfy several conditions to be played, it has to be sorted before we try to start a map and should not be shown in maps available. ;)

Andrettin commented 9 years ago

Could you post the map in question? When I create maps with the editor (even ones that don't have a name), they appear and load fine in the custom game menu. If it doesn't have a name the map's filename should appear in the map selection instead (I just tried that out and it worked without issues).

KroArtem commented 9 years ago

Of course, forgot to add the files. https://www.dropbox.com/s/0zud2dvbhz2mcfb/.sms?dl=0 https://www.dropbox.com/s/0zud2dvbhz2mcfb/.sms?dl=0

Andrettin commented 9 years ago

Thanks! From your SMS it seems that the issue is that the map has no person players. I made it so now the editor gives an error message if you try to save a map without a person player, and that such maps no longer appear in the custom game map selection drop-down:

https://github.com/Andrettin/Wyrmsun/commit/51c8035974a838488714b776648ec20e6b7674b5