Fixed amb1358 - Timeleft not reseting on TF2 restarts
authorMatt Woodrow <pred@alliedmods.net>
Sun May 25 02:07:52 2008 +0000 (2008-05-25)
changeset 2075ffc871fb7cc8
parent 2074 579518b63606
child 2076 c6bd617bf370
Fixed amb1358 - Timeleft not reseting on TF2 restarts
extensions/tf2/extension.cpp
extensions/tf2/extension.h
extensions/tf2/sdk/smsdk_config.h
     1.1 --- a/extensions/tf2/extension.cpp	Sat May 24 09:57:40 2008 +0000
     1.2 +++ b/extensions/tf2/extension.cpp	Sun May 25 02:07:52 2008 +0000
     1.3 @@ -120,6 +120,9 @@
     1.4  
     1.5  	GET_V_IFACE_CURRENT(GetServerFactory, gameents, IServerGameEnts, INTERFACEVERSION_SERVERGAMEENTS);
     1.6  
     1.7 +	GET_V_IFACE_CURRENT(GetEngineFactory, m_GameEventManager, IGameEventManager2, INTERFACEVERSION_GAMEEVENTSMANAGER2);
     1.8 +	m_GameEventManager->AddListener(this, "teamplay_restart_round", true);
     1.9 +
    1.10  	return true;
    1.11  }
    1.12  
    1.13 @@ -144,6 +147,11 @@
    1.14  	return g_SMAPI->RegisterConCommandBase(g_PLAPI, pVar);
    1.15  }
    1.16  
    1.17 +void TF2Tools::FireGameEvent( IGameEvent *event )
    1.18 +{
    1.19 +	timersys->NotifyOfGameStart();
    1.20 +	timersys->MapTimeLeftChanged();
    1.21 +}
    1.22  
    1.23  bool TF2Tools::QueryRunning(char *error, size_t maxlength)
    1.24  {
     2.1 --- a/extensions/tf2/extension.h	Sat May 24 09:57:40 2008 +0000
     2.2 +++ b/extensions/tf2/extension.h	Sun May 25 02:07:52 2008 +0000
     2.3 @@ -40,6 +40,7 @@
     2.4  #include "smsdk_ext.h"
     2.5  #include <IBinTools.h>
     2.6  #include <server_class.h>
     2.7 +#include <igameevents.h>
     2.8  
     2.9  /**
    2.10   * @brief Sample implementation of the SDK Extension.
    2.11 @@ -48,7 +49,8 @@
    2.12  class TF2Tools : 
    2.13  	public SDKExtension,
    2.14  	public ICommandTargetProcessor,
    2.15 -	public IConCommandBaseAccessor
    2.16 +	public IConCommandBaseAccessor,
    2.17 +	public IGameEventListener2
    2.18  {
    2.19  public:
    2.20  	/**
    2.21 @@ -91,6 +93,9 @@
    2.22  public:
    2.23  	bool ProcessCommandTarget(cmd_target_info_t *info);
    2.24  	bool RegisterConCommandBase(ConCommandBase *pVar);
    2.25 +
    2.26 +	IGameEventManager2 *m_GameEventManager;
    2.27 +	void FireGameEvent( IGameEvent *event );
    2.28  public:
    2.29  #if defined SMEXT_CONF_METAMOD
    2.30  	/**
     3.1 --- a/extensions/tf2/sdk/smsdk_config.h	Sat May 24 09:57:40 2008 +0000
     3.2 +++ b/extensions/tf2/sdk/smsdk_config.h	Sun May 25 02:07:52 2008 +0000
     3.3 @@ -68,7 +68,7 @@
     3.4  #define SMEXT_ENABLE_GAMECONF
     3.5  //#define SMEXT_ENABLE_MEMUTILS
     3.6  #define SMEXT_ENABLE_GAMEHELPERS
     3.7 -//#define SMEXT_ENABLE_TIMERSYS
     3.8 +#define SMEXT_ENABLE_TIMERSYS
     3.9  //#define SMEXT_ENABLE_THREADER
    3.10  //#define SMEXT_ENABLE_LIBSYS
    3.11  //#define SMEXT_ENABLE_USERMSGS