CorsixTH / CorsixTH

Open source clone of Theme Hospital
Other
3.95k stars 354 forks source link

[Bug] Outstanding improvement research for undiscovered diseases/objects breaks research policy window #2530

Open danieln-79 opened 3 months ago

danieln-79 commented 3 months ago

Describe the issue

After research was supposedly completed in the third category, drug research, the percentages was not carried over to the other categories. When manually subtracting the percentages, and adding them to another category, it did not add up to 100%.

Note: Screenshot was taken after the two bottom categories had finished. Before this, it was possible to assign percentages to 'drug research' even though the tooltip said no research was carried out.

Steps to Reproduce

  1. Load save game attached to this ticket

  2. Hit F6 and look at the research percentages. SCREEN

Expected Behaviour

The percentages should carry over to other categories when research is completed, and also add up to 100%.

Save Game

Save game attached to report: Yes RESEARCH_BUGGED.zip

CorsixTH Version

0.67

Operating System

Windows 11

Theme Hospital Version

GOG.com

Gamelog.txt

Gamelog generated on 2024-03-14 17:04:36
Compiled with api_version: 2684, arch: x64, audio: true, os: windows
SDL renderer: direct3d
Lua 5.4 run with api version: 2684, game version: v0.67, savegame version: 180
Created game with savegame version 180.
Savegame version is 180 (v0.67), originally it was 180 (v0.67).
Error in motion handler: 
Lua\game_ui.lua:485: attempt to index a nil value (field 'master')
stack traceback:
    Lua\game_ui.lua:485: in method 'onCursorWorldPositionChange'
    Lua\game_ui.lua:551: in function <Lua\game_ui.lua:539>
    (...tail calls...)
    Lua\app.lua:1102: in function <Lua\app.lua:1097>
Error in timer handler: 
Lua\game_ui.lua:485: attempt to index a nil value (field 'master')
stack traceback:
    Lua\game_ui.lua:485: in method 'onCursorWorldPositionChange'
    Lua\game_ui.lua:853: in method 'onTick'
    Lua\app.lua:1204: in function <Lua\app.lua:1199>
    (...tail calls...)
    Lua\app.lua:1102: in function <Lua\app.lua:1097>

Additional Information

No response

lewri commented 3 months ago

I think this is #2477 causing havoc elsewhere. Motion handler crashed. Did you place a ward or operating theatre down while paused before this?

I could be wrong though, the gamelog header refers to yesterday.

Out of interest was the research screen open at the time you got the notification drug research completed?

danieln-79 commented 3 months ago

No ward or operating theathre was built when this happened. :)

There were crashes yersterday, but I already forgot what happened just then.

The research screen could have been open when drug research was completed, that is actually quite likely.

I did also build a few rooms with the game paused in the very beginning, maybe thats a bad thing to do?

lewri commented 3 months ago

It's okay, that probably means it's unrelated to this instance. I think then some logic failed, and no error was given about it.

I did also build a few rooms with the game paused in the very beginning, maybe thats a bad thing to do?

This is mostly fine to do. But in 0.67 there's a bug with double doors if you hover over them when building in paused. That's been fixed for next release.

danieln-79 commented 3 months ago

Thank you for taking the time to reply. Much appreciated.

lewri commented 3 months ago

We can keep this open, there's still an issue here in that the numbers don't add up.

What happened here is specialisation still has a 20% allocation even though the screenshot says its done:

global -- total allocated research points
100

improvements
{
  [ [[frac]] ]=0,
  [ [[points]] ]=0
}

cure
{
  [ [[frac]] ]=0
}

specialisation
{
  [ [[frac]] ]=20,
  [ [[points]] ]=0
}

drugs
{
  [ [[frac]] ]=80,
  [ [[current]] ]={...},
  [ [[points]] ]=0
}

diagnosis
{
  [ [[frac]] ]=0
}

Specialisation is used as a sort of random focus on anything (too tired right now) regarding outstanding research. In truth, specialisation is never done until items 1-4 are done.

I'll continue to look into it.

lewri commented 3 months ago

Okay,

The reason Drug Research is still there is because this level hasn't yet discovered Sleeping Illness

diag_blood_machine      false
invisibility    true
heaped_piles    true
diag_scanner    false
sleeping_illness        false
uncommon_cold   true
slack_tongue    true
the_squits      true
tv_personalities        true
diag_ward       false
diag_general_diag       true
diag_ultrascan  false
diag_cardiogram true
diag_psych      true
gut_rot true
diag_x_ray      false
diag_gp true
bloaty_head     true

Ignore the false diag_ entries. The Research Department has a state where it falls back to "dummy" when there's still stuff to be done but the thing hasn't been discovered yet. For some reason though 'Specialisation' should have also got the dummy flag but it didn't. Hence, the window says "all done".

Not sure on the fix yet, but open to ideas from the other devs if they want to push a solution. https://github.com/CorsixTH/CorsixTH/blob/master/CorsixTH/Lua/research_department.lua