ospaceteam / outerspace

Outer Space is turn-base 4X multiplayer on-line strategy game.
GNU General Public License v2.0
20 stars 10 forks source link

Galaxy victory fail Bug #163

Closed temuchin- closed 6 years ago

temuchin- commented 6 years ago

When a player declares winner, via game dialog or menu option, the game errors out & never logs victory.

claims global name is undefined. line 334 of client/osci/dialog/MainGameDlg.py shownFromMenu

Checked for any variable definitions of or near this name, & it seems this is the only one in existence, even checked for ones under different spellings / mispellings / near names. wondered if this was a pygame constant?? still nothing.

I see it checking for date time stamp to make sure the galaxy has advanced far enough intime from 0 / previous win. Not sure what if localTime - storedTime > 60 60 24 or shownFromMenu == True: the 2nd half of the or statement is supposed to accomplish. Can hack out the or statement but that might break something else.

Quick stoopid rant. (this is why code comments are useful, sonot only can java docs can suss out the flow of the code; also when debugging other peoples code == determining g a temporal locality on a near infinite amount of mind states w/o knowing any of the initial conditions, blech)

dahaic commented 6 years ago

I can fully agree on lack of comments in the code I produce. It might be a bit of a chicken/egg problem though, where comment doesn't make sense without context, and to create context, I would need to comment bunch of other code.

For this particular issue, it was code I forgot to remove in change how galaxy finish is handled (in respect to single player games). For the imperator to be able to finish galaxy, you also have to fix server, otherwise it will traceback and no restart will happen.

Thanks for the report!

temuchin- commented 6 years ago

cool, I hacked out the back half of the "or" statement on my local build. universe now finishes properly.

Yeah, comments being added later can become a pain. Thank you for the relevant comments you have been adding.

temuchin- commented 6 years ago

spoke too soon. ERROR in server/lib/ige/ospace/IUniverse.py MSG_GNC_GALAXY_RESTARTED not defined also noted an orphan not defined MSG_GNC_GALAXY_AUTO_RESTARTED did notice server/lib/ige/ospace/const.py & client/osci/messages.py has defined / alloted MSG_GNC_GALAXY_FINISHED MSG_GNC_GALAXY_AUTO_FINISHED

dahaic commented 6 years ago

@temuchin- that's why fixing commit has also changes in IUniverse.py and why I explicitly mentioned it in second paragraph of my comment :)

temuchin- commented 6 years ago

Doh! overlooked the last comment about "fix server", & then when I went to look at IUniverse.py & I didn't see any changes committed. Well I have made server changes locally. Then when back & now I see changes had been committed earlier.

Also yeah the universe now ends properly.