Closed Grimdoc closed 9 years ago
I think the plan is to remove the cheat, after all who would want to create an epidemic other than for testing. (then again we have a cheat for earthquakes don't we!) I don't think the other scenario is possible either, as one epidemic would need to end before another can be created. That said, it could as you have said happen as soon as one as ended. Sadger will have a better idea on this I reckon.
But the first must have already ended, since the "clock" on the left side disappeared, and the patient had already left the hospital (long before the clock ended)?
I think this must be related to the last commits Sadger did, as I have not yet download them. Looking at the code on line 417 he has added timer, but I can't see where that comes from as there is no declaration for it or additional file.
@Grimdoc go to line 417 in epidemic lua and add self. in front of timer to see if you still get an error
I added what you said, and tried to send the infected patient home (after the outbreak):
Infections/Attempted :1/4 Spawning Inspector An error has occured! Almost anything can be the cause, but the detailed information below can help th e developers find the source of the error. Running: The timer handler. A stack trace is included below, and the handler has been disconnected. C:\Games\CorsixTH\Lua\epidemic.lua:417: use of undeclared variable 'timer' stack traceback: [C]: in function 'error' C:\Games\CorsixTH\Lua\strict.lua:43: in function '__index' C:\Games\CorsixTH\Lua\epidemic.lua:417: in function 'finishCoverUp' C:\Games\CorsixTH\Lua\epidemic.lua:254: in function 'checkNoInfectedPlayerHasLeft' C:\Games\CorsixTH\Lua\epidemic.lua:99: in function 'tick' C:\Games\CorsixTH\Lua\hospital.lua:1303: in function 'manageEpidemics' C:\Games\CorsixTH\Lua\hospital.lua:789: in function 'tick' C:\Games\CorsixTH\Lua\world.lua:1028: in function 'onTick' C:\Games\CorsixTH\Lua\app.lua:839: in function 'dispatch' C:\Games\CorsixTH\Lua\app.lua:740: in function <C:\Games\CorsixTH\Lua\app.lua:735>
Error in timer handler: C:\Games\CorsixTH\Lua\epidemic.lua:417: use of undeclared variable 'timer' stack traceback: [C]: in function 'error' C:\Games\CorsixTH\Lua\strict.lua:43: in function '__index' C:\Games\CorsixTH\Lua\epidemic.lua:417: in function 'finishCoverUp' C:\Games\CorsixTH\Lua\epidemic.lua:254: in function 'checkNoInfectedPlayerHasLeft' C:\Games\CorsixTH\Lua\epidemic.lua:99: in function 'tick' C:\Games\CorsixTH\Lua\hospital.lua:1303: in function 'manageEpidemics' C:\Games\CorsixTH\Lua\hospital.lua:789: in function 'tick' C:\Games\CorsixTH\Lua\world.lua:1028: in function 'onTick' C:\Games\CorsixTH\Lua\app.lua:839: in function 'dispatch' C:\Games\CorsixTH\Lua\app.lua:740: in function <C:\Games\CorsixTH\Lua\app.lua:735> Warning: No event handler for timer
Done - please update your repo and shouldn't have this error any more.
Oh, what do you think @sadger ? Could it be that these events are already underway so the change is not seen?
Yes you have to start a new instance of an epidemic - an existing one will still have the nil reference.
With your updated files, and a new custom game. Started an epidemic via the cheat menu (just one). The patient got the symbol, and I marked her. She was waiting in line for the pharmacy, got her medicine, and left the hospital. When the clock reached zero (takes a long time), the health minister came, and the game crashed when he reached the reception.
An error has occured! Almost anything can be the cause, but the detailed information below can help th e developers find the source of the error. Running: The timer handler. A stack trace is included below, and the handler has been disconnected. C:\Games\CorsixTH\Lua\epidemic.lua:417: use of undeclared variable 'timer' stack traceback: [C]: in function 'error' C:\Games\CorsixTH\Lua\strict.lua:43: in function '__index' C:\Games\CorsixTH\Lua\epidemic.lua:417: in function 'finishCoverUp' C:\Games\CorsixTH\Lua\objects\reception_desk.lua:111: in function 'tick' C:\Games\CorsixTH\Lua\world.lua:1040: in function 'onTick' C:\Games\CorsixTH\Lua\app.lua:839: in function 'dispatch' C:\Games\CorsixTH\Lua\app.lua:740: in function <C:\Games\CorsixTH\Lua\app.lua:735>
Error in timer handler: C:\Games\CorsixTH\Lua\epidemic.lua:417: use of undeclared variable 'timer' stack traceback: [C]: in function 'error' C:\Games\CorsixTH\Lua\strict.lua:43: in function '__index' C:\Games\CorsixTH\Lua\epidemic.lua:417: in function 'finishCoverUp' C:\Games\CorsixTH\Lua\objects\reception_desk.lua:111: in function 'tick' C:\Games\CorsixTH\Lua\world.lua:1040: in function 'onTick' C:\Games\CorsixTH\Lua\app.lua:839: in function 'dispatch' C:\Games\CorsixTH\Lua\app.lua:740: in function <C:\Games\CorsixTH\Lua\app.lua:735> Warning: No event handler for timer
@sadger If the inspector arrives and that is calling for the timer to end then that is the problem as the timer has already gone hasn't it?
If this self.timer:close()
is there just in case perhaps make it if self.timer then self.timer:close() end
I did not get the error with things as they are, but I had an emergency after the timer closed and before the inspector arrived - would that make a difference?
Ran the autosave and did not accept the emergency this time and still no error! @Grimdoc can you send me your save please as I cannot replicate the error?
I didn't get an error either, I think it's an edge case maybe. I'm looking at it as we speak, the timer is just a reference to the epidemic timer and having an emergency shouldn't cause any issues.
Sigh.. It seems that I hadn't been able to clean up the old files, or something. I did a clean CTH v0.3 install, and added epidemics (latest update), loaded the save, and now it worked. That means sadgers patch from yesterday worked. Great!
Will continue some testing, but this can probably be closed.
@Grimdoc Can you confirm if this bug still exists
Just tested this on a custom game and creating an epidemic with cheats. The first epidemic was solved fast (the only affected person was cured before he could infect anyone). The "infection clock" was removed when the time ran out. But the health minister decided to come over after that. When the health minister was on his way, I created another epidemic from the cheat menu. This was timed so that the infected patient (not yet visible) and the VIP came to the reception about the same time. This created the error mentioned below. This maybe won't happen if one does not use cheats (?), but it is probably possible to get two epidemics in series, so that this can happen with normal play?
Error log:
Spawning Inspector Cannot create new epidemic, one already in progress An error has occured! Almost anything can be the cause, but the detailed information below can help th e developers find the source of the error. Running: The timer handler. A stack trace is included below, and the handler has been disconnected. C:\Games\CorsixTH\Lua\epidemic.lua:417: use of undeclared variable 'timer' stack traceback: [C]: in function 'error' C:\Games\CorsixTH\Lua\strict.lua:43: in function '__index' C:\Games\CorsixTH\Lua\epidemic.lua:417: in function 'finishCoverUp' C:\Games\CorsixTH\Lua\objects\reception_desk.lua:111: in function 'tick' C:\Games\CorsixTH\Lua\world.lua:1040: in function 'onTick' C:\Games\CorsixTH\Lua\app.lua:839: in function 'dispatch' C:\Games\CorsixTH\Lua\app.lua:740: in function <C:\Games\CorsixTH\Lua\app.lua:735>
Error in timer handler: C:\Games\CorsixTH\Lua\epidemic.lua:417: use of undeclared variable 'timer' stack traceback: [C]: in function 'error' C:\Games\CorsixTH\Lua\strict.lua:43: in function '__index' C:\Games\CorsixTH\Lua\epidemic.lua:417: in function 'finishCoverUp' C:\Games\CorsixTH\Lua\objects\reception_desk.lua:111: in function 'tick' C:\Games\CorsixTH\Lua\world.lua:1040: in function 'onTick' C:\Games\CorsixTH\Lua\app.lua:839: in function 'dispatch' C:\Games\CorsixTH\Lua\app.lua:740: in function <C:\Games\CorsixTH\Lua\app.lua:735> Warning: No event handler for timer