LoneGazebo / Community-Patch-DLL

Community Patch for Civilization V - Brave New World
Other
286 stars 158 forks source link

Crash on restart button + settling a city #756

Closed LoneGazebo closed 8 years ago

LoneGazebo commented 8 years ago

Ilterioi,

I've pinpointed the crash on restart/settle or settle/restart to here (see gallery for callstack below), but I can't quite get it to not crash. I've fiddled some, but not much. In any case, you can reproduce by starting a game, using restart button, settling, and then using restart button again (any combination should probably cause it.

untitled5 untitled6 untitled7 untitled8 untitled9 untitled10 untitled untitled2 untitled3 untitled4

LoneGazebo commented 8 years ago

Seems a key variable is not being refreshed properly on restart. Fixing this might also fix multiplayer issues with desyncs on save/load (as the logic seems to be the same).

G

ilteroi commented 8 years ago

wow, a picture story!

i got one of my own too:

image

stack overflow!

seriously, i'll try to reproduce ...

LoneGazebo commented 8 years ago

Yay, those are fun. Is that due to something you've done recently, or is it a problem already in the DLL?

G

ilteroi commented 8 years ago

didn't touch it. i think i have a fix, but it's hard to verify, was a strange configuration with multiple masters and vassals.

reproduced your issue and it seems gGlobals.m_map is not initialized. the hunt is on

LoneGazebo commented 8 years ago

Ah, I didn't look at that element when trying to debug. Admittedly my glance was cursory (I've been a wee bit busy as of late). Sorry for tossing it on you!

ilteroi commented 8 years ago

i do enjoy a good puzzle now and then :)

unfortunately, it seems there's little to be done about it (on dll side at least). CvGame::InitMap() is just never called in the bad case. The correct entry point would be CvDllGame::Init2()

LoneGazebo commented 8 years ago

Hmm...so the initialization isn't being called in our DLL? If that's the case, then why does our DLL (but not other custom DLLs) crash on restart? Any way we can force initmap into our initialization? G

LoneGazebo commented 8 years ago

I'm going to spelunk a bit as well.

ilteroi commented 8 years ago

after sleeping over it, i may have been looking in the wrong place.

initPlayers() leads to the crash and it's called before initMap().

need to investigate some more

ilteroi commented 8 years ago

ok, i think i got it. flavor manager was re-initialized before the old cities have been cleared

LoneGazebo commented 8 years ago

Odd! Was that a CP change, or standard?