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

View File

@@ -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 ((--reqKillCount) == 0 && WaveNumber%5 && NextWaveTimer > 5000)
NextWaveTimer = 5000;
if (unit->GetEntry() == NPC_QUEL_DELAR)
if (Creature* c = instance->GetCreature(NPC_UtherGUID))
{
@@ -812,7 +812,7 @@ public:
for (uint8 i=0; i<num_to_activate; ++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))
if (!TrashActive[j])
if (Creature* c = instance->GetCreature(NPC_TrashGUID[j]))
@@ -892,7 +892,7 @@ public:
for (uint8 i=0; i<num_to_activate; ++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))
if (!TrashActive[j])
if (Creature* c = instance->GetCreature(NPC_TrashGUID[j]))
@@ -978,7 +978,7 @@ public:
}
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)
if (Player* p = itr->GetSource())
if (!p->IsGameMaster() && (p->GetExactDist2d(&CenterPos) > MAX_DIST_FROM_CENTER_TO_START || !p->IsAlive()))