mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Shutdown components
This commit is contained in:
parent
aaea2636c0
commit
e4be3f5241
|
@ -158,6 +158,11 @@ public:
|
|||
* Called to let the components run initialization code.
|
||||
*/
|
||||
virtual void OnInit(){};
|
||||
/**
|
||||
* Called to cleanup the component.
|
||||
* This method is called when the client is closed.
|
||||
*/
|
||||
virtual void OnShutdown(){};
|
||||
/**
|
||||
* Called to reset the component.
|
||||
* This method is usually called on your component constructor to avoid code duplication.
|
||||
|
|
|
@ -618,6 +618,11 @@ void CGhost::OnReset()
|
|||
m_LastRaceTick = -1;
|
||||
}
|
||||
|
||||
void CGhost::OnShutdown()
|
||||
{
|
||||
OnReset();
|
||||
}
|
||||
|
||||
void CGhost::OnMapLoad()
|
||||
{
|
||||
OnReset();
|
||||
|
|
|
@ -155,6 +155,7 @@ public:
|
|||
virtual void OnReset();
|
||||
virtual void OnMessage(int MsgType, void *pRawMsg);
|
||||
virtual void OnMapLoad();
|
||||
virtual void OnShutdown();
|
||||
|
||||
void OnNewSnapshot();
|
||||
void OnNewPredictedSnapshot();
|
||||
|
|
|
@ -2375,6 +2375,11 @@ void CMenus::OnReset()
|
|||
{
|
||||
}
|
||||
|
||||
void CMenus::OnShutdown()
|
||||
{
|
||||
KillServer();
|
||||
}
|
||||
|
||||
bool CMenus::OnMouseMove(float x, float y)
|
||||
{
|
||||
if(!m_MenuActive)
|
||||
|
|
|
@ -528,6 +528,7 @@ public:
|
|||
virtual void OnRender();
|
||||
virtual bool OnInput(IInput::CEvent Event);
|
||||
virtual bool OnMouseMove(float x, float y);
|
||||
virtual void OnShutdown();
|
||||
|
||||
enum
|
||||
{
|
||||
|
|
|
@ -117,6 +117,11 @@ void CRaceDemo::OnReset()
|
|||
StopRecord();
|
||||
}
|
||||
|
||||
void CRaceDemo::OnShutdown()
|
||||
{
|
||||
StopRecord();
|
||||
}
|
||||
|
||||
void CRaceDemo::OnMessage(int MsgType, void *pRawMsg)
|
||||
{
|
||||
// check for messages from server
|
||||
|
|
|
@ -41,6 +41,7 @@ public:
|
|||
virtual void OnStateChange(int NewState, int OldState);
|
||||
virtual void OnMessage(int MsgType, void *pRawMsg);
|
||||
virtual void OnMapLoad();
|
||||
virtual void OnShutdown();
|
||||
|
||||
void OnNewSnapshot();
|
||||
};
|
||||
|
|
|
@ -806,9 +806,8 @@ void CGameClient::OnStateChange(int NewState, int OldState)
|
|||
|
||||
void CGameClient::OnShutdown()
|
||||
{
|
||||
m_Menus.KillServer();
|
||||
m_RaceDemo.OnReset();
|
||||
m_Ghost.OnReset();
|
||||
for(int i = 0; i < m_All.m_Num; i++)
|
||||
m_All.m_paComponents[i]->OnShutdown();
|
||||
}
|
||||
|
||||
void CGameClient::OnEnterGame()
|
||||
|
|
Loading…
Reference in a new issue