mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-08 15:02:21 +00:00
lots of conversions to bool (with performance penalty) doing it explicityl.
This commit is contained in:
parent
248734090a
commit
90a518f4d6
@ -3952,7 +3952,7 @@ void Mob::NegateSpellsBonuses(uint16 spell_id)
|
||||
break;
|
||||
|
||||
case SE_DistanceRemoval:
|
||||
spellbonuses.DistanceRemoval = effect_value;
|
||||
spellbonuses.DistanceRemoval = effect_value != 0;
|
||||
break;
|
||||
|
||||
case SE_ImprovedTaunt:
|
||||
|
||||
10
zone/bot.cpp
10
zone/bot.cpp
@ -1291,7 +1291,7 @@ void Bot::GenerateArmorClass()
|
||||
uint16 Bot::GetPrimarySkillValue()
|
||||
{
|
||||
SkillUseTypes skill = HIGHEST_SKILL; //because nullptr == 0, which is 1H Slashing, & we want it to return 0 from GetSkill
|
||||
bool equiped = m_inv.GetItem(SLOT_PRIMARY);
|
||||
bool equiped = m_inv.GetItem(SLOT_PRIMARY) != nullptr;
|
||||
|
||||
if(!equiped)
|
||||
{
|
||||
@ -5070,7 +5070,7 @@ bool Bot::DoesBotGroupNameExist(std::string botGroupName) {
|
||||
std::string tempBotGroupName = std::string(DataRow[1]);
|
||||
|
||||
if(botGroupName == tempBotGroupName) {
|
||||
result = tempBotGroupId;
|
||||
result = tempBotGroupId != 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -7861,7 +7861,7 @@ bool Bot::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte)
|
||||
|
||||
if(damage > 0 && (aabonuses.ShieldBlock || spellbonuses.ShieldBlock || itembonuses.ShieldBlock)
|
||||
&& (!other->BehindMob(this, other->GetX(), other->GetY()) || bShieldBlockFromRear)) {
|
||||
bool equiped = GetBotItem(SLOT_SECONDARY);
|
||||
bool equiped = GetBotItem(SLOT_SECONDARY) != nullptr;
|
||||
if(equiped) {
|
||||
uint8 shield = GetBotItem(SLOT_SECONDARY)->GetItem()->ItemType;
|
||||
float bonusShieldBlock = 0.0f;
|
||||
@ -7876,7 +7876,7 @@ bool Bot::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte)
|
||||
|
||||
if(damage > 0 && (aabonuses.TwoHandBluntBlock || spellbonuses.TwoHandBluntBlock || itembonuses.TwoHandBluntBlock)
|
||||
&& (!other->BehindMob(this, other->GetX(), other->GetY()) || bShieldBlockFromRear)) {
|
||||
bool equiped2 = GetBotItem(SLOT_PRIMARY);
|
||||
bool equiped2 = GetBotItem(SLOT_PRIMARY) != nullptr;
|
||||
if(equiped2) {
|
||||
uint8 TwoHandBlunt = GetBotItem(SLOT_PRIMARY)->GetItem()->ItemType;
|
||||
float bonusStaffBlock = 0.0f;
|
||||
@ -10477,7 +10477,7 @@ void Bot::CalcRestState() {
|
||||
int32 Bot::LevelRegen()
|
||||
{
|
||||
int level = GetLevel();
|
||||
bool bonus = GetRaceBitmask(_baseRace) & RuleI(Character, BaseHPRegenBonusRaces);
|
||||
bool bonus = GetRaceBitmask(_baseRace) & RuleI(Character, BaseHPRegenBonusRaces) != 0;
|
||||
uint8 multiplier1 = bonus ? 2 : 1;
|
||||
int32 hp = 0;
|
||||
|
||||
|
||||
@ -4136,7 +4136,7 @@ void Client::UpdateLFP() {
|
||||
uint16 Client::GetPrimarySkillValue()
|
||||
{
|
||||
SkillUseTypes skill = HIGHEST_SKILL; //because nullptr == 0, which is 1H Slashing, & we want it to return 0 from GetSkill
|
||||
bool equiped = m_inv.GetItem(13);
|
||||
bool equiped = m_inv.GetItem(13) != nullptr;
|
||||
|
||||
if (!equiped)
|
||||
skill = SkillHandtoHand;
|
||||
|
||||
@ -155,7 +155,7 @@ int32 Client::LevelRegen()
|
||||
bool sitting = IsSitting();
|
||||
bool feigned = GetFeigned();
|
||||
int level = GetLevel();
|
||||
bool bonus = GetRaceBitmask(GetBaseRace()) & RuleI(Character, BaseHPRegenBonusRaces);
|
||||
bool bonus = GetRaceBitmask(GetBaseRace()) & RuleI(Character, BaseHPRegenBonusRaces) != 0;
|
||||
uint8 multiplier1 = bonus ? 2 : 1;
|
||||
int32 hp = 0;
|
||||
|
||||
@ -873,7 +873,7 @@ int16 Client::CalcAC() {
|
||||
|
||||
// Shield AC bonus for HeroicSTR
|
||||
if(itembonuses.HeroicSTR) {
|
||||
bool equiped = CastToClient()->m_inv.GetItem(14);
|
||||
bool equiped = CastToClient()->m_inv.GetItem(14) != nullptr;
|
||||
if(equiped) {
|
||||
uint8 shield = CastToClient()->m_inv.GetItem(14)->GetItem()->ItemType;
|
||||
if(shield == ItemTypeShield)
|
||||
@ -903,7 +903,7 @@ int16 Client::GetACMit() {
|
||||
|
||||
// Shield AC bonus for HeroicSTR
|
||||
if(itembonuses.HeroicSTR) {
|
||||
bool equiped = CastToClient()->m_inv.GetItem(14);
|
||||
bool equiped = CastToClient()->m_inv.GetItem(14) != nullptr;
|
||||
if(equiped) {
|
||||
uint8 shield = CastToClient()->m_inv.GetItem(14)->GetItem()->ItemType;
|
||||
if(shield == ItemTypeShield)
|
||||
|
||||
@ -4010,7 +4010,7 @@ void Client::Handle_OP_GuildManageBanker(const EQApplicationPacket *app)
|
||||
|
||||
bool NewBankerStatus = gmb->enabled & 0x01;
|
||||
|
||||
bool NewAltStatus = gmb->enabled & 0x02;
|
||||
bool NewAltStatus = gmb->enabled & 0x02 != 0;
|
||||
|
||||
if((IsCurrentlyABanker != NewBankerStatus) && !guild_mgr.IsGuildLeader(GuildID(), CharacterID()))
|
||||
{
|
||||
@ -11685,8 +11685,8 @@ void Client::Handle_OP_GMSearchCorpse(const EQApplicationPacket *app)
|
||||
|
||||
strn0cpy(TimeOfDeath, Row[5], sizeof(TimeOfDeath));
|
||||
|
||||
bool CorpseRezzed = atoi(Row[6]);
|
||||
bool CorpseBuried = atoi(Row[7]);
|
||||
bool CorpseRezzed = atoi(Row[6]) != 0;
|
||||
bool CorpseBuried = atoi(Row[7]) != 0;
|
||||
|
||||
sprintf(Buffer, "<tr><td>%s</td><td>%s</td><td>%8.0f</td><td>%8.0f</td><td>%8.0f</td><td>%s</td><td>%s</td><td>%s</td></tr>",
|
||||
CharName, StaticGetZoneName(ZoneID), CorpseX, CorpseY, CorpseZ, TimeOfDeath,
|
||||
@ -12331,7 +12331,7 @@ void Client::Handle_OP_ClearBlockedBuffs(const EQApplicationPacket *app)
|
||||
return;
|
||||
}
|
||||
|
||||
bool Pet = app->pBuffer[0];
|
||||
bool Pet = app->pBuffer[0] != 0;
|
||||
|
||||
if(Pet)
|
||||
PetBlockedBuffs.clear();
|
||||
@ -13302,7 +13302,7 @@ void Client::Handle_OP_XTargetAutoAddHaters(const EQApplicationPacket *app)
|
||||
return;
|
||||
}
|
||||
|
||||
XTargetAutoAddHaters = app->ReadUInt8(0);
|
||||
XTargetAutoAddHaters = app->ReadUInt8(0) != 0;
|
||||
}
|
||||
|
||||
void Client::Handle_OP_ItemPreview(const EQApplicationPacket *app)
|
||||
|
||||
@ -699,7 +699,7 @@ bool Client::Process() {
|
||||
{
|
||||
while(ret && (app = (EQApplicationPacket *)eqs->PopPacket())) {
|
||||
if(app)
|
||||
ret = HandlePacket(app);
|
||||
ret = HandlePacket(app) != 0;
|
||||
safe_delete(app);
|
||||
}
|
||||
}
|
||||
@ -1182,7 +1182,7 @@ void Client::OPTGB(const EQApplicationPacket *app)
|
||||
if(tgb_flag == 2)
|
||||
Message_StringID(0, TGB() ? TGB_ON : TGB_OFF);
|
||||
else
|
||||
tgb = tgb_flag;
|
||||
tgb = tgb_flag != 0;
|
||||
}
|
||||
|
||||
void Client::OPMemorizeSpell(const EQApplicationPacket* app)
|
||||
|
||||
@ -6472,7 +6472,7 @@ void command_revoke(Client *c, const Seperator *sep)
|
||||
RevokeStruct* revoke = (RevokeStruct*)outapp->pBuffer;
|
||||
strn0cpy(revoke->adminname, c->GetName(), 64);
|
||||
strn0cpy(revoke->name, sep->arg[1], 64);
|
||||
revoke->toggle = flag;
|
||||
revoke->toggle = flag != 0;
|
||||
worldserver.SendPacket(outapp);
|
||||
safe_delete(outapp);
|
||||
}
|
||||
|
||||
@ -1894,7 +1894,7 @@ bool ZoneDatabase::LoadPlayerCorpses(uint32 iZoneID, uint16 iInstanceID) {
|
||||
safe_delete_array(query);
|
||||
while ((row = mysql_fetch_row(result))) {
|
||||
lengths = mysql_fetch_lengths(result);
|
||||
entity_list.AddCorpse(Corpse::LoadFromDBData(atoi(row[0]), atoi(row[1]), row[2], (uchar*) row[7], lengths[7], atof(row[3]), atoi(row[4]), atoi(row[5]), atoi(row[6]), row[8],atoi(row[9])==1, atoi(row[10])));
|
||||
entity_list.AddCorpse(Corpse::LoadFromDBData(atoi(row[0]), atoi(row[1]), row[2], (uchar*) row[7], lengths[7], atof(row[3]), atoi(row[4]), atoi(row[5]), atoi(row[6]), row[8],atoi(row[9])==1, atoi(row[10]) != 0));
|
||||
}
|
||||
mysql_free_result(result);
|
||||
}
|
||||
|
||||
@ -399,7 +399,7 @@ XS(XS__addloot)
|
||||
if (items > 1)
|
||||
charges = (uint16)SvUV(ST(1));
|
||||
if (items > 2)
|
||||
equipitem = (bool)SvTRUE(ST(2));
|
||||
equipitem = SvTRUE(ST(2)) != 0;
|
||||
|
||||
quest_manager.addloot(itemid, charges, equipitem);
|
||||
|
||||
@ -1388,7 +1388,7 @@ XS(XS__moveto)
|
||||
h = 0;
|
||||
|
||||
if(items > 4)
|
||||
saveguard = (bool)SvTRUE(ST(4));
|
||||
saveguard = SvTRUE(ST(4)) != 0;
|
||||
else
|
||||
saveguard = false;
|
||||
|
||||
|
||||
@ -146,7 +146,7 @@ void ZoneDatabase::AddLootDropToNPC(NPC* npc,uint32 lootdrop_id, ItemList* iteml
|
||||
uint32 itemid = lds->Entries[item].item_id;
|
||||
|
||||
const Item_Struct* dbitem = GetItem(itemid);
|
||||
npc->AddLootDrop(dbitem, itemlist, lds->Entries[item].item_charges, lds->Entries[item].minlevel, lds->Entries[item].maxlevel, lds->Entries[item].equip_item, false);
|
||||
npc->AddLootDrop(dbitem, itemlist, lds->Entries[item].item_charges, lds->Entries[item].minlevel, lds->Entries[item].maxlevel, lds->Entries[item].equip_item != 0, false);
|
||||
pickedcharges++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1927,7 +1927,7 @@ void NPC::ModifyNPCStat(const char *identifier, const char *newValue)
|
||||
|
||||
if(id == "trackable")
|
||||
{
|
||||
trackable = atoi(val.c_str());
|
||||
trackable = atoi(val.c_str()) != 0;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1957,7 +1957,7 @@ void NPC::ModifyNPCStat(const char *identifier, const char *newValue)
|
||||
|
||||
if(id == "see_invis_undead")
|
||||
{
|
||||
see_invis_undead = atoi(val.c_str());
|
||||
see_invis_undead = atoi(val.c_str()) != 0;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1969,7 +1969,7 @@ void NPC::ModifyNPCStat(const char *identifier, const char *newValue)
|
||||
|
||||
if(id == "see_improved_hide")
|
||||
{
|
||||
see_improved_hide = atoi(val.c_str());
|
||||
see_improved_hide = atoi(val.c_str()) != 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -281,7 +281,7 @@ std::list<int> PathManager::FindRoute(int startID, int endID)
|
||||
|
||||
AStarEntry.Parent = CurrentNode.PathNodeID;
|
||||
|
||||
AStarEntry.Teleport = PathNodes[CurrentNode.PathNodeID].Neighbours[i].Teleport;
|
||||
AStarEntry.Teleport = PathNodes[CurrentNode.PathNodeID].Neighbours[i].Teleport != 0;
|
||||
|
||||
// HCost is the estimated cost to get from this node to the end.
|
||||
AStarEntry.HCost = VertexDistance(PathNodes[PathNodes[CurrentNode.PathNodeID].Neighbours[i].id].v,
|
||||
@ -317,7 +317,7 @@ std::list<int> PathManager::FindRoute(int startID, int endID)
|
||||
|
||||
(*OpenListIterator).GCost = GCostToNode;
|
||||
|
||||
(*OpenListIterator).Teleport = PathNodes[CurrentNode.PathNodeID].Neighbours[i].Teleport;
|
||||
(*OpenListIterator).Teleport = PathNodes[CurrentNode.PathNodeID].Neighbours[i].Teleport != 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@ -473,11 +473,11 @@ bool ZoneDatabase::GetPoweredPetEntry(const char *pet_type, int16 petpower, PetR
|
||||
row = mysql_fetch_row(result);
|
||||
|
||||
into->npc_type = atoi(row[0]);
|
||||
into->temporary = atoi(row[1]);
|
||||
into->temporary = atoi(row[1]) != 0;
|
||||
into->petpower = atoi(row[2]);
|
||||
into->petcontrol = atoi(row[3]);
|
||||
into->petnaming = atoi(row[4]);
|
||||
into->monsterflag = atoi(row[5]);
|
||||
into->monsterflag = atoi(row[5]) != 0;
|
||||
into->equipmentset = atoi(row[6]);
|
||||
|
||||
mysql_free_result(result);
|
||||
|
||||
@ -1319,7 +1319,7 @@ void Raid::GetRaidDetails()
|
||||
}
|
||||
row = mysql_fetch_row(result);
|
||||
if(row){
|
||||
locked = atoi(row[0]);
|
||||
locked = atoi(row[0]) != 0;
|
||||
LootType = atoi(row[1]);
|
||||
}
|
||||
mysql_free_result(result);
|
||||
@ -1354,9 +1354,9 @@ bool Raid::LearnMembers()
|
||||
members[i].GroupNumber = GroupNum;
|
||||
members[i]._class = atoi(row[2]);
|
||||
members[i].level = atoi(row[3]);
|
||||
members[i].IsGroupLeader = atoi(row[4]);
|
||||
members[i].IsRaidLeader = atoi(row[5]);
|
||||
members[i].IsLooter = atoi(row[6]);
|
||||
members[i].IsGroupLeader = atoi(row[4]) != 0;
|
||||
members[i].IsRaidLeader = atoi(row[5]) != 0;
|
||||
members[i].IsLooter = atoi(row[6]) != 0;
|
||||
i++;
|
||||
}
|
||||
mysql_free_result(result);
|
||||
|
||||
@ -207,7 +207,7 @@ bool TaskManager::LoadTasks(int SingleTask) {
|
||||
Tasks[TaskID]->StartZone = atoi(row[9]);
|
||||
Tasks[TaskID]->MinLevel = atoi(row[10]);
|
||||
Tasks[TaskID]->MaxLevel = atoi(row[11]);
|
||||
Tasks[TaskID]->Repeatable = atoi(row[12]);
|
||||
Tasks[TaskID]->Repeatable = atoi(row[12]) != 0;
|
||||
Tasks[TaskID]->ActivityCount = 0;
|
||||
Tasks[TaskID]->SequenceMode = ActivitiesSequential;
|
||||
Tasks[TaskID]->LastStep = 0;
|
||||
@ -297,7 +297,7 @@ bool TaskManager::LoadTasks(int SingleTask) {
|
||||
Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].GoalCount = atoi(row[9]);
|
||||
Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].DeliverToNPC = atoi(row[10]);
|
||||
Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].ZoneID = atoi(row[11]);
|
||||
Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].Optional = atoi(row[12]);
|
||||
Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].Optional = atoi(row[12]) != 0;
|
||||
|
||||
_log(TASKS__GLOBALLOAD, "Activity Slot %2i: ID %i for Task %5i. Type: %3i, GoalID: %8i, "
|
||||
"GoalMethod: %i, GoalCount: %3i, ZoneID:%3i",
|
||||
@ -638,7 +638,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) {
|
||||
}
|
||||
|
||||
int DoneCount = atoi(row[2]);
|
||||
bool Completed = atoi(row[3]);
|
||||
bool Completed = atoi(row[3]) != 0;
|
||||
state->ActiveTasks[ActiveTaskIndex].Activity[ActivityID].ActivityID = ActivityID;
|
||||
state->ActiveTasks[ActiveTaskIndex].Activity[ActivityID].DoneCount = DoneCount;
|
||||
if(Completed) state->ActiveTasks[ActiveTaskIndex].Activity[ActivityID].State = ActivityCompleted;
|
||||
@ -1617,7 +1617,7 @@ bool ClientTaskState::UpdateTasksOnSpeakWith(Client *c, int NPCTypeID) {
|
||||
|
||||
bool ClientTaskState::UpdateTasksByNPC(Client *c, int ActivityType, int NPCTypeID) {
|
||||
|
||||
int Ret = false;
|
||||
bool Ret = false;
|
||||
|
||||
_log(TASKS__UPDATE, "ClientTaskState::UpdateTasks for NPCTypeID: %d", NPCTypeID);
|
||||
|
||||
|
||||
@ -1619,7 +1619,7 @@ void Client::SendBazaarResults(uint32 TraderID, uint32 Class_, uint32 Race, uint
|
||||
VARSTRUCT_ENCODE_TYPE(uint32, bufptr, Cost);
|
||||
StatValue = atoi(Row[8]);
|
||||
VARSTRUCT_ENCODE_TYPE(uint32, bufptr, StatValue);
|
||||
bool Stackable = atoi(Row[10]);
|
||||
bool Stackable = atoi(Row[10]) != 0;
|
||||
if(Stackable) {
|
||||
int Charges = atoi(Row[9]);
|
||||
sprintf(Name, "%s(%i)", Row[7], Charges);
|
||||
|
||||
@ -787,7 +787,7 @@ void WorldServer::Process() {
|
||||
break;
|
||||
}
|
||||
case ServerOP_OOCMute: {
|
||||
oocmuted = *(pack->pBuffer);
|
||||
oocmuted = *(pack->pBuffer) != 0;
|
||||
break;
|
||||
}
|
||||
case ServerOP_Revoke: {
|
||||
|
||||
@ -389,9 +389,9 @@ bool ZoneDatabase::GetAccountInfoForLogin_result(MYSQL_RES* result, int16* admin
|
||||
if (gmspeed)
|
||||
*gmspeed = atoi(row[3]);
|
||||
if (revoked)
|
||||
*revoked = atoi(row[4]);
|
||||
*revoked = atoi(row[4]) != 0;
|
||||
if(gmhideme)
|
||||
*gmhideme = atoi(row[5]);
|
||||
*gmhideme = atoi(row[5]) != 0;
|
||||
if(account_creation)
|
||||
*account_creation = atoul(row[6]);
|
||||
|
||||
@ -961,10 +961,10 @@ bool ZoneDatabase::GetCharacterInfoForLogin_result(MYSQL_RES* result,
|
||||
*level = atoi(row[10]);
|
||||
|
||||
if(LFP)
|
||||
*LFP = atoi(row[11]);
|
||||
*LFP = atoi(row[11]) != 0;
|
||||
|
||||
if(LFG)
|
||||
*LFG = atoi(row[12]);
|
||||
*LFG = atoi(row[12]) != 0;
|
||||
|
||||
if(NumXTargets)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user