Replaced time(NULL) on sGameTime.GetGameTime() this is used for better performance.
Original Timer.h divided into 2 parts. Shared project has no need to know about GameTime Singleton. 2 Identical structures with different types are now replaced with one generic templated structure and 2 typedefs. --HG-- branch : trunk
This commit is contained in:
1 parent
7ea2510980
commit
3fe0bc5254
51 files changed
+352
-364
No files matched your search
@@ -30,6 +30,7 @@
|
||||
#include "GossipDef.h"
|
||||
#include "Player.h"
|
||||
#include "BattleGroundMgr.h"
|
||||
#include "TimeMgr.h"
|
||||
|
||||
INSTANTIATE_SINGLETON_1(GameEventMgr);
|
||||
|
||||
@@ -40,7 +41,7 @@ bool GameEventMgr::CheckOneGameEvent(uint16 entry) const
|
||||
default:
|
||||
case GAMEEVENT_NORMAL:
|
||||
{
|
||||
time_t currenttime = time(NULL);
|
||||
time_t currenttime = sGameTime.GetGameTime();
|
||||
// Get the event information
|
||||
return mGameEvent[entry].start < currenttime
|
||||
&& currenttime < mGameEvent[entry].end
|
||||
@@ -57,7 +58,7 @@ bool GameEventMgr::CheckOneGameEvent(uint16 entry) const
|
||||
// if inactive world event, check the prerequisite events
|
||||
case GAMEEVENT_WORLD_INACTIVE:
|
||||
{
|
||||
time_t currenttime = time(NULL);
|
||||
time_t currenttime = sGameTime.GetGameTime();
|
||||
for (std::set<uint16>::const_iterator itr = mGameEvent[entry].prerequisite_events.begin(); itr != mGameEvent[entry].prerequisite_events.end(); ++itr)
|
||||
{
|
||||
if( (mGameEvent[*itr].state != GAMEEVENT_WORLD_NEXTPHASE && mGameEvent[*itr].state != GAMEEVENT_WORLD_FINISHED) || // if prereq not in nextphase or finished state, then can't start this one
|
||||
@@ -73,7 +74,7 @@ bool GameEventMgr::CheckOneGameEvent(uint16 entry) const
|
||||
|
||||
uint32 GameEventMgr::NextCheck(uint16 entry) const
|
||||
{
|
||||
time_t currenttime = time(NULL);
|
||||
time_t currenttime = sGameTime.GetGameTime();
|
||||
|
||||
// for NEXTPHASE state world events, return the delay to start the next event, so the followup event will be checked correctly
|
||||
if ((mGameEvent[entry].state == GAMEEVENT_WORLD_NEXTPHASE || mGameEvent[entry].state == GAMEEVENT_WORLD_FINISHED) && mGameEvent[entry].nextstart >= currenttime)
|
||||
@@ -128,7 +129,7 @@ bool GameEventMgr::StartEvent( uint16 event_id, bool overwrite )
|
||||
ApplyNewEvent(event_id);
|
||||
if(overwrite)
|
||||
{
|
||||
mGameEvent[event_id].start = time(NULL);
|
||||
mGameEvent[event_id].start = sGameTime.GetGameTime();
|
||||
if(mGameEvent[event_id].end <= mGameEvent[event_id].start)
|
||||
mGameEvent[event_id].end = mGameEvent[event_id].start+mGameEvent[event_id].length;
|
||||
}
|
||||
@@ -168,7 +169,7 @@ void GameEventMgr::StopEvent( uint16 event_id, bool overwrite )
|
||||
|
||||
if(overwrite && !serverwide_evt)
|
||||
{
|
||||
mGameEvent[event_id].start = time(NULL) - mGameEvent[event_id].length * MINUTE;
|
||||
mGameEvent[event_id].start = sGameTime.GetGameTime() - mGameEvent[event_id].length * MINUTE;
|
||||
if(mGameEvent[event_id].end <= mGameEvent[event_id].start)
|
||||
mGameEvent[event_id].end = mGameEvent[event_id].start+mGameEvent[event_id].length;
|
||||
}
|
||||
@@ -1045,7 +1046,7 @@ uint32 GameEventMgr::Initialize() // return the next e
|
||||
|
||||
uint32 GameEventMgr::Update() // return the next event delay in ms
|
||||
{
|
||||
time_t currenttime = time(NULL);
|
||||
time_t currenttime = sGameTime.GetGameTime();
|
||||
uint32 nextEventDelay = max_ge_check_delay; // 1 day
|
||||
uint32 calcDelay;
|
||||
std::set<uint16> activate, deactivate;
|
||||
@@ -1598,7 +1599,7 @@ bool GameEventMgr::CheckOneGameEventConditions(uint16 event_id)
|
||||
// set the followup events' start time
|
||||
if(!mGameEvent[event_id].nextstart)
|
||||
{
|
||||
time_t currenttime = time(NULL);
|
||||
time_t currenttime = sGameTime.GetGameTime();
|
||||
mGameEvent[event_id].nextstart = currenttime + mGameEvent[event_id].length * 60;
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in new issue
Block a user