Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assert in Weapon::Get_Percent_Ready_To_Fire() is hit after using clear mines ability #916

Closed
xezon opened this issue May 13, 2023 · 2 comments · Fixed by #928
Closed

Assert in Weapon::Get_Percent_Ready_To_Fire() is hit after using clear mines ability #916

xezon opened this issue May 13, 2023 · 2 comments · Fixed by #928
Labels

Comments

@xezon
Copy link
Contributor

xezon commented May 13, 2023

Assert is hit after using clear mines ability:

captainslog_dbgassert(time_left <= total_time, "time_left <= total_time");
>	thyme.dll!Weapon::Get_Percent_Ready_To_Fire() Line 1026	C++
 	game.dat!005a45c4()	Unknown
 	game.dat![Frames below may be incorrect and/or missing, no symbols loaded for game.dat]	Unknown
 	game.dat!005a3cf9()	Unknown
 	game.dat!0045e9e8()	Unknown
 	game.dat!0050a6fa()	Unknown
 	game.dat!004ad301()	Unknown
 	thyme.dll!GameEngine::Update() Line 176	C++
 	thyme.dll!Win32GameEngine::Update() Line 58	C++
 	thyme.dll!GameEngine::Execute() Line 556	C++
 	thyme.dll!Game_Main(int argc, char * * argv) Line 41	C++
 	thyme.dll!main(int argc, char * * argv) Line 700	C++
 	thyme.dll!Main_Func(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, char * lpCmdLine, int nCmdShow) Line 728	C++
@xezon xezon added the bug label May 13, 2023
@xezon
Copy link
Contributor Author

xezon commented May 13, 2023

I suspect variable names time_left and total_time are supposed to be swapped.

@bobtista
Copy link
Contributor

Agreed. If I'm reading this correctly, there are the following variables:

  • m_whenLastReloadStarted: The time at which the weapon last started reloading
  • next_shot: The time at which the weapon will be ready to fire again
  • time_left: The amount of time that is left before the weapon is ready to fire again
    -- time_left = next_shot - m_whenLastReloadStarted
    -- Should be time_left = next_shot - now
  • total_time: The total amount of time that it takes to reload the weapon.
    -- total_time = next_shot - now;
    -- Should be total_time = next_shot - m_whenLastReloadStarted
    -- I would rename this to reload_duration for readability

The percentage of the weapon that is ready to fire is calculated by dividing time_left by total_time. For example, if time_left is 10 seconds and total_time is 20 seconds, then the weapon is 50% ready to fire.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants