sadger / CorsixTH

Open source clone of Theme Hospital
Other
1 stars 0 forks source link

Another crash on vaccination attempt #5

Closed sadger closed 10 years ago

sadger commented 10 years ago

Error on attempting to vaccinate a patient that has possibly already been cured - I think what is happening is the epidemic is finished and therefore nil and the nurse can't call and functions on it any more, checking for nil may fix this probably edge case.

from MarkL in main thread

Error in timer handler:
...CorsixTH-epidemics\CorsixTH\Lua\calls_dispatcher.lua:249: attempt to index local 'epidemic' (a nil value)
stack traceback:
...CorsixTH-epidemics\CorsixTH\Lua\calls_dispatcher.lua:249: in function <...CorsixTH-epidemics\CorsixTH\Lua\calls_dispatcher.lua:245>
(tail call): ?
...CorsixTH-epidemics\CorsixTH\Lua\calls_dispatcher.lua:436: in function 'executeCall'
...CorsixTH-epidemics\CorsixTH\Lua\calls_dispatcher.lua:358: in function 'answerCall'
...-epidemics\CorsixTH\Lua\humanoid_actions\meander.lua:32: in function '?'
...orsixTH-epidemics\CorsixTH\Lua\entities\humanoid.lua:550: in function 'Humanoid_startAction'
...orsixTH-epidemics\CorsixTH\Lua\entities\humanoid.lua:642: in function 'finishAction'
...xTH-epidemics\CorsixTH\Lua\humanoid_actions\idle.lua:31: in function 'timer_function'
...\corsixth\CorsixTH-epidemics\CorsixTH\Lua\entity.lua:178: in function 'tick'
...h\CorsixTH-epidemics\CorsixTH\Lua\entities\staff.lua:146: in function 'tick'
...p\corsixth\CorsixTH-epidemics\CorsixTH\Lua\world.lua:1039: in function 'onTick'
...top\corsixth\CorsixTH-epidemics\CorsixTH\Lua\app.lua:839: in function <...top\corsixth\CorsixTH-epidemics\CorsixTH\Lua\app.lua:836>
(tail call): ?
...top\corsixth\CorsixTH-epidemics\CorsixTH\Lua\app.lua:740: in function <...top\corsixth\CorsixTH-epidemics\CorsixTH\Lua\app.lua:735>

Keeping this separate from #4 as I believe that is a save issue and may be unrelated.

MarkL1961 commented 10 years ago

Got this error with a nurse which came at about the same time as the final fax from the health inspector

Error in timer handler: ...rimental-epidemics\CorsixTH\Lua\calls_dispatcher.lua:249: attempt to index local 'epidemic' (a nil value) stack traceback: ...rimental-epidemics\CorsixTH\Lua\calls_dispatcher.lua:249: in function <...rimental-epidemics\CorsixTH\Lua\calls_dispatcher.lua:245> (tail call): ? ...rimental-epidemics\CorsixTH\Lua\calls_dispatcher.lua:436: in function 'executeCall' ...rimental-epidemics\CorsixTH\Lua\calls_dispatcher.lua:358: in function 'answerCall' ...-epidemics\CorsixTH\Lua\humanoid_actions\meander.lua:32: in function '?' ...imental-epidemics\CorsixTH\Lua\entities\humanoid.lua:551: in function 'Humanoid_startAction' ...imental-epidemics\CorsixTH\Lua\entities\humanoid.lua:643: in function 'finishAction' ...tal-epidemics\CorsixTH\Lua\humanoid_actions\walk.lua:152: in function 'timer_function' ...sixTH-experimental-epidemics\CorsixTH\Lua\entity.lua:178: in function 'tick' ...perimental-epidemics\CorsixTH\Lua\entities\staff.lua:146: in function 'tick' ...rsixTH-experimental-epidemics\CorsixTH\Lua\world.lua:1066: in function 'onTick' ...CorsixTH-experimental-epidemics\CorsixTH\Lua\app.lua:839: in function <...CorsixTH-experimental-epidemics\CorsixTH\Lua\app.lua:836> (tail call): ? ...CorsixTH-experimental-epidemics\CorsixTH\Lua\app.lua:740: in function <...CorsixTH-experimental-epidemics\CorsixTH\Lua\app.lua:735>

sadger commented 10 years ago

Yeah it's the nurses again after the epidemic has ended, probably a nil check might fix this but then again I need to make sure the calls are dropped correctly and the nurses handle this case without moonwalking.

On ending the epidemic I might be able to see which nurses are currently vaccinating and then hopefully handle them nicely. We'll see.. it's fun action queue stuff.

sadger commented 10 years ago

I have added a commit to hopefully fix this, I know it's hard to test as it only happens in very few cases. The call should now be dropped and no longer appear in the calls dispatcher. Let me know if you get this issue again or nurses behave strangely when the epidemic has ended and they are still vaccinating.

MarkL1961 commented 10 years ago

Not sure if this is fixed, had the final fax and this lead to evacuation then noticed this in the console whilst the patients were leaving.

Total infected 24 Still infected patient count: 13 Cured patient count: 11 Reputation hit :366 Cover up fine :13000 Evacuating hospital Sending result fax Doing vaccination actions Doing vaccination actions

I didn't get any errors though :)

sadger commented 10 years ago

Yes I think that means it is fixed, is says doing vaccination actions before it tries to vaccinate. If it went through with the vaccination you would get a successful/unsuccessful message.

I should probably move the print statement but it's not a huge issue atm.

sadger commented 10 years ago

Seemingly fixed by cancelling call on nil epidemic!