From e53ae5f6d536963758393202e54741cc074973c9 Mon Sep 17 00:00:00 2001 From: Derision Date: Sun, 10 Mar 2013 18:55:18 +0000 Subject: [PATCH] More compiler warning fixes. --- common/database.cpp | 20 ++++++++++---------- common/rdtsc.cpp | 4 ---- zone/AA.cpp | 10 +++++----- zone/client_packet.cpp | 16 ++++++++-------- zone/doors.cpp | 4 ++-- zone/entity.cpp | 2 +- zone/perlpacket.cpp | 6 ------ 7 files changed, 26 insertions(+), 36 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index bfad8287a..f0e686979 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -1450,7 +1450,7 @@ bool Database::CheckNameFilter(const char* name, bool surname) } } - for (int i = 0; i < str_name.size(); i++) + for (size_t i = 0; i < str_name.size(); i++) { if(!isalpha(str_name[i])) { @@ -1458,14 +1458,14 @@ bool Database::CheckNameFilter(const char* name, bool surname) } } - for(int x = 0; x < str_name.size(); ++x) + for(size_t x = 0; x < str_name.size(); ++x) { str_name[x] = tolower(str_name[x]); } char c = '\0'; uint8 num_c = 0; - for(int x = 0; x < str_name.size(); ++x) + for(size_t x = 0; x < str_name.size(); ++x) { if(str_name[x] == c) { @@ -1484,10 +1484,10 @@ bool Database::CheckNameFilter(const char* name, bool surname) if (RunQuery(query, MakeAnyLenString(&query, "SELECT name FROM name_filter"), errbuf, &result)) { safe_delete_array(query); - while(row = mysql_fetch_row(result)) + while((row = mysql_fetch_row(result))) { std::string current_row = row[0]; - for(int x = 0; x < current_row.size(); ++x) + for(size_t x = 0; x < current_row.size(); ++x) { current_row[x] = tolower(current_row[x]); } @@ -2399,8 +2399,8 @@ bool Database::CheckInstanceExpired(uint16 instance_id) MYSQL_RES *result; MYSQL_ROW row; - uint32 start_time = 0; - uint32 duration = 0; + int32 start_time = 0; + int32 duration = 0; uint32 never_expires = 0; if (RunQuery(query, MakeAnyLenString(&query, "SELECT start_time, duration, never_expires FROM instance_lockout WHERE id=%u", instance_id), errbuf, &result)) @@ -2591,15 +2591,15 @@ bool Database::GetUnusedInstanceID(uint16 &instance_id) return false; } - uint32 count = RuleI(Zone, ReservedInstances) + 1; - uint32 max = 65535; + int32 count = RuleI(Zone, ReservedInstances) + 1; + int32 max = 65535; if (RunQuery(query, MakeAnyLenString(&query, "SELECT id FROM instance_lockout where id >= %i ORDER BY id", count), errbuf, &result)) { safe_delete_array(query); if (mysql_num_rows(result) != 0) { - while(row = mysql_fetch_row(result)) + while((row = mysql_fetch_row(result))) { if(count < atoi(row[0])) { diff --git a/common/rdtsc.cpp b/common/rdtsc.cpp index f4d0bd6cc..d22a35c5f 100644 --- a/common/rdtsc.cpp +++ b/common/rdtsc.cpp @@ -30,10 +30,6 @@ #ifdef i386 #define USE_RDTSC -#else - #ifndef WIN32 - #warning RDTSC_Timer cannot use rdtsc on a non-intel platform, using gettimeofday - #endif #endif bool RDTSC_Timer::_inited = false; diff --git a/zone/AA.cpp b/zone/AA.cpp index 320b822de..c06699523 100644 --- a/zone/AA.cpp +++ b/zone/AA.cpp @@ -443,7 +443,6 @@ void Client::HandleAAAction(aaID activate) { } break; - // seveian 2008-09-23 case aaActionProjectIllusion: EnableAAEffect(aaEffectProjectIllusion, 3600); Message(10, "The power of your next illusion spell will flow to your grouped target in your place."); @@ -453,8 +452,9 @@ void Client::HandleAAAction(aaID activate) { case aaActionEscape: Escape(); break; - - case aaBeastialAlignment: + + // Don't think this code is used any longer for Bestial Alignment as the AA has a spell_id and no nonspell_action. + case aaActionBeastialAlignment: switch(GetBaseRace()) { case BARBARIAN: spell_id = AA_Choose3(activate_val, 4521, 4522, 4523); @@ -1038,7 +1038,7 @@ void Client::BuyAA(AA_Action* action) m_pp.aapoints -= real_cost; Save(); - if ((RuleB(AA, Stacking) && (GetClientVersionBit() >= 4) && (aa2->hotkey_sid == 4294967295)) + if ((RuleB(AA, Stacking) && (GetClientVersionBit() >= 4) && (aa2->hotkey_sid == 4294967295u)) && ((aa2->max_level == (cur_level+1)) && aa2->sof_next_id)){ SendAA(aa2->id); SendAA(aa2->sof_next_id); @@ -1240,7 +1240,7 @@ void Client::SendAA(uint32 id, int seq) { 3) When you zone/buy your player profile will be checked and determine what AA can be displayed base on what you have already. */ - if (RuleB(AA, Stacking) && (GetClientVersionBit() >= 4) && (saa2->hotkey_sid == 4294967295)) + if (RuleB(AA, Stacking) && (GetClientVersionBit() >= 4) && (saa2->hotkey_sid == 4294967295u)) aa_stack = true; if (aa_stack){ diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 7c43684d0..911b18e8a 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -9393,7 +9393,7 @@ void Client::CompleteConnect() gender = 0; else if (gender == 0) gender = 1; - SendIllusionPacket(GetRace(), gender, 0xFFFF, 0xFFFF); + SendIllusionPacket(GetRace(), gender, 0xFF, 0xFF); } else if (spell.base[x1] == -2) { @@ -9406,7 +9406,7 @@ void Client::CompleteConnect() } else { - SendIllusionPacket(spell.base[x1], 0xFF, 0xFFFF, 0xFFFF); + SendIllusionPacket(spell.base[x1], 0xFF, 0xFF, 0xFF); } switch(spell.base[x1]){ case OGRE: @@ -13406,7 +13406,7 @@ void Client::Handle_OP_ItemPreview(const EQApplicationPacket *app) for (spacer = 0; spacer < 77; spacer++) { //More Item stats, but some seem to be off based on packet check outapp->WriteUInt8(0); } - outapp->WriteUInt32(4294967295); //Unknown but always seen as FF FF FF FF + outapp->WriteUInt32(0xFFFFFFFF); //Unknown but always seen as FF FF FF FF outapp->WriteUInt32(0); //Unknown for (spacer = 0; spacer < 5; spacer++) { //Augment stuff outapp->WriteUInt32(item->AugSlotType[spacer]); @@ -13423,7 +13423,7 @@ void Client::Handle_OP_ItemPreview(const EQApplicationPacket *app) for (spacer = 0; spacer < 11; spacer++) { //unknowns outapp->WriteUInt8(0); } - outapp->WriteUInt32(4294967295); //Unknown but always seen as FF FF FF FF + outapp->WriteUInt32(0xFFFFFFFF); //Unknown but always seen as FF FF FF FF outapp->WriteUInt16(0); //Unknown outapp->WriteUInt32(item->Favor); // Tribute for (spacer = 0; spacer < 17; spacer++) { //unknowns @@ -13431,7 +13431,7 @@ void Client::Handle_OP_ItemPreview(const EQApplicationPacket *app) } outapp->WriteUInt32(item->GuildFavor); // Tribute outapp->WriteUInt32(0); //Unknown - outapp->WriteUInt32(4294967295); //Unknown but always seen as FF FF FF FF + outapp->WriteUInt32(0xFFFFFFFF); //Unknown but always seen as FF FF FF FF for (spacer = 0; spacer < 11; spacer++) { //unknowns outapp->WriteUInt8(0); } @@ -13446,13 +13446,13 @@ void Client::Handle_OP_ItemPreview(const EQApplicationPacket *app) outapp->WriteUInt32(0); //unknown outapp->WriteUInt32(1); // Always seen as 1 outapp->WriteUInt32(0); //unknown - outapp->WriteUInt32(3452750909); //0x3DCCCCCD/3452750909 + outapp->WriteUInt32(0xCDCCCC3D); //0x3DCCCCCD/3452750909 outapp->WriteUInt32(0); outapp->WriteUInt16(8256); //0x4020/8256 outapp->WriteUInt16(0); - outapp->WriteUInt32(4294967295); //Unknown but always seen as FF FF FF FF + outapp->WriteUInt32(0xFFFFFFFF); //Unknown but always seen as FF FF FF FF outapp->WriteUInt16(0); - outapp->WriteUInt32(4294967295); //Unknown but always seen as FF FF FF FF + outapp->WriteUInt32(0xFFFFFFFF); //Unknown but always seen as FF FF FF FF outapp->WriteUInt32(0); //unknown outapp->WriteUInt32(0); //unknown outapp->WriteUInt16(0); //unknown diff --git a/zone/doors.cpp b/zone/doors.cpp index febf4c1cd..c33ebf6c3 100644 --- a/zone/doors.cpp +++ b/zone/doors.cpp @@ -110,7 +110,7 @@ Doors::Doors(const char *dmodel, float dx, float dy, float dz, float dheading, u dest_heading = 0; is_ldon_door = 0; - client_version_mask = 4294967295; + client_version_mask = 4294967295u; } @@ -788,4 +788,4 @@ void Doors::CreateDatabaseEntry() return; } database.InsertDoor(GetDoorDBID(), GetDoorID(), GetDoorName(), GetX(), GetY(), GetZ(), GetHeading(), GetOpenType(), GetGuildID(), GetLockpick(), GetKeyItem(), GetDoorParam(), GetInvertState(), GetIncline(), GetSize()); -} \ No newline at end of file +} diff --git a/zone/entity.cpp b/zone/entity.cpp index 3d5164fd6..393abb8ea 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -5124,7 +5124,7 @@ NPC* EntityList::GetClosestBanker(Mob* sender, uint32 &distance) if(!sender) return NULL; - distance = 4294967295; + distance = 4294967295u; NPC* nc = NULL; LinkedListIterator iterator(npc_list); diff --git a/zone/perlpacket.cpp b/zone/perlpacket.cpp index 2e77a479b..86fcbd06b 100644 --- a/zone/perlpacket.cpp +++ b/zone/perlpacket.cpp @@ -37,9 +37,6 @@ PerlPacket::~PerlPacket() { } bool PerlPacket::SetOpcode(const char *opcode) { -#ifndef WIN32 -#warning Rewrite this! -#endif op = OP_Unknown; // op = ZoneOpcodeManager->NameSearch(opcode); return(op != OP_Unknown); @@ -69,9 +66,6 @@ void PerlPacket::SendTo(Client *who) { if(len > 0) memcpy(outapp->pBuffer, packet, len); -#ifndef WIN32 -#warning Rewrite this! -#endif // printf("Created this packet with PerlPacket: OP: %s\n", ZoneOpcodeManager->EmuToName(op)); DumpPacket(outapp);