feat(core): Ensure that all actions are compared to fixed point in time (#1236) (#1458)

i.e. world update start
This commit is contained in:
Viste(Кирилл)
2019-02-14 21:22:17 +03:00
committed by Francesco Borzì
parent 1b7522ff0e
commit 51b8773528
108 changed files with 933 additions and 509 deletions

View File

@@ -11,6 +11,7 @@
#include "WorldPacket.h"
#include "GameObject.h"
#include "ObjectMgr.h"
#include "GameTime.h"
#include "Vehicle.h"
#include "Transport.h"
#include "WorldSession.h"
@@ -127,7 +128,7 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
{
// Check if creature respawn time is properly saved
RespawnMap::iterator itr = respawnMap.find(catapult->GetGUIDLow());
if (itr == respawnMap.end() || time(NULL) < itr->second)
if (itr == respawnMap.end() || GameTime::GetGameTime() < itr->second)
continue;
catapult->Relocate(BG_IC_DocksVehiclesCatapults[j].GetPositionX(), BG_IC_DocksVehiclesCatapults[j].GetPositionY(), BG_IC_DocksVehiclesCatapults[j].GetPositionZ(), BG_IC_DocksVehiclesCatapults[j].GetOrientation());
@@ -145,7 +146,7 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
{
// Check if creature respawn time is properly saved
RespawnMap::iterator itr = respawnMap.find(glaiveThrower->GetGUIDLow());
if (itr == respawnMap.end() || time(NULL) < itr->second)
if (itr == respawnMap.end() || GameTime::GetGameTime() < itr->second)
continue;
glaiveThrower->Relocate(BG_IC_DocksVehiclesGlaives[j].GetPositionX(), BG_IC_DocksVehiclesGlaives[j].GetPositionY(), BG_IC_DocksVehiclesGlaives[j].GetPositionZ(), BG_IC_DocksVehiclesGlaives[j].GetOrientation());
@@ -174,7 +175,7 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
{
// Check if creature respawn time is properly saved
RespawnMap::iterator itr = respawnMap.find(siege->GetGUIDLow());
if (itr == respawnMap.end() || time(NULL) < itr->second)
if (itr == respawnMap.end() || GameTime::GetGameTime() < itr->second)
continue;
siege->Relocate(BG_IC_WorkshopVehicles[4].GetPositionX(), BG_IC_WorkshopVehicles[4].GetPositionY(), BG_IC_WorkshopVehicles[4].GetPositionZ(), BG_IC_WorkshopVehicles[4].GetOrientation());
@@ -192,7 +193,7 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
{
// Check if creature respawn time is properly saved
RespawnMap::iterator itr = respawnMap.find(demolisher->GetGUIDLow());
if (itr == respawnMap.end() || time(NULL) < itr->second)
if (itr == respawnMap.end() || GameTime::GetGameTime() < itr->second)
continue;
demolisher->Relocate(BG_IC_WorkshopVehicles[u].GetPositionX(), BG_IC_WorkshopVehicles[u].GetPositionY(), BG_IC_WorkshopVehicles[u].GetPositionZ(), BG_IC_WorkshopVehicles[u].GetOrientation());
@@ -520,7 +521,7 @@ void BattlegroundIC::HandleKillUnit(Creature* unit, Player* killer)
// Xinef: Add to respawn list
if (entry == NPC_DEMOLISHER || entry == NPC_SIEGE_ENGINE_H || entry == NPC_SIEGE_ENGINE_A ||
entry == NPC_GLAIVE_THROWER_A || entry == NPC_GLAIVE_THROWER_H || entry == NPC_CATAPULT)
respawnMap[unit->GetGUIDLow()] = time(NULL) + VEHICLE_RESPAWN_TIME;
respawnMap[unit->GetGUIDLow()] = GameTime::GetGameTime() + VEHICLE_RESPAWN_TIME;
}
}
@@ -867,7 +868,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
if (!siegeVehicle->IsVehicleInUse())
Unit::Kill(siegeEngine, siegeEngine);
respawnMap[siegeEngine->GetGUIDLow()] = time(NULL) + VEHICLE_RESPAWN_TIME;
respawnMap[siegeEngine->GetGUIDLow()] = GameTime::GetGameTime() + VEHICLE_RESPAWN_TIME;
}
}