refactor(Core/Misc): remove the ternary operator when used improperly (#3327)

This commit is contained in:
Stefano Borzì
2020-09-10 12:29:23 +02:00
committed by GitHub
parent 207512a0f5
commit 51330f54d8
19 changed files with 67 additions and 67 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ class Field
bool GetBool() const // Wrapper, actually gets integer bool GetBool() const // Wrapper, actually gets integer
{ {
return GetUInt8() == 1 ? true : false; return (GetUInt8() == 1);
} }
uint8 GetUInt8() const uint8 GetUInt8() const
+1 -1
View File
@@ -177,7 +177,7 @@ class ByteBuffer
ByteBuffer &operator>>(bool &value) ByteBuffer &operator>>(bool &value)
{ {
value = read<char>() > 0 ? true : false; value = (read<char>() > 0);
return *this; return *this;
} }
@@ -853,7 +853,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
// Activate // Activate
// xinef: wtf is this shit? // xinef: wtf is this shit?
(*itr)->ToGameObject()->SetLootState(GO_READY); (*itr)->ToGameObject()->SetLootState(GO_READY);
(*itr)->ToGameObject()->UseDoorOrButton(0, e.action.activateObject.alternative ? true : false, unit); (*itr)->ToGameObject()->UseDoorOrButton(0, !!e.action.activateObject.alternative, unit);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_ACTIVATE_GOBJECT. Gameobject %u (entry: %u) activated", sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_ACTIVATE_GOBJECT. Gameobject %u (entry: %u) activated",
(*itr)->GetGUIDLow(), (*itr)->GetEntry()); (*itr)->GetGUIDLow(), (*itr)->GetEntry());
@@ -1507,7 +1507,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
if (IsUnit(*itr)) if (IsUnit(*itr))
(*itr)->ToUnit()->SetVisible(e.action.visibility.state ? true : false); (*itr)->ToUnit()->SetVisible(!!e.action.visibility.state);
delete targets; delete targets;
break; break;
@@ -1519,7 +1519,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
break; break;
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
(*itr)->setActive(e.action.setActive.state ? true : false); (*itr)->setActive(!!e.action.setActive.state);
delete targets; delete targets;
break; break;
+1 -1
View File
@@ -240,7 +240,7 @@ namespace AccountMgr
stmt->setString(1, CalculateShaPassHash(username, password)); stmt->setString(1, CalculateShaPassHash(username, password));
PreparedQueryResult result = LoginDatabase.Query(stmt); PreparedQueryResult result = LoginDatabase.Query(stmt);
return (result) ? true : false; return !!result;
} }
uint32 GetCharactersCount(uint32 accountId) uint32 GetCharactersCount(uint32 accountId)
@@ -443,7 +443,7 @@ void AuctionHouseObject::AddAuction(AuctionEntry* auction)
bool AuctionHouseObject::RemoveAuction(AuctionEntry* auction) bool AuctionHouseObject::RemoveAuction(AuctionEntry* auction)
{ {
bool wasInMap = AuctionsMap.erase(auction->Id) ? true : false; bool wasInMap = !!AuctionsMap.erase(auction->Id);
sScriptMgr->OnAuctionRemove(this, auction); sScriptMgr->OnAuctionRemove(this, auction);
@@ -381,7 +381,7 @@ void BattlegroundIC::FillInitialWorldStates(WorldPacket& data)
for (uint8 i = 0; i < MAX_FORTRESS_GATES_SPAWNS; ++i) for (uint8 i = 0; i < MAX_FORTRESS_GATES_SPAWNS; ++i)
{ {
uint32 uws = GetWorldStateFromGateEntry(BG_IC_ObjSpawnlocs[i].entry, (GateStatus[GetGateIDFromEntry(BG_IC_ObjSpawnlocs[i].entry)] == BG_IC_GATE_DESTROYED ? true : false)); uint32 uws = GetWorldStateFromGateEntry(BG_IC_ObjSpawnlocs[i].entry, (GateStatus[GetGateIDFromEntry(BG_IC_ObjSpawnlocs[i].entry)] == BG_IC_GATE_DESTROYED));
data << uint32(uws) << uint32(1); data << uint32(uws) << uint32(1);
} }
@@ -515,9 +515,9 @@ void BattlegroundIC::HandleKillUnit(Creature* unit, Player* killer)
if (unit->IsVehicle()) if (unit->IsVehicle())
{ {
killer->CastSpell(killer, SPELL_DESTROYED_VEHICLE_ACHIEVEMENT, true); killer->CastSpell(killer, SPELL_DESTROYED_VEHICLE_ACHIEVEMENT, true);
// Xinef: Add to respawn list // Xinef: Add to respawn list
if (entry == NPC_DEMOLISHER || entry == NPC_SIEGE_ENGINE_H || entry == NPC_SIEGE_ENGINE_A || 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) entry == NPC_GLAIVE_THROWER_A || entry == NPC_GLAIVE_THROWER_H || entry == NPC_CATAPULT)
respawnMap[unit->GetGUIDLow()] = time(nullptr) + VEHICLE_RESPAWN_TIME; respawnMap[unit->GetGUIDLow()] = time(nullptr) + VEHICLE_RESPAWN_TIME;
} }
@@ -562,15 +562,15 @@ void BattlegroundIC::EventPlayerClickedOnFlag(Player* player, GameObject* gameOb
// Prevent capturing of keep if none of gates was destroyed // Prevent capturing of keep if none of gates was destroyed
if (nodePoint[i].gameobject_entry == GO_ALLIANCE_BANNER) if (nodePoint[i].gameobject_entry == GO_ALLIANCE_BANNER)
{ {
if (GateStatus[BG_IC_A_FRONT] != BG_IC_GATE_DESTROYED && if (GateStatus[BG_IC_A_FRONT] != BG_IC_GATE_DESTROYED &&
GateStatus[BG_IC_A_WEST] != BG_IC_GATE_DESTROYED && GateStatus[BG_IC_A_WEST] != BG_IC_GATE_DESTROYED &&
GateStatus[BG_IC_A_EAST] != BG_IC_GATE_DESTROYED) GateStatus[BG_IC_A_EAST] != BG_IC_GATE_DESTROYED)
return; return;
} }
else if (nodePoint[i].gameobject_entry == GO_HORDE_BANNER) else if (nodePoint[i].gameobject_entry == GO_HORDE_BANNER)
{ {
if (GateStatus[BG_IC_H_FRONT] != BG_IC_GATE_DESTROYED && if (GateStatus[BG_IC_H_FRONT] != BG_IC_GATE_DESTROYED &&
GateStatus[BG_IC_H_WEST] != BG_IC_GATE_DESTROYED && GateStatus[BG_IC_H_WEST] != BG_IC_GATE_DESTROYED &&
GateStatus[BG_IC_H_EAST] != BG_IC_GATE_DESTROYED) GateStatus[BG_IC_H_EAST] != BG_IC_GATE_DESTROYED)
return; return;
} }
+3 -3
View File
@@ -49,7 +49,7 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo)
{ {
// don't allow 0 items (it's checked during table load) // don't allow 0 items (it's checked during table load)
ASSERT(ConditionValue2); ASSERT(ConditionValue2);
bool checkBank = ConditionValue3 ? true : false; bool checkBank = !!ConditionValue3;
condMeets = player->HasItemCount(ConditionValue1, ConditionValue2, checkBank); condMeets = player->HasItemCount(ConditionValue1, ConditionValue2, checkBank);
} }
break; break;
@@ -207,12 +207,12 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo)
} }
case CONDITION_NEAR_CREATURE: case CONDITION_NEAR_CREATURE:
{ {
condMeets = GetClosestCreatureWithEntry(object, ConditionValue1, (float)ConditionValue2, !ConditionValue3) ? true : false; condMeets = !!GetClosestCreatureWithEntry(object, ConditionValue1, (float)ConditionValue2, !ConditionValue3);
break; break;
} }
case CONDITION_NEAR_GAMEOBJECT: case CONDITION_NEAR_GAMEOBJECT:
{ {
condMeets = GetClosestGameObjectWithEntry(object, ConditionValue1, (float)ConditionValue2) ? true : false; condMeets = !!GetClosestGameObjectWithEntry(object, ConditionValue1, (float)ConditionValue2);
break; break;
} }
case CONDITION_OBJECT_ENTRY_GUID: case CONDITION_OBJECT_ENTRY_GUID:
+3 -3
View File
@@ -22585,13 +22585,13 @@ bool Player::EnchantmentFitsRequirements(uint32 enchantmentcondition, int8 slot)
switch (Condition->Comparator[i]) switch (Condition->Comparator[i])
{ {
case 2: // requires less <color> than (<value> || <comparecolor>) gems case 2: // requires less <color> than (<value> || <comparecolor>) gems
activate &= (_cur_gem < _cmp_gem) ? true : false; activate &= (_cur_gem < _cmp_gem);
break; break;
case 3: // requires more <color> than (<value> || <comparecolor>) gems case 3: // requires more <color> than (<value> || <comparecolor>) gems
activate &= (_cur_gem > _cmp_gem) ? true : false; activate &= (_cur_gem > _cmp_gem);
break; break;
case 5: // requires at least <color> than (<value> || <comparecolor>) gems case 5: // requires at least <color> than (<value> || <comparecolor>) gems
activate &= (_cur_gem >= _cmp_gem) ? true : false; activate &= (_cur_gem >= _cmp_gem);
break; break;
} }
} }
+2 -2
View File
@@ -1704,7 +1704,7 @@ class Player : public Unit, public GridObject<Player>
bool RemoveMItem(uint32 id) bool RemoveMItem(uint32 id)
{ {
return mMitems.erase(id) ? true : false; return !!mMitems.erase(id);
} }
void PetSpellInitialize(); void PetSpellInitialize();
@@ -2539,7 +2539,7 @@ class Player : public Unit, public GridObject<Player>
void SetLastUsedRune(RuneType type) { m_runes->lastUsedRune = type; } void SetLastUsedRune(RuneType type) { m_runes->lastUsedRune = type; }
void SetBaseRune(uint8 index, RuneType baseRune) { m_runes->runes[index].BaseRune = baseRune; } void SetBaseRune(uint8 index, RuneType baseRune) { m_runes->runes[index].BaseRune = baseRune; }
void SetCurrentRune(uint8 index, RuneType currentRune) { m_runes->runes[index].CurrentRune = currentRune; } void SetCurrentRune(uint8 index, RuneType currentRune) { m_runes->runes[index].CurrentRune = currentRune; }
void SetRuneCooldown(uint8 index, uint32 cooldown) { m_runes->runes[index].Cooldown = cooldown; m_runes->SetRuneState(index, (cooldown == 0) ? true : false); } void SetRuneCooldown(uint8 index, uint32 cooldown) { m_runes->runes[index].Cooldown = cooldown; m_runes->SetRuneState(index, (cooldown == 0)); }
void SetGracePeriod(uint8 index, uint32 period) { m_runes->runes[index].GracePeriod = period; } void SetGracePeriod(uint8 index, uint32 period) { m_runes->runes[index].GracePeriod = period; }
void SetRuneConvertAura(uint8 index, AuraEffect const* aura) { m_runes->runes[index].ConvertAura = aura; } void SetRuneConvertAura(uint8 index, AuraEffect const* aura) { m_runes->runes[index].ConvertAura = aura; }
void AddRuneByAuraEffect(uint8 index, RuneType newType, AuraEffect const* aura) { SetRuneConvertAura(index, aura); ConvertRune(index, newType); } void AddRuneByAuraEffect(uint8 index, RuneType newType, AuraEffect const* aura) { SetRuneConvertAura(index, aura); ConvertRune(index, newType); }
+3 -3
View File
@@ -121,13 +121,13 @@ void InstanceScript::UpdateDoorState(GameObject* door)
switch (info.type) switch (info.type)
{ {
case DOOR_TYPE_ROOM: case DOOR_TYPE_ROOM:
open &= (info.bossInfo->state != IN_PROGRESS) ? true : false; open &= (info.bossInfo->state != IN_PROGRESS);
break; break;
case DOOR_TYPE_PASSAGE: case DOOR_TYPE_PASSAGE:
open &= (info.bossInfo->state == DONE) ? true : false; open &= (info.bossInfo->state == DONE);
break; break;
case DOOR_TYPE_SPAWN_HOLE: case DOOR_TYPE_SPAWN_HOLE:
open &= (info.bossInfo->state == IN_PROGRESS) ? true : false; open &= (info.bossInfo->state == IN_PROGRESS);
break; break;
default: default:
break; break;
+1 -1
View File
@@ -318,7 +318,7 @@ bool MapManager::IsValidMAP(uint32 mapid, bool startUp)
MapEntry const* mEntry = sMapStore.LookupEntry(mapid); MapEntry const* mEntry = sMapStore.LookupEntry(mapid);
if (startUp) if (startUp)
return mEntry ? true : false; return !!mEntry;
else else
return mEntry && (!mEntry->IsDungeon() || sObjectMgr->GetInstanceTemplate(mapid)); return mEntry && (!mEntry->IsDungeon() || sObjectMgr->GetInstanceTemplate(mapid));
@@ -556,7 +556,7 @@ struct boss_jormungarAI : public ScriptedAI
break; break;
case EVENT_SUBMERGE: case EVENT_SUBMERGE:
{ {
bIsStationary = me->GetDisplayId() == _MODEL_STATIONARY ? true : false; bIsStationary = (me->GetDisplayId() == _MODEL_STATIONARY);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
me->CastSpell(me, SPELL_SUBMERGE_0, false); me->CastSpell(me, SPELL_SUBMERGE_0, false);
Talk(EMOTE_SUBMERGE); Talk(EMOTE_SUBMERGE);
@@ -934,7 +934,7 @@ public:
destZ = Locs[LOC_CENTER].GetPositionZ()+1.0f; destZ = Locs[LOC_CENTER].GetPositionZ()+1.0f;
me->StopMoving(); me->StopMoving();
me->GetMotionMaster()->MoveJump(Locs[LOC_CENTER].GetPositionX()+cos(jumpangle)*35.0f, Locs[LOC_CENTER].GetPositionY()+sin(jumpangle)*35.0f, Locs[LOC_CENTER].GetPositionZ()+1.0f, 40.0f, 12.0f); me->GetMotionMaster()->MoveJump(Locs[LOC_CENTER].GetPositionX()+cos(jumpangle)*35.0f, Locs[LOC_CENTER].GetPositionY()+sin(jumpangle)*35.0f, Locs[LOC_CENTER].GetPositionZ()+1.0f, 40.0f, 12.0f);
events.PopEvent(); events.PopEvent();
events.RescheduleEvent(EVENT_TRAMPLE, 1500); events.RescheduleEvent(EVENT_TRAMPLE, 1500);
@@ -1434,7 +1434,7 @@ public:
if( DoNeedCleanup(true) ) if( DoNeedCleanup(true) )
InstanceCleanup(); InstanceCleanup();
// if missing spawn anub'arak // if missing spawn anub'arak
SpawnAnubArak(); SpawnAnubArak();
events.RescheduleEvent(EVENT_CHECK_PLAYERS, CLEANUP_CHECK_INTERVAL); events.RescheduleEvent(EVENT_CHECK_PLAYERS, CLEANUP_CHECK_INTERVAL);
@@ -1647,8 +1647,8 @@ public:
uint32 data1 = 0, data2 = 0, data3 = 0; uint32 data1 = 0, data2 = 0, data3 = 0;
loadStream >> data1 >> data2 >> data3; loadStream >> data1 >> data2 >> data3;
AttemptsLeft = data1; AttemptsLeft = data1;
bDedicatedInsanity = data2 ? true : false; bDedicatedInsanity = !!data2;
bNooneDied = data3 ? true : false; bNooneDied = !!data3;
} }
} }
else else
@@ -759,7 +759,7 @@ public:
if (unit->GetEntry() == NPC_WAVE_MERCENARY || unit->GetEntry() == NPC_WAVE_FOOTMAN || unit->GetEntry() == NPC_WAVE_RIFLEMAN || unit->GetEntry() == NPC_WAVE_PRIEST || unit->GetEntry() == NPC_WAVE_MAGE) if (unit->GetEntry() == NPC_WAVE_MERCENARY || unit->GetEntry() == NPC_WAVE_FOOTMAN || unit->GetEntry() == NPC_WAVE_RIFLEMAN || unit->GetEntry() == NPC_WAVE_PRIEST || unit->GetEntry() == NPC_WAVE_MAGE)
if ((--reqKillCount) == 0 && WaveNumber%5 && NextWaveTimer > 5000) if ((--reqKillCount) == 0 && WaveNumber%5 && NextWaveTimer > 5000)
NextWaveTimer = 5000; NextWaveTimer = 5000;
if (unit->GetEntry() == NPC_QUEL_DELAR) if (unit->GetEntry() == NPC_QUEL_DELAR)
if (Creature* c = instance->GetCreature(NPC_UtherGUID)) if (Creature* c = instance->GetCreature(NPC_UtherGUID))
{ {
@@ -812,7 +812,7 @@ public:
for (uint8 i=0; i<num_to_activate; ++i) for (uint8 i=0; i<num_to_activate; ++i)
{ {
uint32 entry = chosenComposition[WaveNumber][i]; uint32 entry = chosenComposition[WaveNumber][i];
bool forward = urand(0,1) ? true : false; bool forward = !!urand(0,1);
for (int8 j = (forward ? 0 : NUM_OF_TRASH-1); (forward ? j<NUM_OF_TRASH : j>=0); (forward ? ++j : --j)) for (int8 j = (forward ? 0 : NUM_OF_TRASH-1); (forward ? j<NUM_OF_TRASH : j>=0); (forward ? ++j : --j))
if (!TrashActive[j]) if (!TrashActive[j])
if (Creature* c = instance->GetCreature(NPC_TrashGUID[j])) if (Creature* c = instance->GetCreature(NPC_TrashGUID[j]))
@@ -892,7 +892,7 @@ public:
for (uint8 i=0; i<num_to_activate; ++i) for (uint8 i=0; i<num_to_activate; ++i)
{ {
uint32 entry = chosenComposition[WaveNumber-(WaveNumber > 5 ? 2 : 1)][i]; uint32 entry = chosenComposition[WaveNumber-(WaveNumber > 5 ? 2 : 1)][i];
bool forward = urand(0,1) ? true : false; bool forward = !!urand(0,1);
for (int8 j = (forward ? 0 : NUM_OF_TRASH-1); (forward ? j<NUM_OF_TRASH : j>=0); (forward ? ++j : --j)) for (int8 j = (forward ? 0 : NUM_OF_TRASH-1); (forward ? j<NUM_OF_TRASH : j>=0); (forward ? ++j : --j))
if (!TrashActive[j]) if (!TrashActive[j])
if (Creature* c = instance->GetCreature(NPC_TrashGUID[j])) if (Creature* c = instance->GetCreature(NPC_TrashGUID[j]))
@@ -978,7 +978,7 @@ public:
} }
else if (!ResumeFirstEventTimer) else if (!ResumeFirstEventTimer)
{ {
bool allInRangeAndAlive = (instance->GetPlayersCountExceptGMs() > 0 ? true : false); bool allInRangeAndAlive = (instance->GetPlayersCountExceptGMs() > 0);
for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr)
if (Player* p = itr->GetSource()) if (Player* p = itr->GetSource())
if (!p->IsGameMaster() && (p->GetExactDist2d(&CenterPos) > MAX_DIST_FROM_CENTER_TO_START || !p->IsAlive())) if (!p->IsGameMaster() && (p->GetExactDist2d(&CenterPos) > MAX_DIST_FROM_CENTER_TO_START || !p->IsAlive()))
@@ -1043,7 +1043,7 @@ class instance_icecrown_citadel : public InstanceMapScript
if (theLichKing->IsAlive()) if (theLichKing->IsAlive())
theLichKing->SetVisible(false); theLichKing->SetVisible(false);
} }
void RemoveBackPack() void RemoveBackPack()
{ {
for (auto const& itr : instance->GetPlayers()) for (auto const& itr : instance->GetPlayers())
@@ -1208,7 +1208,7 @@ class instance_icecrown_citadel : public InstanceMapScript
return true; return true;
} }
void SpawnGunship() void SpawnGunship()
{ {
if (!GunshipGUID && instance->HavePlayers()) if (!GunshipGUID && instance->HavePlayers())
@@ -1228,7 +1228,7 @@ class instance_icecrown_citadel : public InstanceMapScript
switch (type) switch (type)
{ {
case DATA_BUFF_AVAILABLE: case DATA_BUFF_AVAILABLE:
IsBuffAvailable = (data ? true : false); IsBuffAvailable = !!data;
if (!IsBuffAvailable) if (!IsBuffAvailable)
{ {
Map::PlayerList const& plrList = instance->GetPlayers(); Map::PlayerList const& plrList = instance->GetPlayers();
@@ -1310,16 +1310,16 @@ class instance_icecrown_citadel : public InstanceMapScript
} }
return; return;
case DATA_BONED_ACHIEVEMENT: case DATA_BONED_ACHIEVEMENT:
IsBonedEligible = data ? true : false; IsBonedEligible = !!data;
break; break;
case DATA_OOZE_DANCE_ACHIEVEMENT: case DATA_OOZE_DANCE_ACHIEVEMENT:
IsOozeDanceEligible = data ? true : false; IsOozeDanceEligible = !!data;
break; break;
case DATA_NAUSEA_ACHIEVEMENT: case DATA_NAUSEA_ACHIEVEMENT:
IsNauseaEligible = data ? true : false; IsNauseaEligible = !!data;
break; break;
case DATA_ORB_WHISPERER_ACHIEVEMENT: case DATA_ORB_WHISPERER_ACHIEVEMENT:
IsOrbWhispererEligible = data ? true : false; IsOrbWhispererEligible = !!data;
break; break;
case DATA_SINDRAGOSA_FROSTWYRMS: case DATA_SINDRAGOSA_FROSTWYRMS:
FrostwyrmGUIDs.insert(data); FrostwyrmGUIDs.insert(data);
@@ -1576,7 +1576,7 @@ class instance_icecrown_citadel : public InstanceMapScript
std::ostringstream saveStream; std::ostringstream saveStream;
saveStream << "I C " << GetBossSaveData() << HeroicAttempts << ' ' saveStream << "I C " << GetBossSaveData() << HeroicAttempts << ' '
<< ColdflameJetsState << ' ' << BloodQuickeningState << ' ' << BloodQuickeningMinutes << ' ' << WeeklyQuestId10 << ' ' << PutricideEventProgress << ' ' << ColdflameJetsState << ' ' << BloodQuickeningState << ' ' << BloodQuickeningMinutes << ' ' << WeeklyQuestId10 << ' ' << PutricideEventProgress << ' '
<< uint32(LichKingHeroicAvailable ? 1 : 0) << ' ' << BloodPrinceTrashCount << ' ' << uint32(IsBuffAvailable ? 1 : 0); << uint32(LichKingHeroicAvailable ? 1 : 0) << ' ' << BloodPrinceTrashCount << ' ' << uint32(IsBuffAvailable ? 1 : 0);
@@ -1628,10 +1628,10 @@ class instance_icecrown_citadel : public InstanceMapScript
loadStream >> WeeklyQuestId10; loadStream >> WeeklyQuestId10;
loadStream >> PutricideEventProgress; PutricideEventProgress &= ~PUTRICIDE_EVENT_FLAG_TRAP_INPROGRESS; loadStream >> PutricideEventProgress; PutricideEventProgress &= ~PUTRICIDE_EVENT_FLAG_TRAP_INPROGRESS;
loadStream >> temp; loadStream >> temp;
LichKingHeroicAvailable = temp ? true : false; LichKingHeroicAvailable = !!temp;
loadStream >> BloodPrinceTrashCount; loadStream >> BloodPrinceTrashCount;
loadStream >> temp; loadStream >> temp;
SetData(DATA_BUFF_AVAILABLE, temp ? true : false); SetData(DATA_BUFF_AVAILABLE, !!temp);
} }
else else
OUT_LOAD_INST_DATA_FAIL; OUT_LOAD_INST_DATA_FAIL;
@@ -36,7 +36,7 @@ public:
bool bAmberVoid; bool bAmberVoid;
bool bEmeraldVoid; bool bEmeraldVoid;
bool bRubyVoid; bool bRubyVoid;
void Initialize() void Initialize()
{ {
EregosCacheGUID = 0; EregosCacheGUID = 0;
@@ -52,7 +52,7 @@ public:
memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
memset(&DragonCageDoorGUID, 0, sizeof(DragonCageDoorGUID)); memset(&DragonCageDoorGUID, 0, sizeof(DragonCageDoorGUID));
} }
void OnCreatureCreate(Creature* pCreature) void OnCreatureCreate(Creature* pCreature)
{ {
switch( pCreature->GetEntry() ) switch( pCreature->GetEntry() )
@@ -118,7 +118,7 @@ public:
if (unit->GetEntry() == NPC_CENTRIFUGE_CONSTRUCT) if (unit->GetEntry() == NPC_CENTRIFUGE_CONSTRUCT)
SetData(DATA_CC_COUNT, DONE); SetData(DATA_CC_COUNT, DONE);
} }
void SetData(uint32 type, uint32 data) void SetData(uint32 type, uint32 data)
{ {
switch( type ) switch( type )
@@ -170,20 +170,20 @@ public:
} }
break; break;
case DATA_AMBER_VOID: case DATA_AMBER_VOID:
bAmberVoid = data ? true : false; bAmberVoid = !!data;
break; break;
case DATA_EMERALD_VOID: case DATA_EMERALD_VOID:
bEmeraldVoid = data ? true : false; bEmeraldVoid = !!data;
break; break;
case DATA_RUBY_VOID: case DATA_RUBY_VOID:
bRubyVoid = data ? true : false; bRubyVoid = !!data;
break; break;
} }
if( data == DONE ) if( data == DONE )
SaveToDB(); SaveToDB();
} }
uint32 GetData(uint32 type) const uint32 GetData(uint32 type) const
{ {
switch( type ) switch( type )
@@ -199,7 +199,7 @@ public:
return 0; return 0;
} }
uint64 GetData64(uint32 identifier) const uint64 GetData64(uint32 identifier) const
{ {
switch( identifier ) switch( identifier )
@@ -221,7 +221,7 @@ public:
return 0; return 0;
} }
std::string GetSaveData() std::string GetSaveData()
{ {
OUT_SAVE_INST_DATA; OUT_SAVE_INST_DATA;
@@ -209,7 +209,7 @@ public:
counter = 0; counter = 0;
bShattered = false; bShattered = false;
lastShatterMSTime = 0; lastShatterMSTime = 0;
if( InstanceScript* m_pInstance = me->GetInstanceScript() ) if( InstanceScript* m_pInstance = me->GetInstanceScript() )
{ {
m_pInstance->SetData(TYPE_IGNIS, NOT_STARTED); m_pInstance->SetData(TYPE_IGNIS, NOT_STARTED);
@@ -555,7 +555,7 @@ class achievement_ignis_shattered : public AchievementCriteriaScript
{ {
if (!target || target->GetTypeId() != TYPEID_UNIT) if (!target || target->GetTypeId() != TYPEID_UNIT)
return false; return false;
return (target->ToCreature()->AI()->GetData(1337) ? true : false); return !!target->ToCreature()->AI()->GetData(1337);
} }
}; };
@@ -567,4 +567,4 @@ void AddSC_boss_ignis()
new spell_ignis_grab_initial(); new spell_ignis_grab_initial();
new spell_ignis_slag_pot(); new spell_ignis_slag_pot();
new achievement_ignis_shattered(); new achievement_ignis_shattered();
} }
@@ -91,15 +91,15 @@ public:
uint64 m_algalonTrapdoorGUID; uint64 m_algalonTrapdoorGUID;
uint64 m_brannBronzebeardAlgGUID; uint64 m_brannBronzebeardAlgGUID;
uint32 m_algalonTimer; uint32 m_algalonTimer;
// Shared // Shared
EventMap _events; EventMap _events;
bool m_mimironTramUsed; bool m_mimironTramUsed;
uint64 m_mimironTramGUID; uint64 m_mimironTramGUID;
uint64 m_keepersgateGUID; uint64 m_keepersgateGUID;
uint64 m_keepersGossipGUID[4]; uint64 m_keepersGossipGUID[4];
void Initialize() void Initialize()
{ {
// Bosses // Bosses
@@ -165,7 +165,7 @@ public:
m_algalonTrapdoorGUID = 0; m_algalonTrapdoorGUID = 0;
m_brannBronzebeardAlgGUID = 0; m_brannBronzebeardAlgGUID = 0;
m_algalonTimer = 0; m_algalonTimer = 0;
// Shared // Shared
_events.Reset(); _events.Reset();
memset(&m_keepersGossipGUID, 0, sizeof(m_keepersGossipGUID)); memset(&m_keepersGossipGUID, 0, sizeof(m_keepersGossipGUID));
@@ -380,7 +380,7 @@ public:
} }
bool on = (GetData(type) == DONE && !(GetData(TYPE_WATCHERS) & (1 << (type-TYPE_FREYA)))); bool on = (GetData(type) == DONE && !(GetData(TYPE_WATCHERS) & (1 << (type-TYPE_FREYA))));
cr->SetVisible(on ? true : false); cr->SetVisible(on);
} }
void OnGameObjectCreate(GameObject* gameObject) void OnGameObjectCreate(GameObject* gameObject)
@@ -710,7 +710,7 @@ public:
freya->GetGameObjectListWithEntryInGrid(goList, 190171 /*Lichbloom*/, 333.0f); freya->GetGameObjectListWithEntryInGrid(goList, 190171 /*Lichbloom*/, 333.0f);
freya->GetGameObjectListWithEntryInGrid(goList, 190170 /*Talandra's Rose*/, 333.0f); freya->GetGameObjectListWithEntryInGrid(goList, 190170 /*Talandra's Rose*/, 333.0f);
freya->GetGameObjectListWithEntryInGrid(goList, 189973 /*Goldclover*/, 333.0f); freya->GetGameObjectListWithEntryInGrid(goList, 189973 /*Goldclover*/, 333.0f);
for (std::list<GameObject*>::const_iterator itr = goList.begin(); itr != goList.end(); ++itr) for (std::list<GameObject*>::const_iterator itr = goList.begin(); itr != goList.end(); ++itr)
(*itr)->SetRespawnTime(7*DAY); (*itr)->SetRespawnTime(7*DAY);
} }
@@ -961,7 +961,7 @@ public:
for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
{ {
loadStream >> m_auiEncounter[i]; loadStream >> m_auiEncounter[i];
if (m_auiEncounter[i] == IN_PROGRESS && i != TYPE_WATCHERS) if (m_auiEncounter[i] == IN_PROGRESS && i != TYPE_WATCHERS)
m_auiEncounter[i] = NOT_STARTED; m_auiEncounter[i] = NOT_STARTED;
} }
@@ -1070,7 +1070,7 @@ public:
}; };
}; };
const Position vehiclePositions[30] = const Position vehiclePositions[30] =
{ {
// Start Positions // Start Positions
// Siege // Siege
@@ -275,7 +275,7 @@ public:
InstanceCleanup(); InstanceCleanup();
break; break;
case DATA_ACHIEV: case DATA_ACHIEV:
bAchiev = data ? true : false; bAchiev = !!data;
break; break;
} }
} }
@@ -596,7 +596,7 @@ public:
// open main gate // open main gate
HandleGameObject(GO_MainGateGUID, true); HandleGameObject(GO_MainGateGUID, true);
if (m_auiEncounter[MAX_ENCOUNTER-1] != DONE) // instance not finished if (m_auiEncounter[MAX_ENCOUNTER-1] != DONE) // instance not finished
{ {
// close all cells // close all cells