Skip to content

Commit

Permalink
NPCBots: Fix build 2
Browse files Browse the repository at this point in the history
  • Loading branch information
trickerer committed Dec 22, 2023
1 parent 44f6f80 commit 4693ac7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/server/game/Entities/Creature/Creature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4001,7 +4001,7 @@ bool Creature::LoadBotCreatureFromDB(ObjectGuid::LowType spawnId, Map* map, bool
//We should set first home position, because then AI calls home movement
SetHomePosition(*this);

m_deathState = ALIVE;
m_deathState = DeathState::Alive;
m_respawnTime = 0;

uint32 curhealth;
Expand All @@ -4023,7 +4023,7 @@ bool Creature::LoadBotCreatureFromDB(ObjectGuid::LowType spawnId, Map* map, bool
SetPower(POWER_MANA, GetMaxPower(POWER_MANA));
}

SetHealth(m_deathState == ALIVE ? curhealth : 0);
SetHealth(m_deathState == DeathState::Alive ? curhealth : 0);

// checked at creature_template loading
m_defaultMovementType = data ? MovementGeneratorType(data->movementType) : IDLE_MOTION_TYPE;
Expand Down
13 changes: 0 additions & 13 deletions src/server/game/Maps/Map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2788,10 +2788,6 @@ template <>
void Map::AddToActive(Creature* c)
{
AddToActiveHelper(c);
//npcbot
else if (c->IsNPCBot())
EnsureGridLoadedForActiveObject(Cell(Acore::ComputeCellCoord(c->GetPositionX(), c->GetPositionY())), c);
//end npcbot
}

template<>
Expand All @@ -2816,15 +2812,6 @@ template <>
void Map::RemoveFromActive(Creature* c)
{
RemoveFromActiveHelper(c);
//npcbot: prevent crash from accessing deleted creatureData
if (c->IsNPCBot())
c->GetHomePosition().GetPosition(x, y, z);
else
//end npcbot
//npcbot
else if (c->IsNPCBot())
EnsureGridLoaded(Cell(Acore::ComputeCellCoord(c->GetPositionX(), c->GetPositionY())));
//end npcbot
}

template<>
Expand Down
4 changes: 2 additions & 2 deletions src/server/game/OutdoorPvP/OutdoorPvP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,14 +361,14 @@ bool OPvPCapturePoint::Update(uint32 diff)
{
botsCount[team] = 0;

for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr)
for (GuidSet::iterator itr = _activePlayers[team].begin(); itr != _activePlayers[team].end(); ++itr)
{
if (Player* player = ObjectAccessor::FindPlayer(*itr))
botsCount[team] += player->GetNpcBotsCount();
}
}

fact_diff += 0.5f * ((float)botsCount[0] - (float)botsCount[1]) * diff / OUTDOORPVP_OBJECTIVE_UPDATE_INTERVAL;
factDiff += 0.5f * ((float)botsCount[0] - (float)botsCount[1]) * diff / OUTDOORPVP_OBJECTIVE_UPDATE_INTERVAL;
//end npcbot

TeamId ChallengerId = TEAM_NEUTRAL;
Expand Down

0 comments on commit 4693ac7

Please sign in to comment.