Merge from master

This commit is contained in:
KimLS
2013-05-23 12:50:34 -07:00
214 changed files with 2422 additions and 2373 deletions
+4 -4
View File
@@ -34,14 +34,14 @@ Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
#include "../common/classes.h"
#include "../common/eq_packet_structs.h"
#include "../common/packet_dump.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/logsys.h"
#include "zonedb.h"
#include "StringIDs.h"
//static data arrays, really not big enough to warrant shared mem.
AA_DBAction AA_Actions[aaHighestID][MAX_AA_ACTION_RANKS]; //[aaid][rank]
map<uint32,SendAA_Struct*>aas_send;
std::map<uint32,SendAA_Struct*>aas_send;
std::map<uint32, std::map<uint32, AA_Ability> > aa_effects; //stores the effects from the aa_effects table in memory
std::map<uint32, AALevelCost_Struct> AARequiredLevelAndCost;
@@ -1396,7 +1396,7 @@ void Client::SendAAList(){
}
uint32 Client::GetAA(uint32 aa_id) const {
map<uint32,uint8>::const_iterator res;
std::map<uint32,uint8>::const_iterator res;
res = aa_points.find(aa_id);
if(res != aa_points.end()) {
return(res->second);
@@ -1500,7 +1500,7 @@ void Client::ResetAA(){
aa[i]->AA = 0;
aa[i]->value = 0;
}
map<uint32,uint8>::iterator itr;
std::map<uint32,uint8>::iterator itr;
for(itr=aa_points.begin();itr!=aa_points.end();itr++)
aa_points[itr->first] = 0;
+2 -5
View File
@@ -6,10 +6,7 @@
#define MANA_BURN 664
#include <map>
using namespace std;
#define MAX_SWARM_PETS 12 //this can change as long as you make more coords (swarm_pet_x/swarm_pet_y)
@@ -2140,11 +2137,11 @@ struct AALevelCost_Struct
//assumes that no activatable AA has more than 5 ranks
#define MAX_AA_ACTION_RANKS 20
extern AA_DBAction AA_Actions[aaHighestID][MAX_AA_ACTION_RANKS]; //[aaid][rank]
extern map<uint16, AA_SwarmPet> AA_SwarmPets; //key=spell_id
extern std::map<uint16, AA_SwarmPet> AA_SwarmPets; //key=spell_id
#define AA_Choose3(val, v1, v2, v3) (val==1?v1:(val==2?v2:v3))
extern map<uint32,SendAA_Struct*>aas_send;
extern std::map<uint32,SendAA_Struct*>aas_send;
extern std::map<uint32, std::map<uint32, AA_Ability> > aa_effects;
extern std::map<uint32, AALevelCost_Struct> AARequiredLevelAndCost;
+1 -1
View File
@@ -1018,7 +1018,7 @@ float Map::FindClosestZ(VERTEX p ) const
float ClosestZ = -999999;
for(list<float>::iterator Iterator = ZSet.begin(); Iterator != ZSet.end(); ++Iterator)
for(std::list<float>::iterator Iterator = ZSet.begin(); Iterator != ZSet.end(); ++Iterator)
{
if(ABS(p.z - (*Iterator)) < ABS(p.z - ClosestZ))
ClosestZ = (*Iterator);
+16 -17
View File
@@ -17,9 +17,7 @@
*/
#include "../common/debug.h"
#include <iostream>
using namespace std;
#include <iomanip>
using namespace std;
#include <stdlib.h>
#include <math.h>
#include <algorithm>
@@ -30,6 +28,7 @@ using namespace std;
#include "../common/moremath.h"
#include "StringIDs.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/rulesys.h"
#include "../common/features.h"
#include "QuestParserCollection.h"
@@ -101,12 +100,12 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
) {
#if MobAI_DEBUG_Spells >= 21
cout << "Mob::AICastSpell: Casting: spellid=" << AIspells[i].spellid
std::cout << "Mob::AICastSpell: Casting: spellid=" << AIspells[i].spellid
<< ", tar=" << tar->GetName()
<< ", dist2[" << dist2 << "]<=" << spells[AIspells[i].spellid].range *spells[AIspells[i].spellid].range
<< ", mana_cost[" << mana_cost << "]<=" << GetMana()
<< ", cancast[" << AIspells[i].time_cancast << "]<=" << Timer::GetCurrentTime()
<< ", type=" << AIspells[i].type << endl;
<< ", type=" << AIspells[i].type << std::endl;
#endif
switch (AIspells[i].type) {
@@ -309,14 +308,14 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
break;
}
default: {
cout<<"Error: Unknown spell type in AICastSpell. caster:"<<this->GetName()<<" type:"<<AIspells[i].type<<" slot:"<<i<<endl;
std::cout << "Error: Unknown spell type in AICastSpell. caster:" << this->GetName() << " type:" << AIspells[i].type << " slot:" << i << std::endl;
break;
}
}
}
#if MobAI_DEBUG_Spells >= 21
else {
cout << "Mob::AICastSpell: NotCasting: spellid=" << AIspells[i].spellid << ", tar=" << tar->GetName() << ", dist2[" << dist2 << "]<=" << spells[AIspells[i].spellid].range*spells[AIspells[i].spellid].range << ", mana_cost[" << mana_cost << "]<=" << GetMana() << ", cancast[" << AIspells[i].time_cancast << "]<=" << Timer::GetCurrentTime() << endl;
std::cout << "Mob::AICastSpell: NotCasting: spellid=" << AIspells[i].spellid << ", tar=" << tar->GetName() << ", dist2[" << dist2 << "]<=" << spells[AIspells[i].spellid].range*spells[AIspells[i].spellid].range << ", mana_cost[" << mana_cost << "]<=" << GetMana() << ", cancast[" << AIspells[i].time_cancast << "]<=" << Timer::GetCurrentTime() << std::endl;
}
#endif
}
@@ -326,7 +325,7 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
bool NPC::AIDoSpellCast(uint8 i, Mob* tar, int32 mana_cost, uint32* oDontDoAgainBefore) {
#if MobAI_DEBUG_Spells >= 1
cout << "Mob::AIDoSpellCast: spellid=" << AIspells[i].spellid << ", tar=" << tar->GetName() << ", mana=" << mana_cost << ", Name: " << spells[AIspells[i].spellid].name << endl;
std::cout << "Mob::AIDoSpellCast: spellid=" << AIspells[i].spellid << ", tar=" << tar->GetName() << ", mana=" << mana_cost << ", Name: " << spells[AIspells[i].spellid].name << std::endl;
#endif
casting_spell_AIindex = i;
@@ -1844,7 +1843,7 @@ bool NPC::AI_IdleCastCheck() {
if (AIautocastspell_timer->Check(false)) {
_ZP(Mob_AI_Process_autocast);
#if MobAI_DEBUG_Spells >= 25
cout << "Non-Engaged autocast check triggered: " << this->GetName() << endl;
std::cout << "Non-Engaged autocast check triggered: " << this->GetName() << std::endl;
#endif
AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting.
if (!AICastSpell(this, 100, SpellType_Heal | SpellType_Buff | SpellType_Pet)) {
@@ -2205,20 +2204,20 @@ bool NPC::AI_AddNPCSpells(uint32 iDBSpellsID) {
DBnpcspells_Struct* parentlist = database.GetNPCSpells(spell_list->parent_list);
uint32 i;
#if MobAI_DEBUG_Spells >= 10
cout << "Loading NPCSpells onto " << this->GetName() << ": dbspellsid=" << iDBSpellsID;
std::cout << "Loading NPCSpells onto " << this->GetName() << ": dbspellsid=" << iDBSpellsID;
if (spell_list) {
cout << " (found, " << spell_list->numentries << "), parentlist=" << spell_list->parent_list;
std::cout << " (found, " << spell_list->numentries << "), parentlist=" << spell_list->parent_list;
if (spell_list->parent_list) {
if (parentlist) {
cout << " (found, " << parentlist->numentries << ")";
std::cout << " (found, " << parentlist->numentries << ")";
}
else
cout << " (not found)";
std::cout << " (not found)";
}
}
else
cout << " (not found)";
cout << endl;
std::cout << " (not found)";
std::cout << std::endl;
#endif
int16 attack_proc_spell = -1;
int8 proc_chance = 3;
@@ -2378,7 +2377,7 @@ DBnpcspells_Struct* ZoneDatabase::GetNPCSpells(uint32 iDBSpellsID) {
return npc_spells_cache[iDBSpellsID];
}
else {
cerr << "Error in AddNPCSpells query1 '" << query << "' " << errbuf << endl;
std::cerr << "Error in AddNPCSpells query1 '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return 0;
}
@@ -2388,7 +2387,7 @@ DBnpcspells_Struct* ZoneDatabase::GetNPCSpells(uint32 iDBSpellsID) {
}
}
else {
cerr << "Error in AddNPCSpells query1 '" << query << "' " << errbuf << endl;
std::cerr << "Error in AddNPCSpells query1 '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return 0;
}
@@ -2417,7 +2416,7 @@ uint32 ZoneDatabase::GetMaxNPCSpellsID() {
mysql_free_result(result);
}
else {
cerr << "Error in GetMaxNPCSpellsID query '" << query << "' " << errbuf << endl;
std::cerr << "Error in GetMaxNPCSpellsID query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return 0;
}
+2 -2
View File
@@ -25,9 +25,9 @@
#include "../common/packet_functions.h"
#include "../common/packet_dump.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/features.h"
#include "StringIDs.h"
using namespace std;
#include "QuestParserCollection.h"
@@ -664,7 +664,7 @@ Ground_Spawns* ZoneDatabase::LoadGroundSpawns(uint32 zone_id, int16 version, Gro
mysql_free_result(result);
}
else {
cerr << "Error in LoadGroundSpawns query '" << query << "' " << errbuf << endl;
std::cerr << "Error in LoadGroundSpawns query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
}
return gs;
+37 -37
View File
@@ -26,7 +26,6 @@ Child of the Mob class.
#include <math.h>
#include <iostream>
#include <sstream>
using namespace std;
#ifdef _WINDOWS
#define snprintf _snprintf
#if (_MSC_VER < 1500)
@@ -38,6 +37,7 @@ using namespace std;
#include "masterentity.h"
#include "../common/packet_functions.h"
#include "../common/StringUtil.h"
#include "../common/crc32.h"
#include "StringIDs.h"
#include "worldserver.h"
@@ -617,7 +617,7 @@ bool Corpse::Save() {
dbid = database.UpdatePlayerCorpse(dbid, charid, orgname, zone->GetZoneID(), zone->GetInstanceID(), (uchar*) dbpc, tmpsize, x_pos, y_pos, z_pos, heading,Rezzed());
safe_delete_array(dbpc);
if (dbid == 0) {
cout << "Error: Failed to save player corpse '" << this->GetName() << "'" << endl;
std::cout << "Error: Failed to save player corpse '" << this->GetName() << "'" << std::endl;
return false;
}
return true;
@@ -890,7 +890,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a
if(IsPlayerCorpse() && dbid == 0) {
// SendLootReqErrorPacket(client, 0);
client->Message(13, "Warning: Corpse's dbid = 0! Corpse will not survive zone shutdown!");
cout << "Error: PlayerCorpse::MakeLootRequestPackets: dbid = 0!" << endl;
std::cout << "Error: PlayerCorpse::MakeLootRequestPackets: dbid = 0!" << std::endl;
// return;
}
@@ -1456,12 +1456,12 @@ bool ZoneDatabase::DeleteGraveyard(uint32 zone_id, uint32 graveyard_id) {
if (!RunQuery(query, query_length, errbuf, 0, &affected_rows)) {
safe_delete_array(query);
cerr << "Error1 in DeleteGraveyard query " << errbuf << endl;
std::cerr << "Error1 in DeleteGraveyard query " << errbuf << std::endl;
return false;
}
if (affected_rows == 0) {
cerr << "Error2 in DeleteGraveyard query: affected_rows = 0" << endl;
std::cerr << "Error2 in DeleteGraveyard query: affected_rows = 0" << std::endl;
return false;
}
@@ -1469,13 +1469,13 @@ bool ZoneDatabase::DeleteGraveyard(uint32 zone_id, uint32 graveyard_id) {
if (!RunQuery(query, query_length, errbuf, 0, &affected_rows)) {
safe_delete_array(query);
cerr << "Error3 in DeleteGraveyard query " << errbuf << endl;
std::cerr << "Error3 in DeleteGraveyard query " << errbuf << std::endl;
return false;
}
safe_delete_array(query);
if (affected_rows == 0) {
cerr << "Error4 in DeleteGraveyard query: affected_rows = 0" << endl;
std::cerr << "Error4 in DeleteGraveyard query: affected_rows = 0" << std::endl;
return false;
}
@@ -1491,13 +1491,13 @@ uint32 ZoneDatabase::AddGraveyardIDToZone(uint32 zone_id, uint32 graveyard_id) {
if (!RunQuery(query, (uint32) (end - query), errbuf, 0, &affected_rows)) {
safe_delete_array(query);
cerr << "Error1 in AddGraveyardIDToZone query " << errbuf << endl;
std::cerr << "Error1 in AddGraveyardIDToZone query " << errbuf << std::endl;
return 0;
}
safe_delete_array(query);
if (affected_rows == 0) {
cerr << "Error2 in AddGraveyardIDToZone query: affected_rows = 0" << endl;
std::cerr << "Error2 in AddGraveyardIDToZone query: affected_rows = 0" << std::endl;
return 0;
}
@@ -1514,18 +1514,18 @@ uint32 ZoneDatabase::NewGraveyardRecord(uint32 graveyard_zoneid, float graveyard
if (!RunQuery(query, (uint32) (end - query), errbuf, 0, &affected_rows, &new_graveyard_id)) {
safe_delete_array(query);
cerr << "Error1 in NewGraveyardRecord query " << errbuf << endl;
std::cerr << "Error1 in NewGraveyardRecord query " << errbuf << std::endl;
return 0;
}
safe_delete_array(query);
if (affected_rows == 0) {
cerr << "Error2 in NewGraveyardRecord query: affected_rows = 0" << endl;
std::cerr << "Error2 in NewGraveyardRecord query: affected_rows = 0" << std::endl;
return 0;
}
if(new_graveyard_id <= 0) {
cerr << "Error3 in NewGraveyardRecord query: new_graveyard_id <= 0" << endl;
std::cerr << "Error3 in NewGraveyardRecord query: new_graveyard_id <= 0" << std::endl;
return 0;
}
@@ -1542,13 +1542,13 @@ uint32 ZoneDatabase::GraveyardPlayerCorpse(uint32 dbid, uint32 zoneid, uint16 in
if (!RunQuery(query, (uint32) (end - query), errbuf, 0, &affected_rows)) {
safe_delete_array(query);
cerr << "Error1 in GraveyardPlayerCorpse query " << errbuf << endl;
std::cerr << "Error1 in GraveyardPlayerCorpse query " << errbuf << std::endl;
return 0;
}
safe_delete_array(query);
if (affected_rows == 0) {
cerr << "Error2 in GraveyardPlayerCorpse query: affected_rows = 0" << endl;
std::cerr << "Error2 in GraveyardPlayerCorpse query: affected_rows = 0" << std::endl;
return 0;
}
return dbid;
@@ -1567,18 +1567,18 @@ uint32 ZoneDatabase::UpdatePlayerCorpse(uint32 dbid, uint32 charid, const char*
if (!RunQuery(query, (uint32) (end - query), errbuf, 0, &affected_rows)) {
safe_delete_array(query);
cerr << "Error1 in UpdatePlayerCorpse query " << errbuf << endl;
std::cerr << "Error1 in UpdatePlayerCorpse query " << errbuf << std::endl;
return 0;
}
safe_delete_array(query);
if (affected_rows == 0) {
cerr << "Error2 in UpdatePlayerCorpse query: affected_rows = 0" << endl;
std::cerr << "Error2 in UpdatePlayerCorpse query: affected_rows = 0" << std::endl;
return 0;
}
if(rezzed){
if (!RunQuery(query, MakeAnyLenString(&query, "update player_corpses set rezzed = 1 WHERE id=%d",dbid), errbuf)) {
cerr << "Error in UpdatePlayerCorpse/Rezzed query: " << errbuf << endl;
std::cerr << "Error in UpdatePlayerCorpse/Rezzed query: " << errbuf << std::endl;
}
safe_delete_array(query);
}
@@ -1614,18 +1614,18 @@ uint32 ZoneDatabase::CreatePlayerCorpse(uint32 charid, const char* charname, uin
if (!RunQuery(query, (uint32) (end - query), errbuf, 0, &affected_rows, &last_insert_id)) {
safe_delete_array(query);
cerr << "Error1 in CreatePlayerCorpse query " << errbuf << endl;
std::cerr << "Error1 in CreatePlayerCorpse query " << errbuf << std::endl;
return 0;
}
safe_delete_array(query);
if (affected_rows == 0) {
cerr << "Error2 in CreatePlayerCorpse query: affected_rows = 0" << endl;
std::cerr << "Error2 in CreatePlayerCorpse query: affected_rows = 0" << std::endl;
return 0;
}
if (last_insert_id == 0) {
cerr << "Error3 in CreatePlayerCorpse query: last_insert_id = 0" << endl;
std::cerr << "Error3 in CreatePlayerCorpse query: last_insert_id = 0" << std::endl;
return 0;
}
@@ -1653,15 +1653,15 @@ bool ZoneDatabase::CreatePlayerCorpseBackup(uint32 dbid, uint32 charid, const ch
if (affected_rows == 1)
result = true;
else
cerr << "Error in CreatePlayerCorpseBackup query: affected_rows != 1" << endl;
std::cerr << "Error in CreatePlayerCorpseBackup query: affected_rows != 1" << std::endl;
}
else
cerr << "Error in CreatePlayerCorpseBackup query " << errbuf << endl;
std::cerr << "Error in CreatePlayerCorpseBackup query " << errbuf << std::endl;
}
safe_delete_array(query);
}
else {
cerr << "Error in CreatePlayerCorpseBackup: dbid = 0" << endl;
std::cerr << "Error in CreatePlayerCorpseBackup: dbid = 0" << std::endl;
}
return result;
}
@@ -1679,7 +1679,7 @@ uint32 ZoneDatabase::GetPlayerBurriedCorpseCount(uint32 char_id) {
mysql_free_result(result);
}
else {
cerr << "Error in GetPlayerBurriedCorpseCount query '" << query << "' " << errbuf << endl;
std::cerr << "Error in GetPlayerBurriedCorpseCount query '" << query << "' " << errbuf << std::endl;
}
safe_delete_array(query);
@@ -1700,7 +1700,7 @@ uint32 ZoneDatabase::GetPlayerCorpseCount(uint32 char_id) {
mysql_free_result(result);
}
else {
cerr << "Error in GetPlayerCorpseCount query '" << query << "' " << errbuf << endl;
std::cerr << "Error in GetPlayerCorpseCount query '" << query << "' " << errbuf << std::endl;
}
safe_delete_array(query);
@@ -1723,7 +1723,7 @@ uint32 ZoneDatabase::GetPlayerCorpseID(uint32 char_id, uint8 corpse) {
mysql_free_result(result);
}
else {
cerr << "Error in GetPlayerCorpseID query '" << query << "' " << errbuf << endl;
std::cerr << "Error in GetPlayerCorpseID query '" << query << "' " << errbuf << std::endl;
}
safe_delete_array(query);
@@ -1769,7 +1769,7 @@ Corpse* ZoneDatabase::SummonBurriedPlayerCorpse(uint32 char_id, uint32 dest_zone
mysql_free_result(result);
}
else {
cerr << "Error in SummonBurriedPlayerCorpse query '" << query << "' " << errbuf << endl;
std::cerr << "Error in SummonBurriedPlayerCorpse query '" << query << "' " << errbuf << std::endl;
}
safe_delete_array(query);
@@ -1836,10 +1836,10 @@ bool ZoneDatabase::UnburyPlayerCorpse(uint32 dbid, uint32 new_zoneid, uint16 new
if (affected_rows == 1)
Result = true;
else
cerr << "Error2 in UnburyPlayerCorpse query: affected_rows NOT EQUAL to 1, as expected." << endl;
std::cerr << "Error2 in UnburyPlayerCorpse query: affected_rows NOT EQUAL to 1, as expected." << std::endl;
}
else
cerr << "Error1 in UnburyPlayerCorpse query " << errbuf << endl;
std::cerr << "Error1 in UnburyPlayerCorpse query " << errbuf << std::endl;
safe_delete_array(query);
@@ -1865,8 +1865,8 @@ Corpse* ZoneDatabase::LoadPlayerCorpse(uint32 player_corpse_id) {
mysql_free_result(result);
}
else {
cerr << "Error in LoadPlayerCorpse query '" << query << "' " << errbuf << endl;
cerr << "Note that if your missing the 'rezzed' field you can add it with:\nALTER TABLE `player_corpses` ADD `rezzed` TINYINT UNSIGNED DEFAULT \"0\";\n";
std::cerr << "Error in LoadPlayerCorpse query '" << query << "' " << errbuf << std::endl;
std::cerr << "Note that if your missing the 'rezzed' field you can add it with:\nALTER TABLE `player_corpses` ADD `rezzed` TINYINT UNSIGNED DEFAULT \"0\";\n";
}
safe_delete_array(query);
@@ -1897,8 +1897,8 @@ bool ZoneDatabase::LoadPlayerCorpses(uint32 iZoneID, uint16 iInstanceID) {
mysql_free_result(result);
}
else {
cerr << "Error in LoadPlayerCorpses query '" << query << "' " << errbuf << endl;
cerr << "Note that if your missing the 'rezzed' field you can add it with:\nALTER TABLE `player_corpses` ADD `rezzed` TINYINT UNSIGNED DEFAULT \"0\";\n";
std::cerr << "Error in LoadPlayerCorpses query '" << query << "' " << errbuf << std::endl;
std::cerr << "Note that if your missing the 'rezzed' field you can add it with:\nALTER TABLE `player_corpses` ADD `rezzed` TINYINT UNSIGNED DEFAULT \"0\";\n";
safe_delete_array(query);
return false;
}
@@ -1922,7 +1922,7 @@ uint32 ZoneDatabase::GetFirstCorpseID(uint32 char_id) {
}
}
else {
cerr << "Error in GetFirstCorpseID query '" << query << "' " << errbuf << endl;
std::cerr << "Error in GetFirstCorpseID query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return 0;
}
@@ -1936,7 +1936,7 @@ bool ZoneDatabase::BuryPlayerCorpse(uint32 dbid) {
char *query = 0;
if (!RunQuery(query, MakeAnyLenString(&query, "UPDATE player_corpses SET IsBurried = 1 WHERE id=%d", dbid), errbuf)) {
cerr << "Error in BuryPlayerCorpse query '" << query << "' " << errbuf << endl;
std::cerr << "Error in BuryPlayerCorpse query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return false;
}
@@ -1950,7 +1950,7 @@ bool ZoneDatabase::BuryAllPlayerCorpses(uint32 charid) {
char *query = 0;
if (!RunQuery(query, MakeAnyLenString(&query, "UPDATE player_corpses SET IsBurried = 1 WHERE charid=%d", charid), errbuf)) {
cerr << "Error in BuryPlayerCorpse query '" << query << "' " << errbuf << endl;
std::cerr << "Error in BuryPlayerCorpse query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return false;
}
@@ -1964,7 +1964,7 @@ bool ZoneDatabase::DeletePlayerCorpse(uint32 dbid) {
char *query = 0;
if (!RunQuery(query, MakeAnyLenString(&query, "Delete from player_corpses where id=%d", dbid), errbuf)) {
cerr << "Error in DeletePlayerCorpse query '" << query << "' " << errbuf << endl;
std::cerr << "Error in DeletePlayerCorpse query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return false;
}
+1 -1
View File
@@ -1,5 +1,5 @@
#include "../common/debug.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "QGlobals.h"
#include "zonedb.h"
+1 -1
View File
@@ -23,7 +23,7 @@
class ZoneConfig : public EQEmuConfig {
public:
uint16 ZonePort;
string ZoneAddress;
std::string ZoneAddress;
private:
+1 -1
View File
@@ -187,7 +187,7 @@ void NPC::DescribeAggro(Client *towho, Mob *mob, bool verbose) {
char namebuf[256];
if(!database.GetFactionName(mob_primary, namebuf, sizeof(namebuf)))
strcpy(namebuf, "(Unknown)");
list<struct NPCFaction*>::iterator cur,end;
std::list<struct NPCFaction*>::iterator cur,end;
cur = faction_list.begin();
end = faction_list.end();
bool res = false;
+1 -2
View File
@@ -26,7 +26,6 @@
#include <stdio.h>
#include <math.h>
#include <iostream>
using namespace std;
#include <assert.h>
#include "masterentity.h"
@@ -38,7 +37,7 @@ using namespace std;
#include "../common/spdat.h"
#include "zone.h"
#include "StringIDs.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/rulesys.h"
#include "QuestParserCollection.h"
#include "watermap.h"
+1 -1
View File
@@ -615,7 +615,7 @@ void Client::ApplyAABonuses(uint32 aaid, uint32 slots, StatBonuses* newbon)
return;
}
for (map<uint32, AA_Ability>::const_iterator iter = aa_effects[aaid].begin(); iter != aa_effects[aaid].end(); ++iter) {
for (std::map<uint32, AA_Ability>::const_iterator iter = aa_effects[aaid].begin(); iter != aa_effects[aaid].end(); ++iter) {
effect = iter->second.skill_id;
base1 = iter->second.base1;
base2 = iter->second.base2;
+38 -37
View File
@@ -4,6 +4,7 @@
#include "object.h"
#include "doors.h"
#include "QuestParserCollection.h"
#include "../common/StringUtil.h"
extern volatile bool ZoneLoaded;
@@ -1575,7 +1576,7 @@ void Bot::ApplyAABonuses(uint32 aaid, uint32 slots, StatBonuses* newbon)
return;
}
for (map<uint32, AA_Ability>::const_iterator iter = aa_effects[aaid].begin(); iter != aa_effects[aaid].end(); ++iter) {
for (std::map<uint32, AA_Ability>::const_iterator iter = aa_effects[aaid].begin(); iter != aa_effects[aaid].end(); ++iter) {
effect = iter->second.skill_id;
base1 = iter->second.base1;
base2 = iter->second.base2;
@@ -4778,7 +4779,7 @@ void Bot::LoadAndSpawnAllZonedBots(Client* botOwner) {
std::list<uint32> ActiveBots = Bot::GetGroupedBotsByGroupId(botOwner->GetGroup()->GetID(), &errorMessage);
if(errorMessage.empty() && !ActiveBots.empty()) {
for(list<uint32>::iterator itr = ActiveBots.begin(); itr != ActiveBots.end(); itr++) {
for(std::list<uint32>::iterator itr = ActiveBots.begin(); itr != ActiveBots.end(); itr++) {
Bot* activeBot = Bot::LoadBot(*itr, &errorMessage);
if(!errorMessage.empty()) {
@@ -6673,7 +6674,7 @@ int16 Bot::CalcBotAAFocus(BotfocusType type, uint32 aa_ID, uint16 spell_id)
return 0;
}
for (map<uint32, AA_Ability>::const_iterator iter = aa_effects[aa_ID].begin(); iter != aa_effects[aa_ID].end(); ++iter)
for (std::map<uint32, AA_Ability>::const_iterator iter = aa_effects[aa_ID].begin(); iter != aa_effects[aa_ID].end(); ++iter)
{
effect = iter->second.skill_id;
base1 = iter->second.base1;
@@ -11108,7 +11109,7 @@ int32 Bot::CalcBaseEndurance()
int BonusUpto800 = int( at_most_800 / 4 ) ;
if(Stats > 400) {
Bonus400to800 = int( (at_most_800 - 400) / 4 );
HalfBonus400to800 = int( max( ( at_most_800 - 400 ), 0 ) / 8 );
HalfBonus400to800 = int( std::max( ( at_most_800 - 400 ), 0 ) / 8 );
if(Stats > 800) {
Bonus800plus = int( (Stats - 800) / 8 ) * 2;
@@ -11570,7 +11571,7 @@ void Bot::ProcessClientZoneChange(Client* botOwner) {
if(botOwner) {
std::list<Bot*> BotList = entity_list.GetBotsByBotOwnerCharacterID(botOwner->CharacterID());
for(list<Bot*>::iterator itr = BotList.begin(); itr != BotList.end(); itr++) {
for(std::list<Bot*>::iterator itr = BotList.begin(); itr != BotList.end(); itr++) {
Bot* tempBot = *itr;
if(tempBot) {
@@ -12294,7 +12295,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
if(std::string(sep->arg[2]).compare("all") == 0)
listAll = true;
else {
string botName = std::string(sep->arg[2]);
std::string botName = std::string(sep->arg[2]);
Bot* tempBot = entity_list.GetBotByBotName(botName);
@@ -15953,12 +15954,12 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
Bot* leaderBot = *botListItr;
if(leaderBot->GetInHealRotation() && leaderBot->GetHealRotationLeader() == leaderBot) {
//start all heal rotations
list<Bot*> rotationMemberList;
std::list<Bot*> rotationMemberList;
int index = 0;
rotationMemberList = GetBotsInHealRotation(leaderBot);
for(list<Bot*>::iterator rotationMemberItr = rotationMemberList.begin(); rotationMemberItr != rotationMemberList.end(); rotationMemberItr++) {
for(std::list<Bot*>::iterator rotationMemberItr = rotationMemberList.begin(); rotationMemberItr != rotationMemberList.end(); rotationMemberItr++) {
Bot* tempBot = *rotationMemberItr;
if(tempBot) {
@@ -15986,7 +15987,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
}
if(leaderBot) {
list<Bot*> botList;
std::list<Bot*> botList;
int index = 0;
if (leaderBot->GetBotOwner() != c) {
c->Message(13, "You must target a bot that you own.");
@@ -15995,7 +15996,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
botList = GetBotsInHealRotation(leaderBot);
for(list<Bot*>::iterator botListItr = botList.begin(); botListItr != botList.end(); botListItr++) {
for(std::list<Bot*>::iterator botListItr = botList.begin(); botListItr != botList.end(); botListItr++) {
Bot* tempBot = *botListItr;
if(tempBot) {
@@ -16030,11 +16031,11 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
Bot* leaderBot = *botListItr;
if(leaderBot->GetInHealRotation() && leaderBot->GetHealRotationLeader() == leaderBot) {
//start all heal rotations
list<Bot*> rotationMemberList;
std::list<Bot*> rotationMemberList;
rotationMemberList = GetBotsInHealRotation(leaderBot);
for(list<Bot*>::iterator rotationMemberItr = rotationMemberList.begin(); rotationMemberItr != rotationMemberList.end(); rotationMemberItr++) {
for(std::list<Bot*>::iterator rotationMemberItr = rotationMemberList.begin(); rotationMemberItr != rotationMemberList.end(); rotationMemberItr++) {
Bot* tempBot = *rotationMemberItr;
if(tempBot) {
@@ -16059,7 +16060,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
}
if(leaderBot) {
list<Bot*> botList;
std::list<Bot*> botList;
if (leaderBot->GetBotOwner() != c) {
c->Message(13, "You must target a bot that you own.");
return;
@@ -16067,7 +16068,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
botList = GetBotsInHealRotation(leaderBot);
for(list<Bot*>::iterator botListItr = botList.begin(); botListItr != botList.end(); botListItr++) {
for(std::list<Bot*>::iterator botListItr = botList.begin(); botListItr != botList.end(); botListItr++) {
Bot* tempBot = *botListItr;
if(tempBot && tempBot->GetBotOwnerCharacterID() == c->CharacterID()) {
@@ -16118,7 +16119,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
}
if(leaderBot) {
list<Bot*> botList;
std::list<Bot*> botList;
if (leaderBot->GetBotOwner() != c) {
c->Message(13, "You must target a bot that you own.");
return;
@@ -16130,7 +16131,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
c->Message(0, "Bot Heal Rotation- Leader: %s", leaderBot->GetCleanName());
c->Message(0, "Bot Heal Rotation- Timer: %1.1f", ((float)leaderBot->GetHealRotationTimer()/1000.0f));
for(list<Bot*>::iterator botListItr = botList.begin(); botListItr != botList.end(); botListItr++) {
for(std::list<Bot*>::iterator botListItr = botList.begin(); botListItr != botList.end(); botListItr++) {
Bot* tempBot = *botListItr;
if(tempBot && tempBot->GetBotOwnerCharacterID() == c->CharacterID()) {
@@ -16180,7 +16181,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
}
if(leaderBot) {
list<Bot*> botList;
std::list<Bot*> botList;
if (leaderBot->GetBotOwner() != c) {
c->Message(13, "You must target a bot that you own.");
return;
@@ -16188,7 +16189,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
botList = GetBotsInHealRotation(leaderBot);
for(list<Bot*>::iterator botListItr = botList.begin(); botListItr != botList.end(); botListItr++) {
for(std::list<Bot*>::iterator botListItr = botList.begin(); botListItr != botList.end(); botListItr++) {
Bot* tempBot = *botListItr;
if(tempBot && tempBot->GetBotOwnerCharacterID() == c->CharacterID())
@@ -16220,7 +16221,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
if(leaderBot) {
bool fastHeals = false;
list<Bot*> botList;
std::list<Bot*> botList;
if (leaderBot->GetBotOwner() != c) {
c->Message(13, "You must target a bot that you own.");
return;
@@ -16236,7 +16237,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
botList = GetBotsInHealRotation(leaderBot);
for(list<Bot*>::iterator botListItr = botList.begin(); botListItr != botList.end(); botListItr++) {
for(std::list<Bot*>::iterator botListItr = botList.begin(); botListItr != botList.end(); botListItr++) {
Bot* tempBot = *botListItr;
if(tempBot && tempBot->GetBotOwnerCharacterID() == c->CharacterID())
@@ -16520,7 +16521,7 @@ Bot* EntityList::GetBotByBotID(uint32 botID) {
Bot* Result = 0;
if(botID > 0) {
for(list<Bot*>::iterator botListItr = bot_list.begin(); botListItr != bot_list.end(); botListItr++) {
for(std::list<Bot*>::iterator botListItr = bot_list.begin(); botListItr != bot_list.end(); botListItr++) {
Bot* tempBot = *botListItr;
if(tempBot && tempBot->GetBotID() == botID) {
@@ -16537,7 +16538,7 @@ Bot* EntityList::GetBotByBotName(std::string botName) {
Bot* Result = 0;
if(!botName.empty()) {
for(list<Bot*>::iterator botListItr = bot_list.begin(); botListItr != bot_list.end(); botListItr++) {
for(std::list<Bot*>::iterator botListItr = bot_list.begin(); botListItr != bot_list.end(); botListItr++) {
Bot* tempBot = *botListItr;
if(tempBot && std::string(tempBot->GetName()) == botName) {
@@ -16581,11 +16582,11 @@ void EntityList::AddBot(Bot *newBot, bool SendSpawnPacket, bool dontqueue) {
}
}
list<Bot*> EntityList::GetBotsByBotOwnerCharacterID(uint32 botOwnerCharacterID) {
list<Bot*> Result;
std::list<Bot*> EntityList::GetBotsByBotOwnerCharacterID(uint32 botOwnerCharacterID) {
std::list<Bot*> Result;
if(botOwnerCharacterID > 0) {
for(list<Bot*>::iterator botListItr = bot_list.begin(); botListItr != bot_list.end(); botListItr++) {
for(std::list<Bot*>::iterator botListItr = bot_list.begin(); botListItr != bot_list.end(); botListItr++) {
Bot* tempBot = *botListItr;
if(tempBot && tempBot->GetBotOwnerCharacterID() == botOwnerCharacterID)
@@ -16648,7 +16649,7 @@ bool EntityList::RemoveBot(uint16 entityID) {
bool Result = false;
if(entityID > 0) {
for(list<Bot*>::iterator botListItr = bot_list.begin(); botListItr != bot_list.end(); botListItr++)
for(std::list<Bot*>::iterator botListItr = bot_list.begin(); botListItr != bot_list.end(); botListItr++)
{
Bot* tempBot = *botListItr;
@@ -16667,7 +16668,7 @@ void EntityList::ShowSpawnWindow(Client* client, int Distance, bool NamedOnly) {
const char *WindowTitle = "Bot Tracking Window";
string WindowText;
std::string WindowText;
int LastCon = -1;
int CurrentCon = 0;
@@ -17200,9 +17201,9 @@ bool Bot::AddHealRotationMember( Bot* healer ) {
//update leader's previous member (end of list) to new member and update rotation data
SetPrevHealRotationMember(healer);
list<Bot*> botList = GetBotsInHealRotation(this);
std::list<Bot*> botList = GetBotsInHealRotation(this);
for(list<Bot*>::iterator botListItr = botList.begin(); botListItr != botList.end(); botListItr++) {
for(std::list<Bot*>::iterator botListItr = botList.begin(); botListItr != botList.end(); botListItr++) {
Bot* tempBot = *botListItr;
if(tempBot)
@@ -17248,9 +17249,9 @@ bool Bot::RemoveHealRotationMember( Bot* healer ) {
}
//update rotation data
list<Bot*> botList = GetBotsInHealRotation(leader);
std::list<Bot*> botList = GetBotsInHealRotation(leader);
for(list<Bot*>::iterator botListItr = botList.begin(); botListItr != botList.end(); botListItr++) {
for(std::list<Bot*>::iterator botListItr = botList.begin(); botListItr != botList.end(); botListItr++) {
Bot* tempBot = *botListItr;
if(tempBot) {
@@ -17321,11 +17322,11 @@ bool Bot::AddHealRotationTarget( Mob* target ) {
if (_healRotationTargets[i] == 0)
{
list<Bot*> botList = GetBotsInHealRotation(this);
std::list<Bot*> botList = GetBotsInHealRotation(this);
_healRotationTargets[i] = target->GetID();
for(list<Bot*>::iterator botListItr = botList.begin(); botListItr != botList.end(); botListItr++) {
for(std::list<Bot*>::iterator botListItr = botList.begin(); botListItr != botList.end(); botListItr++) {
Bot* tempBot = *botListItr;
if(tempBot && tempBot != this) {
@@ -17358,12 +17359,12 @@ bool Bot::RemoveHealRotationTarget( Mob* target ) {
//notify all heal rotation members to remove target
for(int i=0; i<MaxHealRotationTargets; i++){
if(_healRotationTargets[i] == target->GetID()) {
list<Bot*> botList = GetBotsInHealRotation(this);
std::list<Bot*> botList = GetBotsInHealRotation(this);
_healRotationTargets[i] = 0;
index = i;
removed = true;
for(list<Bot*>::iterator botListItr = botList.begin(); botListItr != botList.end(); botListItr++) {
for(std::list<Bot*>::iterator botListItr = botList.begin(); botListItr != botList.end(); botListItr++) {
Bot* tempBot = *botListItr;
if(tempBot)
@@ -17471,8 +17472,8 @@ Mob* Bot::GetHealRotationTarget( uint8 index ) {
return target;
}
list<Bot*> Bot::GetBotsInHealRotation(Bot* rotationLeader) {
list<Bot*> Result;
std::list<Bot*> Bot::GetBotsInHealRotation(Bot* rotationLeader) {
std::list<Bot*> Result;
if(rotationLeader != nullptr) {
Result.push_back(rotationLeader);
-2
View File
@@ -18,8 +18,6 @@
#include <sstream>
using namespace std;
extern WorldServer worldserver;
const int BotAISpellRange = 100; // TODO: Write a method that calcs what the bot's spell range is based on spell, equipment, AA, whatever and replace this
-2
View File
@@ -7,8 +7,6 @@
#include <sstream>
using namespace std;
struct BotsAvailableList {
uint32 BotID;
char BotName[64];
+5 -4
View File
@@ -1,6 +1,7 @@
#ifdef BOTS
#include "bot.h"
#include "../common/StringUtil.h"
bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
_ZP(Bot_AICastSpell);
@@ -558,7 +559,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
std::list<BotSpell> inCombatBuffList = GetBotSpellsBySpellType(this, SpellType_InCombatBuff);
for(list<BotSpell>::iterator itr = inCombatBuffList.begin(); itr != inCombatBuffList.end(); itr++) {
for(std::list<BotSpell>::iterator itr = inCombatBuffList.begin(); itr != inCombatBuffList.end(); itr++) {
BotSpell selectedBotSpell = *itr;
if(selectedBotSpell.SpellId == 0)
@@ -645,7 +646,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
const int maxDotSelect = 5;
int dotSelectCounter = 0;
for(list<BotSpell>::iterator itr = dotList.begin(); itr != dotList.end(); itr++) {
for(std::list<BotSpell>::iterator itr = dotList.begin(); itr != dotList.end(); itr++) {
BotSpell selectedBotSpell = *itr;
if(selectedBotSpell.SpellId == 0)
@@ -2048,7 +2049,7 @@ BotSpell Bot::GetBestBotSpellForCure(Bot* botCaster, Mob *tar) {
//Check for group cure first
if(countNeedsCured > 2) {
for(list<BotSpell>::iterator itr = cureList.begin(); itr != cureList.end(); itr++) {
for(std::list<BotSpell>::iterator itr = cureList.begin(); itr != cureList.end(); itr++) {
BotSpell selectedBotSpell = *itr;
if(IsGroupSpell(itr->SpellId) && CheckSpellRecastTimers(botCaster, itr->SpellIndex)) {
@@ -2085,7 +2086,7 @@ BotSpell Bot::GetBestBotSpellForCure(Bot* botCaster, Mob *tar) {
//no group cure for target- try to find single target spell
if(!spellSelected) {
for(list<BotSpell>::iterator itr = cureList.begin(); itr != cureList.end(); itr++) {
for(std::list<BotSpell>::iterator itr = cureList.begin(); itr != cureList.end(); itr++) {
BotSpell selectedBotSpell = *itr;
if(CheckSpellRecastTimers(botCaster, itr->SpellIndex)) {
+31 -33
View File
@@ -17,9 +17,7 @@
*/
#include "../common/debug.h"
#include <iostream>
using namespace std;
#include <iomanip>
using namespace std;
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -34,7 +32,7 @@ using namespace std;
#define vsnprintf _vsnprintf
#endif
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#define strcasecmp _stricmp
#else
#include <stdarg.h>
#include <sys/socket.h>
@@ -61,7 +59,7 @@ extern volatile bool RunLoops;
#include "../common/guilds.h"
#include "../common/breakdowns.h"
#include "../common/rulesys.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "forage.h"
#include "command.h"
#include "StringIDs.h"
@@ -628,7 +626,7 @@ bool Client::Save(uint8 iCommitNow) {
SaveBackup();
}
else {
cerr << "Failed to update player profile" << endl;
std::cerr << "Failed to update player profile" << std::endl;
return false;
}
@@ -2029,7 +2027,7 @@ void Client::ReadBook(BookRequest_Struct *book) {
return;
}
string booktxt2 = database.GetBook(txtfile);
std::string booktxt2 = database.GetBook(txtfile);
int length = booktxt2.length();
if (booktxt2[0] != '\0') {
@@ -2061,7 +2059,7 @@ void Client::ReadBook(BookRequest_Struct *book) {
}
void Client::QuestReadBook(const char* text, uint8 type) {
string booktxt2 = text;
std::string booktxt2 = text;
int length = booktxt2.length();
if (booktxt2[0] != '\0') {
EQApplicationPacket* outapp = new EQApplicationPacket(OP_ReadBook, length + sizeof(BookText_Struct));
@@ -2562,7 +2560,7 @@ void Client::LogMerchant(Client* player, Mob* merchant, uint32 quantity, uint32
if(!player || !merchant || !item)
return;
string LogText = "Qty: ";
std::string LogText = "Qty: ";
char Buffer[255];
memset(Buffer, 0, sizeof(Buffer));
@@ -3857,7 +3855,7 @@ void Client::KeyRingLoad()
}
mysql_free_result(result);
}else {
cerr << "Error in Client::KeyRingLoad query '" << query << "' " << errbuf << endl;
std::cerr << "Error in Client::KeyRingLoad query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return;
}
@@ -3880,7 +3878,7 @@ void Client::KeyRingAdd(uint32 item_id)
}
else
{
cerr << "Error in Doors::HandleClick query '" << query << "' " << errbuf << endl;
std::cerr << "Error in Doors::HandleClick query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return;
}
@@ -3933,7 +3931,7 @@ bool Client::IsDiscovered(uint32 itemid) {
}
else
{
cerr << "Error in IsDiscovered query '" << query << "' " << errbuf << endl;
std::cerr << "Error in IsDiscovered query '" << query << "' " << errbuf << std::endl;
}
mysql_free_result(result);
safe_delete_array(query);
@@ -4722,10 +4720,10 @@ uint32 Client::GetStartZone()
void Client::ShowSkillsWindow()
{
const char *WindowTitle = "Skills";
string WindowText;
std::string WindowText;
// using a map for easy alphabetizing of the skills list
map<string, SkillType> Skills;
map<string, SkillType>::iterator it;
std::map<std::string, SkillType> Skills;
std::map<std::string, SkillType>::iterator it;
// this list of names must keep the same order as that in common/skills.h
const char* SkillName[] = {"1H Blunt","1H Slashing","2H Blunt","2H Slashing","Abjuration","Alteration","Apply Poison","Archery",
@@ -5127,7 +5125,7 @@ void Client::SendRewards()
InternalVeteranReward *ivr = (InternalVeteranReward*)data;
ivr->claim_id = rewards[i].id;
ivr->number_available = rewards[i].amount;
list<InternalVeteranReward>::iterator iter = zone->VeteranRewards.begin();
std::list<InternalVeteranReward>::iterator iter = zone->VeteranRewards.begin();
while(iter != zone->VeteranRewards.end())
{
if((*iter).claim_id == rewards[i].id)
@@ -5217,7 +5215,7 @@ bool Client::TryReward(uint32 claim_id)
return false;
}
list<InternalVeteranReward>::iterator iter = zone->VeteranRewards.begin();
std::list<InternalVeteranReward>::iterator iter = zone->VeteranRewards.begin();
while(iter != zone->VeteranRewards.end())
{
if((*iter).claim_id == claim_id)
@@ -6036,7 +6034,7 @@ void Client::NPCSpawn(NPC *target_npc, const char *identifier, uint32 extra)
bool Client::IsDraggingCorpse(const char *CorpseName)
{
for(std::list<string>::iterator Iterator = DraggedCorpses.begin(); Iterator != DraggedCorpses.end(); ++Iterator)
for(std::list<std::string>::iterator Iterator = DraggedCorpses.begin(); Iterator != DraggedCorpses.end(); ++Iterator)
{
if(!strcasecmp((*Iterator).c_str(), CorpseName))
return true;
@@ -6047,7 +6045,7 @@ bool Client::IsDraggingCorpse(const char *CorpseName)
void Client::DragCorpses()
{
for(std::list<string>::iterator Iterator = DraggedCorpses.begin(); Iterator != DraggedCorpses.end(); ++Iterator)
for(std::list<std::string>::iterator Iterator = DraggedCorpses.begin(); Iterator != DraggedCorpses.end(); ++Iterator)
{
Mob* corpse = entity_list.GetMob((*Iterator).c_str());
@@ -6702,7 +6700,7 @@ void Client::SendAltCurrencies() {
altc->count = count;
uint32 i = 0;
list<AltCurrencyDefinition_Struct>::iterator iter = zone->AlternateCurrencies.begin();
std::list<AltCurrencyDefinition_Struct>::iterator iter = zone->AlternateCurrencies.begin();
while(iter != zone->AlternateCurrencies.end()) {
const Item_Struct* item = database.GetItem((*iter).item_id);
altc->entries[i].currency_number = (*iter).id;
@@ -6757,7 +6755,7 @@ void Client::AddAlternateCurrencyValue(uint32 currency_id, int32 amount)
void Client::SendAlternateCurrencyValues()
{
list<AltCurrencyDefinition_Struct>::iterator iter = zone->AlternateCurrencies.begin();
std::list<AltCurrencyDefinition_Struct>::iterator iter = zone->AlternateCurrencies.begin();
while(iter != zone->AlternateCurrencies.end()) {
SendAlternateCurrencyValue((*iter).id, false);
iter++;
@@ -7124,23 +7122,23 @@ void Client::SendWebLink(const char *website)
{
if(website != 0)
{
string str = website;
EQApplicationPacket* outapp = new EQApplicationPacket(OP_Weblink, sizeof(Weblink_Struct) + str.length() + 1);
Weblink_Struct *wl = (Weblink_Struct*)outapp->pBuffer;
memcpy(wl->weblink, str.c_str(), str.length() + 1);
wl->weblink[str.length() + 1] = '\0';
std::string str = website;
EQApplicationPacket* outapp = new EQApplicationPacket(OP_Weblink, sizeof(Weblink_Struct) + str.length() + 1);
Weblink_Struct *wl = (Weblink_Struct*)outapp->pBuffer;
memcpy(wl->weblink, str.c_str(), str.length() + 1);
wl->weblink[str.length() + 1] = '\0';
FastQueuePacket(&outapp);
FastQueuePacket(&outapp);
}
}
void Client::SendMercPersonalInfo()
{
uint32 mercTypeCount = 1;
uint32 mercCount = 1; //TODO: Un-hardcode this and support multiple mercs like in later clients than SoD.
//uint32 packetSize = 0;
uint32 i=0;
uint32 altCurrentType = 19; //TODO: Implement alternate currency purchases involving mercs!
uint32 mercTypeCount = 1;
uint32 mercCount = 1; //TODO: Un-hardcode this and support multiple mercs like in later clients than SoD.
//uint32 packetSize = 0;
uint32 i=0;
uint32 altCurrentType = 19; //TODO: Implement alternate currency purchases involving mercs!
if (GetClientVersion() >= EQClientRoF)
{
@@ -7183,7 +7181,7 @@ void Client::SendMercPersonalInfo()
uint32 stanceindex = 0;
if (mdus->MercData[i].StanceCount != 0)
{
list<MercStanceInfo>::iterator iter = zone->merc_stance_list[mercData->MercTemplateID].begin();
std::list<MercStanceInfo>::iterator iter = zone->merc_stance_list[mercData->MercTemplateID].begin();
while(iter != zone->merc_stance_list[mercData->MercTemplateID].end())
{
mdus->MercData[i].Stances[stanceindex].StanceIndex = stanceindex;
@@ -7249,7 +7247,7 @@ void Client::SendMercPersonalInfo()
int stanceindex = 0;
if(mml->Mercs[i].StanceCount != 0)
{
list<MercStanceInfo>::iterator iter = zone->merc_stance_list[mercData->MercTemplateID].begin();
std::list<MercStanceInfo>::iterator iter = zone->merc_stance_list[mercData->MercTemplateID].begin();
while(iter != zone->merc_stance_list[mercData->MercTemplateID].end())
{
mml->Mercs[i].Stances[stanceindex].StanceIndex = stanceindex;
+22 -19
View File
@@ -19,6 +19,8 @@
#define CLIENT_H
class Client;
#include "../common/timer.h"
#include "../common/ptimer.h"
#include "../common/emu_opcodes.h"
@@ -49,6 +51,7 @@ class Client;
#include "../common/item_struct.h"
#include "../common/clientversions.h"
#include "QGlobals.h"
#include <algorithm>
#define CLIENT_TIMEOUT 90000
#define CLIENT_LD_TIMEOUT 30000 // length of time client stays in zone after LDing
@@ -708,7 +711,7 @@ public:
void ChangeTributeSettings(TributeInfo_Struct *t);
void SendTributeTimer();
void ToggleTribute(bool enabled);
void SendPathPacket(vector<FindPerson_Point> &path);
void SendPathPacket(std::vector<FindPerson_Point> &path);
inline PTimerList &GetPTimers() { return(p_timers); }
@@ -863,7 +866,7 @@ public:
bool PendingTranslocate;
time_t TranslocateTime;
bool PendingSacrifice;
string SacrificeCaster;
std::string SacrificeCaster;
struct Translocate_Struct PendingTranslocateData;
void SendOPTranslocateConfirm(Mob *Caster, uint16 SpellID);
@@ -1100,18 +1103,18 @@ public:
void DuplicateLoreMessage(uint32 ItemID);
void GarbleMessage(char *, uint8);
void TickItemCheck();
void TickItemCheck();
void TryItemTick(int slot);
int16 GetActSTR() { return( min(GetMaxSTR(), GetSTR()) ); }
int16 GetActSTA() { return( min(GetMaxSTA(), GetSTA()) ); }
int16 GetActDEX() { return( min(GetMaxDEX(), GetDEX()) ); }
int16 GetActAGI() { return( min(GetMaxAGI(), GetAGI()) ); }
int16 GetActINT() { return( min(GetMaxINT(), GetINT()) ); }
int16 GetActWIS() { return( min(GetMaxWIS(), GetWIS()) ); }
int16 GetActCHA() { return( min(GetMaxCHA(), GetCHA()) ); }
void LoadAccountFlags();
void SetAccountFlag(std::string flag, std::string val);
std::string GetAccountFlag(std::string flag); float GetDamageMultiplier(SkillType);
int16 GetActSTR() { return( std::min(GetMaxSTR(), GetSTR()) ); }
int16 GetActSTA() { return( std::min(GetMaxSTA(), GetSTA()) ); }
int16 GetActDEX() { return( std::min(GetMaxDEX(), GetDEX()) ); }
int16 GetActAGI() { return( std::min(GetMaxAGI(), GetAGI()) ); }
int16 GetActINT() { return( std::min(GetMaxINT(), GetINT()) ); }
int16 GetActWIS() { return( std::min(GetMaxWIS(), GetWIS()) ); }
int16 GetActCHA() { return( std::min(GetMaxCHA(), GetCHA()) ); }
void LoadAccountFlags();
void SetAccountFlag(std::string flag, std::string val);
std::string GetAccountFlag(std::string flag); float GetDamageMultiplier(SkillType);
int mod_client_damage(int damage, SkillType skillinuse, int hand, ItemInst* weapon, Mob* other);
bool mod_client_message(char* message, uint8 chan_num);
bool mod_can_increase_skill(SkillType skillid, Mob* against_who);
@@ -1268,7 +1271,7 @@ private:
uint8 mercSlot; // selected merc slot
bool Trader;
bool Buyer;
string BuyerWelcomeMessage;
std::string BuyerWelcomeMessage;
bool AbilityTimer;
int Haste; //precalced value
@@ -1360,7 +1363,7 @@ private:
uint32 max_AAXP;
uint32 staminacount;
AA_Array* aa[MAX_PP_AA_ARRAY]; //this list contains pointers into our player profile
map<uint32,uint8> aa_points;
std::map<uint32,uint8> aa_points;
bool npcflag;
uint8 npclevel;
bool feigned;
@@ -1376,7 +1379,7 @@ private:
unsigned int RestRegenMana;
unsigned int RestRegenEndurance;
set<uint32> zone_flags;
std::set<uint32> zone_flags;
ClientTaskState *taskstate;
int TotalSecondsPlayed;
@@ -1425,14 +1428,14 @@ private:
std::set<uint32> PlayerBlockedBuffs;
std::set<uint32> PetBlockedBuffs;
std::list<string> DraggedCorpses;
std::list<std::string> DraggedCorpses;
uint8 MaxXTargets;
bool XTargetAutoAddHaters;
struct XTarget_Struct XTargets[XTARGET_HARDCAP];
struct XTarget_Struct XTargets[XTARGET_HARDCAP];
Timer ItemTickTimer;
Timer ItemTickTimer;
std::map<std::string,std::string> accountflags;
};
+3 -3
View File
@@ -35,7 +35,7 @@ void ClientLogs::subscribe(EQEMuLog::LogIDs id, Client *c) {
//make sure they arnt allready subscribed.
vector<Client *>::iterator cur,end;
std::vector<Client *>::iterator cur,end;
cur = entries[id].begin();
end = entries[id].end();
for(; cur != end; cur++) {
@@ -55,7 +55,7 @@ void ClientLogs::unsubscribe(EQEMuLog::LogIDs id, Client *c) {
if(c == nullptr)
return;
vector<Client *>::iterator cur,end;
std::vector<Client *>::iterator cur,end;
cur = entries[id].begin();
end = entries[id].end();
for(; cur != end; cur++) {
@@ -94,7 +94,7 @@ void ClientLogs::clear() {
void ClientLogs::msg(EQEMuLog::LogIDs id, const char *buf) {
if(id >= EQEMuLog::MaxLogID)
return;
vector<Client *>::iterator cur,end;
std::vector<Client *>::iterator cur,end;
cur = entries[id].begin();
end = entries[id].end();
for(; cur != end; cur++) {
+1 -2
View File
@@ -30,7 +30,6 @@
#define MAX_CLIENT_LOG_MESSAGE_LENGTH 512
#include <vector>
using namespace std;
class Client;
@@ -50,7 +49,7 @@ public:
protected:
vector<Client *> entries[EQEMuLog::MaxLogID];
std::vector<Client *> entries[EQEMuLog::MaxLogID];
static char _buffer[MAX_CLIENT_LOG_MESSAGE_LENGTH+1];
};
+1 -1
View File
@@ -1997,7 +1997,7 @@ int32 Client::CalcBaseEndurance()
int BonusUpto800 = int( at_most_800 / 4 ) ;
if(Stats > 400) {
Bonus400to800 = int( (at_most_800 - 400) / 4 );
HalfBonus400to800 = int( max( ( at_most_800 - 400 ), 0 ) / 8 );
HalfBonus400to800 = int( std::max( ( at_most_800 - 400 ), 0 ) / 8 );
if(Stats > 800) {
Bonus800plus = int( (Stats - 800) / 8 ) * 2;
+59 -65
View File
@@ -29,9 +29,6 @@
#ifdef _WINDOWS
#define snprintf _snprintf
#if (_MSC_VER < 1500)
#define vsnprintf _vsnprintf
#endif
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#else
@@ -48,7 +45,7 @@
#include "worldserver.h"
#include "../common/rdtsc.h"
#include "../common/packet_dump_file.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/breakdowns.h"
#include "../common/guilds.h"
#include "../common/rulesys.h"
@@ -73,9 +70,6 @@
#include "../common/ZoneNumbers.h"
#include "QuestParserCollection.h"
using namespace std;
extern Zone* zone;
extern volatile bool ZoneLoaded;
extern WorldServer worldserver;
@@ -87,7 +81,7 @@ extern DBAsync *dbasync;
typedef void (Client::*ClientPacketProc)(const EQApplicationPacket *app);
//Use a map for connecting opcodes since it dosent get used a lot and is sparse
map<uint32, ClientPacketProc> ConnectingOpcodes;
std::map<uint32, ClientPacketProc> ConnectingOpcodes;
//Use a static array for connected, for speed
ClientPacketProc ConnectedOpcodes[_maxEmuOpcode];
@@ -411,14 +405,14 @@ int Client::HandlePacket(const EQApplicationPacket *app)
}
#if EQDEBUG >= 9
cout << "Received 0x" << hex << setw(4) << setfill('0') << opcode << ", size=" << dec << app->size << endl;
std::cout << "Received 0x" << hex << setw(4) << setfill('0') << opcode << ", size=" << dec << app->size << std::endl;
#endif
#ifdef SOLAR
if(0 && opcode != OP_ClientUpdate)
{
LogFile->write(EQEMuLog::Debug,"HandlePacket() OPCODE debug enabled client %s", GetName());
cerr << "OPCODE: " << hex << setw(4) << setfill('0') << opcode << dec << ", size: " << app->size << endl;
std::cerr << "OPCODE: " << hex << setw(4) << setfill('0') << opcode << dec << ", size: " << app->size << std::endl;
DumpPacket(app);
}
#endif
@@ -429,7 +423,7 @@ int Client::HandlePacket(const EQApplicationPacket *app)
//TODO: replace this 0 with the EQ opcode
LogFile->write(EQEMuLog::Error, "HandlePacket() Opcode error: Unexpected packet during CLIENT_CONNECTING: opcode: %s (#%d eq=0x%04x), size: %i", OpcodeNames[opcode], opcode, 0, app->size);
#if EQDEBUG >= 9
cout << "Unexpected packet during CLIENT_CONNECTING: OpCode: 0x" << hex << setw(4) << setfill('0') << opcode << dec << ", size: " << app->size << endl;
std::cout << "Unexpected packet during CLIENT_CONNECTING: OpCode: 0x" << hex << setw(4) << setfill('0') << opcode << dec << ", size: " << app->size << std::endl;
DumpPacket(app);
#endif
break;
@@ -458,7 +452,7 @@ int Client::HandlePacket(const EQApplicationPacket *app)
if(app->size<1000)
DumpPacket(app->pBuffer, app->size);
else{
cout << "Dump limited to 1000 characters:\n";
std::cout << "Dump limited to 1000 characters:\n";
DumpPacket(app->pBuffer, 1000);
}
break;
@@ -2978,7 +2972,7 @@ void Client::Handle_OP_RequestDuel(const EQApplicationPacket *app)
void Client::Handle_OP_SpawnAppearance(const EQApplicationPacket *app)
{
if (app->size != sizeof(SpawnAppearance_Struct)) {
cout << "Wrong size on OP_SpawnAppearance. Got: " << app->size << ", Expected: " << sizeof(SpawnAppearance_Struct) << endl;
std::cout << "Wrong size on OP_SpawnAppearance. Got: " << app->size << ", Expected: " << sizeof(SpawnAppearance_Struct) << std::endl;
return;
}
SpawnAppearance_Struct* sa = (SpawnAppearance_Struct*)app->pBuffer;
@@ -3053,7 +3047,7 @@ void Client::Handle_OP_SpawnAppearance(const EQApplicationPacket *app)
}
*/
else {
cerr << "Client " << name << " unknown apperance " << (int)sa->parameter << endl;
std::cerr << "Client " << name << " unknown apperance " << (int)sa->parameter << std::endl;
return;
}
@@ -3071,7 +3065,7 @@ void Client::Handle_OP_SpawnAppearance(const EQApplicationPacket *app)
m_pp.anon = 0;
}
else {
cerr << "Client " << name << " unknown Anon/Roleplay Switch " << (int)sa->parameter << endl;
std::cerr << "Client " << name << " unknown Anon/Roleplay Switch " << (int)sa->parameter << std::endl;
return;
}
entity_list.QueueClients(this, app, true);
@@ -3124,8 +3118,8 @@ void Client::Handle_OP_SpawnAppearance(const EQApplicationPacket *app)
entity_list.QueueClients(this, app, true);
}
else {
cout << "Unknown SpawnAppearance type: 0x" << hex << setw(4) << setfill('0') << sa->type << dec
<< " value: 0x" << hex << setw(8) << setfill('0') << sa->parameter << dec << endl;
std::cout << "Unknown SpawnAppearance type: 0x" << std::hex << std::setw(4) << std::setfill('0') << sa->type << std::dec
<< " value: 0x" << std::hex << std::setw(8) << std::setfill('0') << sa->parameter << std::dec << std::endl;
}
return;
}
@@ -3205,7 +3199,7 @@ void Client::Handle_OP_ItemLinkClick(const EQApplicationPacket *app)
if (!item) {
if (ivrs->item_id > 500000)
{
string response = "";
std::string response = "";
int sayid = ivrs->item_id - 500000;
bool silentsaylink = false;
@@ -3569,7 +3563,7 @@ void Client::Handle_OP_ChannelMessage(const EQApplicationPacket *app)
ChannelMessage_Struct* cm=(ChannelMessage_Struct*)app->pBuffer;
if (app->size < sizeof(ChannelMessage_Struct)) {
cout << "Wrong size " << app->size << ", should be " << sizeof(ChannelMessage_Struct) << "+ on 0x" << hex << setfill('0') << setw(4) << app->GetOpcode() << dec << endl;
std::cout << "Wrong size " << app->size << ", should be " << sizeof(ChannelMessage_Struct) << "+ on 0x" << std::hex << std::setfill('0') << std::setw(4) << app->GetOpcode() << std::dec << std::endl;
return;
}
if (IsAIControlled()) {
@@ -3584,7 +3578,7 @@ void Client::Handle_OP_ChannelMessage(const EQApplicationPacket *app)
void Client::Handle_OP_WearChange(const EQApplicationPacket *app)
{
if (app->size != sizeof(WearChange_Struct)) {
cout << "Wrong size: OP_WearChange, size=" << app->size << ", expected " << sizeof(WearChange_Struct) << endl;
std::cout << "Wrong size: OP_WearChange, size=" << app->size << ", expected " << sizeof(WearChange_Struct) << std::endl;
return;
}
@@ -3638,7 +3632,7 @@ void Client::Handle_OP_Save(const EQApplicationPacket *app)
void Client::Handle_OP_WhoAllRequest(const EQApplicationPacket *app)
{
if (app->size != sizeof(Who_All_Struct)) {
cout << "Wrong size on OP_WhoAll. Got: " << app->size << ", Expected: " << sizeof(Who_All_Struct) << endl;
std::cout << "Wrong size on OP_WhoAll. Got: " << app->size << ", Expected: " << sizeof(Who_All_Struct) << std::endl;
return;
}
Who_All_Struct* whoall = (Who_All_Struct*) app->pBuffer;
@@ -3660,7 +3654,7 @@ void Client::Handle_OP_FriendsWho(const EQApplicationPacket *app)
void Client::Handle_OP_GMZoneRequest(const EQApplicationPacket *app)
{
if (app->size != sizeof(GMZoneRequest_Struct)) {
cout << "Wrong size on OP_GMZoneRequest. Got: " << app->size << ", Expected: " << sizeof(GMZoneRequest_Struct) << endl;
std::cout << "Wrong size on OP_GMZoneRequest. Got: " << app->size << ", Expected: " << sizeof(GMZoneRequest_Struct) << std::endl;
return;
}
if (this->Admin() < minStatusToBeGM) {
@@ -3700,7 +3694,7 @@ void Client::Handle_OP_GMZoneRequest(const EQApplicationPacket *app)
if (tarzone[0] != 0 && admin >= minstatus && GetLevel() >= minlevel)
gmzr2->success = 1;
else {
cout << "GetZoneSafeCoords failed. zoneid = " << gmzr->zone_id << "; czone = " << zone->GetZoneID() << endl;
std::cout << "GetZoneSafeCoords failed. zoneid = " << gmzr->zone_id << "; czone = " << zone->GetZoneID() << std::endl;
gmzr2->success = 0;
}
@@ -3729,7 +3723,7 @@ void Client::Handle_OP_GMZoneRequest2(const EQApplicationPacket *app)
void Client::Handle_OP_EndLootRequest(const EQApplicationPacket *app)
{
if (app->size != sizeof(uint32)) {
cout << "Wrong size: OP_EndLootRequest, size=" << app->size << ", expected " << sizeof(uint32) << endl;
std::cout << "Wrong size: OP_EndLootRequest, size=" << app->size << ", expected " << sizeof(uint32) << std::endl;
return;
}
@@ -3758,7 +3752,7 @@ void Client::Handle_OP_EndLootRequest(const EQApplicationPacket *app)
void Client::Handle_OP_LootRequest(const EQApplicationPacket *app)
{
if (app->size != sizeof(uint32)) {
cout << "Wrong size: OP_LootRequest, size=" << app->size << ", expected " << sizeof(uint32) << endl;
std::cout << "Wrong size: OP_LootRequest, size=" << app->size << ", expected " << sizeof(uint32) << std::endl;
return;
}
@@ -3809,7 +3803,7 @@ void Client::Handle_OP_LootRequest(const EQApplicationPacket *app)
return;
}
else {
cout << "npc == 0 LOOTING FOOKED3" << endl;
std::cout << "npc == 0 LOOTING FOOKED3" << std::endl;
Message(13, "Error: OP_LootRequest: Corpse not a corpse?");
Corpse::SendLootReqErrorPacket(this);
}
@@ -4237,7 +4231,7 @@ void Client::Handle_OP_GuildInvite(const EQApplicationPacket *app)
mpkt(GUILDS__IN_PACKET_TRACE, app);
if (app->size != sizeof(GuildCommand_Struct)) {
cout << "Wrong size: OP_GuildInvite, size=" << app->size << ", expected " << sizeof(GuildCommand_Struct) << endl;
std::cout << "Wrong size: OP_GuildInvite, size=" << app->size << ", expected " << sizeof(GuildCommand_Struct) << std::endl;
return;
}
@@ -4364,7 +4358,7 @@ void Client::Handle_OP_GuildRemove(const EQApplicationPacket *app)
mpkt(GUILDS__IN_PACKET_TRACE, app);
if (app->size != sizeof(GuildCommand_Struct)) {
cout << "Wrong size: OP_GuildRemove, size=" << app->size << ", expected " << sizeof(GuildCommand_Struct) << endl;
std::cout << "Wrong size: OP_GuildRemove, size=" << app->size << ", expected " << sizeof(GuildCommand_Struct) << std::endl;
return;
}
GuildCommand_Struct* gc = (GuildCommand_Struct*) app->pBuffer;
@@ -4435,7 +4429,7 @@ void Client::Handle_OP_GuildInviteAccept(const EQApplicationPacket *app)
SetPendingGuildInvitation(false);
if (app->size != sizeof(GuildInviteAccept_Struct)) {
cout << "Wrong size: OP_GuildInviteAccept, size=" << app->size << ", expected " << sizeof(GuildJoin_Struct) << endl;
std::cout << "Wrong size: OP_GuildInviteAccept, size=" << app->size << ", expected " << sizeof(GuildJoin_Struct) << std::endl;
return;
}
@@ -4527,7 +4521,7 @@ void Client::Handle_OP_MemorizeSpell(const EQApplicationPacket *app)
void Client::Handle_OP_SwapSpell(const EQApplicationPacket *app)
{
if (app->size != sizeof(SwapSpell_Struct)) {
cout << "Wrong size on OP_SwapSpell. Got: " << app->size << ", Expected: " << sizeof(SwapSpell_Struct) << endl;
std::cout << "Wrong size on OP_SwapSpell. Got: " << app->size << ", Expected: " << sizeof(SwapSpell_Struct) << std::endl;
return;
}
const SwapSpell_Struct* swapspell = (const SwapSpell_Struct*) app->pBuffer;
@@ -4547,7 +4541,7 @@ void Client::Handle_OP_SwapSpell(const EQApplicationPacket *app)
void Client::Handle_OP_CastSpell(const EQApplicationPacket *app)
{
if (app->size != sizeof(CastSpell_Struct)) {
cout << "Wrong size: OP_CastSpell, size=" << app->size << ", expected " << sizeof(CastSpell_Struct) << endl;
std::cout << "Wrong size: OP_CastSpell, size=" << app->size << ", expected " << sizeof(CastSpell_Struct) << std::endl;
return;
}
if (IsAIControlled()) {
@@ -4727,7 +4721,7 @@ LogFile->write(EQEMuLog::Debug, "OP CastSpell: slot=%d, spell=%d, target=%d, inv
void Client::Handle_OP_DeleteItem(const EQApplicationPacket *app)
{
if (app->size != sizeof(DeleteItem_Struct)) {
cout << "Wrong size on OP_DeleteItem. Got: " << app->size << ", Expected: " << sizeof(DeleteItem_Struct) << endl;
std::cout << "Wrong size on OP_DeleteItem. Got: " << app->size << ", Expected: " << sizeof(DeleteItem_Struct) << std::endl;
return;
}
@@ -4761,7 +4755,7 @@ void Client::Handle_OP_DeleteItem(const EQApplicationPacket *app)
void Client::Handle_OP_CombatAbility(const EQApplicationPacket *app)
{
if (app->size != sizeof(CombatAbility_Struct)) {
cout << "Wrong size on OP_CombatAbility. Got: " << app->size << ", Expected: " << sizeof(CombatAbility_Struct) << endl;
std::cout << "Wrong size on OP_CombatAbility. Got: " << app->size << ", Expected: " << sizeof(CombatAbility_Struct) << std::endl;
return;
}
OPCombatAbility(app);
@@ -4771,7 +4765,7 @@ void Client::Handle_OP_CombatAbility(const EQApplicationPacket *app)
void Client::Handle_OP_Taunt(const EQApplicationPacket *app)
{
if (app->size != sizeof(ClientTarget_Struct)) {
cout << "Wrong size on OP_Taunt. Got: " << app->size << ", Expected: "<< sizeof(ClientTarget_Struct) << endl;
std::cout << "Wrong size on OP_Taunt. Got: " << app->size << ", Expected: "<< sizeof(ClientTarget_Struct) << std::endl;
return;
}
@@ -4830,7 +4824,7 @@ void Client::Handle_OP_RezzAnswer(const EQApplicationPacket *app)
void Client::Handle_OP_GMSummon(const EQApplicationPacket *app)
{
if (app->size != sizeof(GMSummon_Struct)) {
cout << "Wrong size on OP_GMSummon. Got: " << app->size << ", Expected: " << sizeof(GMSummon_Struct) << endl;
std::cout << "Wrong size on OP_GMSummon. Got: " << app->size << ", Expected: " << sizeof(GMSummon_Struct) << std::endl;
return;
}
OPGMSummon(app);
@@ -5230,7 +5224,7 @@ void Client::Handle_OP_GMKill(const EQApplicationPacket *app)
void Client::Handle_OP_GMLastName(const EQApplicationPacket *app)
{
if (app->size != sizeof(GMLastName_Struct)) {
cout << "Wrong size on OP_GMLastName. Got: " << app->size << ", Expected: " << sizeof(GMLastName_Struct) << endl;
std::cout << "Wrong size on OP_GMLastName. Got: " << app->size << ", Expected: " << sizeof(GMLastName_Struct) << std::endl;
return;
}
GMLastName_Struct* gmln = (GMLastName_Struct*) app->pBuffer;
@@ -5264,7 +5258,7 @@ void Client::Handle_OP_GMLastName(const EQApplicationPacket *app)
void Client::Handle_OP_GMToggle(const EQApplicationPacket *app)
{
if (app->size != sizeof(GMToggle_Struct)) {
cout << "Wrong size on OP_GMToggle. Got: " << app->size << ", Expected: " << sizeof(GMToggle_Struct) << endl;
std::cout << "Wrong size on OP_GMToggle. Got: " << app->size << ", Expected: " << sizeof(GMToggle_Struct) << std::endl;
return;
}
if (this->Admin() < minStatusToUseGMCommands) {
@@ -5293,7 +5287,7 @@ void Client::Handle_OP_GMToggle(const EQApplicationPacket *app)
void Client::Handle_OP_LFGCommand(const EQApplicationPacket *app)
{
if (app->size != sizeof(LFG_Struct)) {
cout << "Wrong size on OP_LFGCommand. Got: " << app->size << ", Expected: " << sizeof(LFG_Struct) << endl;
std::cout << "Wrong size on OP_LFGCommand. Got: " << app->size << ", Expected: " << sizeof(LFG_Struct) << std::endl;
DumpPacket(app);
return;
}
@@ -5339,7 +5333,7 @@ void Client::Handle_OP_LFGCommand(const EQApplicationPacket *app)
void Client::Handle_OP_GMGoto(const EQApplicationPacket *app)
{
if (app->size != sizeof(GMSummon_Struct)) {
cout << "Wrong size on OP_GMGoto. Got: " << app->size << ", Expected: " << sizeof(GMSummon_Struct) << endl;
std::cout << "Wrong size on OP_GMGoto. Got: " << app->size << ", Expected: " << sizeof(GMSummon_Struct) << std::endl;
return;
}
if (this->Admin() < minStatusToUseGMCommands) {
@@ -5709,7 +5703,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app)
return;
}
string packet;
std::string packet;
if(mp->quantity==1 && item->MaxCharges>0 && item->MaxCharges<255)
mp->quantity=item->MaxCharges;
@@ -5791,7 +5785,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app)
}
t1.stop();
cout << "At 1: " << t1.getDuration() << endl;
std::cout << "At 1: " << t1.getDuration() << std::endl;
return;
}
@@ -5936,7 +5930,7 @@ void Client::Handle_OP_ShopPlayerSell(const EQApplicationPacket *app)
t1.start();
Save(1);
t1.stop();
cout << "Save took: " << t1.getDuration() << endl;
std::cout << "Save took: " << t1.getDuration() << std::endl;
return;
}
@@ -7038,7 +7032,7 @@ void Client::Handle_OP_PetitionDelete(const EQApplicationPacket *app)
FastQueuePacket(&outapp);
if (petition_list.DeletePetition(pet->petnumber) == -1)
cout << "Something is borked with: " << pet->petnumber << endl;
std::cout << "Something is borked with: " << pet->petnumber << std::endl;
petition_list.ClearPetitions();
petition_list.UpdateGMQueue();
petition_list.ReadDatabase();
@@ -7320,7 +7314,7 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app)
void Client::Handle_OP_PetitionUnCheckout(const EQApplicationPacket *app)
{
if (app->size != sizeof(uint32)) {
cout << "Wrong size: OP_PetitionUnCheckout, size=" << app->size << ", expected " << sizeof(uint32) << endl;
std::cout << "Wrong size: OP_PetitionUnCheckout, size=" << app->size << ", expected " << sizeof(uint32) << std::endl;
return;
}
if (!worldserver.Connected())
@@ -7362,7 +7356,7 @@ void Client::Handle_OP_PDeletePetition(const EQApplicationPacket *app)
void Client::Handle_OP_PetitionCheckout(const EQApplicationPacket *app)
{
if (app->size != sizeof(uint32)) {
cout << "Wrong size: OP_PetitionCheckout, size=" << app->size << ", expected " << sizeof(uint32) << endl;
std::cout << "Wrong size: OP_PetitionCheckout, size=" << app->size << ", expected " << sizeof(uint32) << std::endl;
return;
}
if (!worldserver.Connected())
@@ -7506,7 +7500,7 @@ void Client::Handle_OP_GMDelCorpse(const EQApplicationPacket *app)
return;
}
corpse->CastToCorpse()->Delete();
cout << name << " deleted corpse " << dc->corpsename << endl;
std::cout << name << " deleted corpse " << dc->corpsename << std::endl;
Message(13, "Corpse %s deleted.", dc->corpsename);
return;
}
@@ -8575,7 +8569,7 @@ void Client::Handle_OP_FindPersonRequest(const EQApplicationPacket *app)
else {
FindPersonRequest_Struct* t = (FindPersonRequest_Struct*)app->pBuffer;
vector<FindPerson_Point> points;
std::vector<FindPerson_Point> points;
Message(13, "Searched for NPC ID: %d\n", t->npc_id);
Mob* target = entity_list.GetMob(t->npc_id);
@@ -8626,7 +8620,7 @@ void Client::Handle_OP_FindPersonRequest(const EQApplicationPacket *app)
}
else
{
list<int> pathlist = zone->pathing->FindRoute(Start, End);
std::list<int> pathlist = zone->pathing->FindRoute(Start, End);
if(pathlist.size() == 0)
{
@@ -8665,7 +8659,7 @@ void Client::Handle_OP_FindPersonRequest(const EQApplicationPacket *app)
p.z = GetZ();
points.push_back(p);
for(list<int>::iterator Iterator = pathlist.begin(); Iterator != pathlist.end(); ++Iterator)
for(std::list<int>::iterator Iterator = pathlist.begin(); Iterator != pathlist.end(); ++Iterator)
{
if((*Iterator) == -1) // Teleporter
{
@@ -8716,7 +8710,7 @@ void Client::DBAWComplete(uint8 workpt_b1, DBAsyncWork* dbaw) {
}
}
else {
cout << "Async client save failed. '" << errbuf << "'" << endl;
std::cout << "Async client save failed. '" << errbuf << "'" << std::endl;
Message(13, "Error: Asyncronous save of your character failed.");
if (Admin() >= 200)
Message(13, "errbuf: %s", errbuf);
@@ -8725,7 +8719,7 @@ void Client::DBAWComplete(uint8 workpt_b1, DBAsyncWork* dbaw) {
break;
}
default: {
cout << "Error: Client::DBAWComplete(): Unknown workpt_b1" << endl;
std::cout << "Error: Client::DBAWComplete(): Unknown workpt_b1" << std::endl;
break;
}
}
@@ -8743,11 +8737,11 @@ bool Client::FinishConnState2(DBAsyncWork* dbaw) {
for (i=1; i<=3; i++) {
dbaq = dbaw->PopAnswer();
if (!dbaq) {
cout << "Error in FinishConnState2(): dbaq==0" << endl;
std::cout << "Error in FinishConnState2(): dbaq==0" << std::endl;
return false;
}
if (!dbaq->GetAnswer(errbuf, &result)) {
cout << "Error in FinishConnState2(): !dbaq[" << dbaq->QPT() << "]->GetAnswer(): " << errbuf << endl;
std::cout << "Error in FinishConnState2(): !dbaq[" << dbaq->QPT() << "]->GetAnswer(): " << errbuf << std::endl;
return false;
}
if (dbaq->QPT() == 1) {
@@ -8765,7 +8759,7 @@ bool Client::FinishConnState2(DBAsyncWork* dbaw) {
database.LoadFactionValues_result(result, factionvalues);
}
else {
cout << "Error in FinishConnState2(): dbaq->PQT() unknown" << endl;
std::cout << "Error in FinishConnState2(): dbaq->PQT() unknown" << std::endl;
return false;
}
}
@@ -9775,7 +9769,7 @@ void Client::Handle_OP_SetTitle(const EQApplicationPacket *app)
SetTitle_Struct *sts = (SetTitle_Struct *)app->pBuffer;
string Title;
std::string Title;
if(!sts->is_suffix)
{
@@ -11582,8 +11576,8 @@ void Client::Handle_OP_Report(const EQApplicationPacket *app)
uint32 size = app->size;
uint32 current_point = 0;
string reported, reporter;
string current_string;
std::string reported, reporter;
std::string current_string;
int mode = 0;
while(current_point < size)
@@ -11720,7 +11714,7 @@ void Client::Handle_OP_GMSearchCorpse(const EQApplicationPacket *app)
char CharName[64], TimeOfDeath[20], Buffer[512];
string PopupText = "<table><tr><td>Name</td><td>Zone</td><td>X</td><td>Y</td><td>Z</td><td>Date</td><td>"
std::string PopupText = "<table><tr><td>Name</td><td>Zone</td><td>X</td><td>Y</td><td>Z</td><td>Date</td><td>"
"Rezzed</td><td>Buried</td></tr><tr><td>&nbsp</td><td></td><td></td><td></td><td></td><td>"
"</td><td></td><td></td></tr>";
@@ -12468,7 +12462,7 @@ void Client::Handle_OP_CorpseDrop(const EQApplicationPacket *app)
return;
}
for(std::list<string>::iterator Iterator = DraggedCorpses.begin(); Iterator != DraggedCorpses.end(); ++Iterator)
for(std::list<std::string>::iterator Iterator = DraggedCorpses.begin(); Iterator != DraggedCorpses.end(); ++Iterator)
{
if(!strcasecmp((*Iterator).c_str(), (const char *)app->pBuffer))
{
@@ -12594,7 +12588,7 @@ void Client::Handle_OP_AltCurrencyMerchantRequest(const EQApplicationPacket *app
return;
}
list<AltCurrencyDefinition_Struct>::iterator altc_iter = zone->AlternateCurrencies.begin();
std::list<AltCurrencyDefinition_Struct>::iterator altc_iter = zone->AlternateCurrencies.begin();
bool found = false;
while(altc_iter != zone->AlternateCurrencies.end()) {
if((*altc_iter).id == alt_cur_id) {
@@ -12803,7 +12797,7 @@ void Client::Handle_OP_AltCurrencyReclaim(const EQApplicationPacket *app) {
VERIFY_PACKET_LENGTH(OP_AltCurrencyReclaim, app, AltCurrencyReclaim_Struct);
AltCurrencyReclaim_Struct *reclaim = (AltCurrencyReclaim_Struct*)app->pBuffer;
uint32 item_id = 0;
list<AltCurrencyDefinition_Struct>::iterator iter = zone->AlternateCurrencies.begin();
std::list<AltCurrencyDefinition_Struct>::iterator iter = zone->AlternateCurrencies.begin();
while(iter != zone->AlternateCurrencies.end()) {
if((*iter).id == reclaim->currency_id) {
item_id = (*iter).item_id;
@@ -13557,7 +13551,7 @@ void Client::Handle_OP_MercenaryDataRequest(const EQApplicationPacket *app)
for(std::list<MercData>::iterator mercListItr = mercDataList.begin(); mercListItr != mercDataList.end(); mercListItr++)
{
list<MercStanceInfo>::iterator siter = zone->merc_stance_list[mercListItr->MercTemplateID].begin();
std::list<MercStanceInfo>::iterator siter = zone->merc_stance_list[mercListItr->MercTemplateID].begin();
for(siter = zone->merc_stance_list[mercListItr->MercTemplateID].begin(); siter != zone->merc_stance_list[mercListItr->MercTemplateID].end(); siter++)
{
StanceCount++;
@@ -13596,7 +13590,7 @@ void Client::Handle_OP_MercenaryDataRequest(const EQApplicationPacket *app)
mml->Mercs[i].MerchantSlot = i + 1;
mml->Mercs[i].MercUnk02 = 1;
int mercStanceCount = 0;
list<MercStanceInfo>::iterator iter = zone->merc_stance_list[mercListIter->MercTemplateID].begin();
std::list<MercStanceInfo>::iterator iter = zone->merc_stance_list[mercListIter->MercTemplateID].begin();
for(iter = zone->merc_stance_list[mercListIter->MercTemplateID].begin(); iter != zone->merc_stance_list[mercListIter->MercTemplateID].end(); iter++)
{
mercStanceCount++;
@@ -13608,7 +13602,7 @@ void Client::Handle_OP_MercenaryDataRequest(const EQApplicationPacket *app)
int stanceindex = 0;
if(mercStanceCount > 0)
{
list<MercStanceInfo>::iterator iter2 = zone->merc_stance_list[mercListIter->MercTemplateID].begin();
std::list<MercStanceInfo>::iterator iter2 = zone->merc_stance_list[mercListIter->MercTemplateID].begin();
while(iter2 != zone->merc_stance_list[mercListIter->MercTemplateID].end())
{
mml->Mercs[i].Stances[stanceindex].StanceIndex = stanceindex;
@@ -13746,7 +13740,7 @@ void Client::Handle_OP_MercenaryCommand(const EQApplicationPacket *app)
//get number of available stances for the current merc
std::list<MercStanceInfo> mercStanceList = zone->merc_stance_list[merc->GetMercTemplateID()];
list<MercStanceInfo>::iterator iter = mercStanceList.begin();
std::list<MercStanceInfo>::iterator iter = mercStanceList.begin();
while(iter != mercStanceList.end()) {
numStances++;
iter++;
+13 -19
View File
@@ -32,9 +32,6 @@
#include <windows.h>
#include <winsock.h>
#define snprintf _snprintf
#if (_MSC_VER < 1500)
#define vsnprintf _vsnprintf
#endif
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#else
@@ -50,7 +47,7 @@
#include "../common/packet_dump.h"
#include "worldserver.h"
#include "../common/packet_dump_file.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/spdat.h"
#include "petitions.h"
#include "NpcAI.h"
@@ -67,9 +64,6 @@
#include <string>
#include "QuestParserCollection.h"
using namespace std;
extern Zone* zone;
extern volatile bool ZoneLoaded;
extern WorldServer worldserver;
@@ -656,26 +650,26 @@ bool Client::Process() {
if (client_state == CLIENT_KICKED) {
Save();
OnDisconnect(true);
cout << "Client disconnected (cs=k): " << GetName() << endl;
std::cout << "Client disconnected (cs=k): " << GetName() << std::endl;
return false;
}
if (client_state == DISCONNECTED) {
OnDisconnect(true);
cout << "Client disconnected (cs=d): " << GetName() << endl;
std::cout << "Client disconnected (cs=d): " << GetName() << std::endl;
database.SetMQDetectionFlag(this->AccountName(), GetName(), "/MQInstantCamp: Possible instant camp disconnect.", zone->GetShortName());
return false;
}
if (client_state == CLIENT_ERROR) {
OnDisconnect(true);
cout << "Client disconnected (cs=e): " << GetName() << endl;
std::cout << "Client disconnected (cs=e): " << GetName() << std::endl;
return false;
}
if (client_state != CLIENT_LINKDEAD && !eqs->CheckState(ESTABLISHED)) {
OnDisconnect(true);
cout << "Client linkdead: " << name << endl;
std::cout << "Client linkdead: " << name << std::endl;
if (GetGM()) {
if (GetMerc())
@@ -879,14 +873,14 @@ void Client::BulkSendInventoryItems() {
uint32 size = 0;
uint16 i = 0;
map<uint16, string> ser_items;
map<uint16, string>::iterator itr;
std::map<uint16, std::string> ser_items;
std::map<uint16, std::string>::iterator itr;
//Inventory items
for(slot_id = 0; slot_id <= 30; slot_id++) {
const ItemInst* inst = m_inv[slot_id];
if(inst) {
string packet = inst->Serialize(slot_id);
std::string packet = inst->Serialize(slot_id);
ser_items[i++] = packet;
size += packet.length();
}
@@ -896,7 +890,7 @@ void Client::BulkSendInventoryItems() {
if(GetClientVersion() >= EQClientSoF) {
const ItemInst* inst = m_inv[9999];
if(inst) {
string packet = inst->Serialize(9999);
std::string packet = inst->Serialize(9999);
ser_items[i++] = packet;
size += packet.length();
}
@@ -906,7 +900,7 @@ void Client::BulkSendInventoryItems() {
for(slot_id = 2000; slot_id <= 2023; slot_id++) {
const ItemInst* inst = m_inv[slot_id];
if(inst) {
string packet = inst->Serialize(slot_id);
std::string packet = inst->Serialize(slot_id);
ser_items[i++] = packet;
size += packet.length();
}
@@ -916,7 +910,7 @@ void Client::BulkSendInventoryItems() {
for(slot_id = 2500; slot_id <= 2501; slot_id++) {
const ItemInst* inst = m_inv[slot_id];
if(inst) {
string packet = inst->Serialize(slot_id);
std::string packet = inst->Serialize(slot_id);
ser_items[i++] = packet;
size += packet.length();
}
@@ -1693,7 +1687,7 @@ void Client::OPGMTrainSkill(const EQApplicationPacket *app)
// languages go here
if (gmskill->skill_id > 25)
{
cout << "Wrong Training Skill (languages)" << endl;
std::cout << "Wrong Training Skill (languages)" << std::endl;
DumpPacket(app);
return;
}
@@ -1708,7 +1702,7 @@ void Client::OPGMTrainSkill(const EQApplicationPacket *app)
// normal skills go here
if (gmskill->skill_id > HIGHEST_SKILL)
{
cout << "Wrong Training Skill (abilities)" << endl;
std::cout << "Wrong Training Skill (abilities)" << std::endl;
DumpPacket(app);
return;
}
+14 -14
View File
@@ -50,7 +50,7 @@
#include "../common/EQPacket.h"
#include "../common/guilds.h"
#include "../common/rulesys.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
//#include "../common/servertalk.h" // for oocmute and revoke
#include "worldserver.h"
#include "masterentity.h"
@@ -85,7 +85,7 @@ int (*command_dispatch)(Client *,char const *)=command_notavail;
void command_bestz(Client *c, const Seperator *message);
void command_pf(Client *c, const Seperator *message);
map<string, CommandRecord *> commandlist;
std::map<std::string, CommandRecord *> commandlist;
//All allocated CommandRecords get put in here so they get deleted on shutdown
LinkedList<CommandRecord *> cleanup_commandlist;
@@ -452,11 +452,11 @@ int command_init(void) {
return -1;
}
map<string, CommandRecord *>::iterator cur,end;
std::map<std::string, CommandRecord *>::iterator cur,end;
cur = commandlist.begin();
end = commandlist.end();
map<string,uint8> command_settings;
map<string,uint8>::iterator itr;
std::map<std::string,uint8> command_settings;
std::map<std::string,uint8>::iterator itr;
database.GetCommandSettings(command_settings);
for(; cur != end; cur++) {
if ((itr=command_settings.find(cur->first))!=command_settings.end())
@@ -518,7 +518,7 @@ int command_add(const char *command_string, const char *desc, int access, CmdFun
if(function == nullptr)
return(-1);
string cstr(command_string);
std::string cstr(command_string);
if(commandlist.count(cstr) != 0) {
LogFile->write(EQEMuLog::Error, "command_add() - Command '%s' is a duplicate - check command.cpp." , command_string);
@@ -526,7 +526,7 @@ int command_add(const char *command_string, const char *desc, int access, CmdFun
}
//look for aliases...
map<string, CommandRecord *>::iterator cur,end,del;
std::map<std::string, CommandRecord *>::iterator cur,end,del;
cur = commandlist.begin();
end = commandlist.end();
for(; cur != end; cur++) {
@@ -578,7 +578,7 @@ int command_realdispatch(Client *c, const char *message)
command_logcommand(c, message);
string cstr(sep.arg[0]+1);
std::string cstr(sep.arg[0]+1);
if(commandlist.count(cstr) != 1) {
return(-2);
@@ -844,13 +844,13 @@ void command_help(Client *c, const Seperator *sep)
c->Message(0, "Available EQEMu commands:");
map<string, CommandRecord *>::iterator cur,end;
std::map<std::string, CommandRecord *>::iterator cur,end;
cur = commandlist.begin();
end = commandlist.end();
for(; cur != end; cur++) {
if(sep->arg[1][0]) {
if(cur->first.find(sep->arg[1]) == string::npos) {
if(cur->first.find(sep->arg[1]) == std::string::npos) {
continue;
}
}
@@ -6595,7 +6595,7 @@ void command_timers(Client *c, const Seperator *sep) {
}
Client *them = c->GetTarget()->CastToClient();
vector< pair<pTimerType, PersistentTimer *> > res;
std::vector< std::pair<pTimerType, PersistentTimer *> > res;
them->GetPTimers().ToVector(res);
c->Message(0,"Timers for target:");
@@ -8118,8 +8118,8 @@ void command_mlog(Client *c, const Seperator *sep) {
return;
}
bool onoff;
string on("on");
string off("off");
std::string on("on");
std::string off("off");
if(!strcasecmp(sep->arg[1], "target")) {
if(on == sep->arg[2]) onoff = true;
@@ -11458,4 +11458,4 @@ void command_questerrors(Client *c, const Seperator *sep)
++i;
++iter;
}
}
}
+7 -8
View File
@@ -19,14 +19,13 @@
#include <iostream>
#include <stdlib.h>
#include <string.h>
using namespace std;
#include "masterentity.h"
#include "worldserver.h"
#include "StringIDs.h"
#include "zonedb.h"
#include "../common/packet_functions.h"
#include "../common/packet_dump.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "guild_mgr.h"
#define OPEN_DOOR 0x02
@@ -243,7 +242,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger)
{ // guild doors
if((guild_id > 0) && !sender->GetGM())
{
string tmp;
std::string tmp;
char tmpmsg[240]; // guild doors msgs
if(guild_mgr.GetGuildNameByID(guild_id, tmp))
{
@@ -594,7 +593,7 @@ int32 ZoneDatabase::GetDoorsCount(uint32* oMaxID, const char *zone_name, int16 v
mysql_free_result(result);
}
else {
cerr << "Error in GetDoorsCount query '" << query << "' " << errbuf << endl;
std::cerr << "Error in GetDoorsCount query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return -1;
}
@@ -625,7 +624,7 @@ int32 ZoneDatabase::GetDoorsCountPlusOne(const char *zone_name, int16 version) {
mysql_free_result(result);
}
else {
cerr << "Error in GetDoorsCountPlusOne query '" << query << "' " << errbuf << endl;
std::cerr << "Error in GetDoorsCountPlusOne query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return -1;
}
@@ -656,7 +655,7 @@ int32 ZoneDatabase::GetDoorsDBCountPlusOne(const char *zone_name, int16 version)
mysql_free_result(result);
}
else {
cerr << "Error in GetDoorsCountPlusOne query '" << query << "' " << errbuf << endl;
std::cerr << "Error in GetDoorsCountPlusOne query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return -1;
}
@@ -681,7 +680,7 @@ bool ZoneDatabase::LoadDoors(int32 iDoorCount, Door *into, const char *zone_name
int32 r;
for(r = 0; (row = mysql_fetch_row(result)); r++) {
if(r >= iDoorCount) {
cerr << "Error, Door Count of " << iDoorCount << " exceeded." << endl;
std::cerr << "Error, Door Count of " << iDoorCount << " exceeded." << std::endl;
break;
}
memset(&into[r], 0, sizeof(Door));
@@ -717,7 +716,7 @@ bool ZoneDatabase::LoadDoors(int32 iDoorCount, Door *into, const char *zone_name
}
else
{
cerr << "Error in DBLoadDoors query '" << query << "' " << errbuf << endl;
std::cerr << "Error in DBLoadDoors query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return false;
}
+103
View File
@@ -24,8 +24,78 @@
#include "QuestInterface.h"
#include <string>
#include <queue>
<<<<<<< HEAD
#include <map>
#include "embperl.h"
=======
class Seperator;
typedef enum {
questDefault = 1,
questDefaultByZone,
questByName,
questTemplate,
questTemplateByID,
questByID
} questMode;
typedef enum {
itemQuestUnloaded = 1,
itemQuestScale,
itemQuestLore,
itemQuestID,
itemScriptFileID
} itemQuestMode;
typedef enum {
pQuestLoaded = 1,
pQuestUnloaded,
pQuestEventCast, // player.pl loaded, has an EVENT_CAST sub
pQuestReadyToLoad
} playerQuestMode;
typedef enum {
nQuestLoaded = 1,
nQuestUnloaded,
nQuestReadyToLoad
} GlobalNPCQuestMode;
typedef enum {
spellQuestUnloaded = 1,
spellQuestFullyLoaded,
spellQuestFailed
} spellQuestMode;
struct EventRecord {
QuestEventID event;
uint32 objid;
std::string data;
NPC* npcmob;
ItemInst* iteminst;
Mob* mob;
uint32 extradata;
bool global;
};
class PerlembParser : public Parser
{
protected:
//could prolly get rid of this map now, since I check for the
//actual subroutine in the quest package as opposed to just seeing
//if they do not have a quest or the default.
std::map<uint32, questMode> hasQuests; //npcid -> questMode
std::map<std::string, playerQuestMode> playerQuestLoaded; //zone shortname -> playerQuestMode
playerQuestMode globalPlayerQuestLoaded;
GlobalNPCQuestMode globalNPCQuestLoaded;
std::map<std::string, itemQuestMode> itemQuestLoaded; // package name - > itemQuestMode
std::map<uint32, spellQuestMode> spellQuestLoaded;
std::queue<EventRecord> eventQueue; //for events that happen when perl is in use.
bool eventQueueProcessing;
>>>>>>> master
class ItemInst;
class Mob;
@@ -76,6 +146,7 @@ public:
virtual void LoadItemScript(std::string filename, std::string item_script);
virtual void LoadSpellScript(std::string filename, uint32 spell_id);
<<<<<<< HEAD
virtual void AddVar(std::string name, std::string val);
virtual std::string GetVar(std::string name);
virtual void ReloadQuests();
@@ -94,6 +165,38 @@ private:
uint32 extradata, bool global);
void SendCommands(const char *pkgprefix, const char *event, uint32 npcid, Mob* other, Mob* mob, ItemInst* iteminst);
void MapFunctions();
=======
int LoadScript(int npcid, const char * zone, Mob* activater=0);
int LoadGlobalNPCScript();
int LoadPlayerScript(const char *zone);
int LoadGlobalPlayerScript();
int LoadItemScript(ItemInst* iteminst, std::string packagename, itemQuestMode Qtype);
int LoadSpellScript(uint32 id);
//expose a var to the script (probably parallels addvar))
//i.e. exportvar("qst1234", "name", "somemob");
//would expose the variable $name='somemob' to the script that handles npc1234
void ExportHash(const char *pkgprefix, const char *hashname, std::map<std::string,std::string> &vals);
void ExportVar(const char * pkgprefix, const char * varname, const char * value) const;
void ExportVar(const char * pkgprefix, const char * varname, int value) const;
void ExportVar(const char * pkgprefix, const char * varname, unsigned int value) const;
void ExportVar(const char * pkgprefix, const char * varname, float value) const;
//I don't escape the strings, so use caution!!
//Same as export var, except value is not quoted, and is evaluated as perl
void ExportVarComplex(const char * pkgprefix, const char * varname, const char * value) const;
//get an appropriate namespage/packagename from an npcid
std::string GetPkgPrefix(uint32 npcid, bool defaultOK = true);
//call the appropriate perl handler. afterwards, parse and dispatch the command queue
//SendCommands("qst1234", "EVENT_SAY") would trigger sub EVENT_SAY() from the qst1234.pl file
virtual void SendCommands(const char * pkgprefix, const char *event, uint32 npcid, Mob* other, Mob* mob, ItemInst* iteminst);
int HasQuestFile(uint32 npcid);
#ifdef EMBPERL_COMMANDS
void ExecCommand(Client *c, Seperator *sep);
#endif
>>>>>>> master
void HandleQueue();
void AddQueueEvent(QuestEventID event, uint32 objid, const char * data, NPC* npcmob, ItemInst* iteminst, Mob* mob,
+49 -56
View File
@@ -22,7 +22,6 @@
#include <ctype.h>
#include <string.h>
#include <iostream>
using namespace std;
#ifdef _WINDOWS
#include <process.h>
@@ -48,12 +47,9 @@ using namespace std;
#include "QuestParserCollection.h"
#ifdef _WINDOWS
#define snprintf _snprintf
#if (_MSC_VER < 1500)
#define vsnprintf _vsnprintf
#endif
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#define snprintf _snprintf
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#endif
extern Zone* zone;
@@ -82,13 +78,13 @@ void Entity::SetID(uint16 set_id) {
Client* Entity::CastToClient() {
if(this==0x00){
cout << "CastToClient error (nullptr)" << endl;
std::cout << "CastToClient error (nullptr)" << std::endl;
DebugBreak();
return 0;
}
#ifdef _EQDEBUG
if(!IsClient()) {
cout << "CastToClient error (not client?)" << endl;
std::cout << "CastToClient error (not client?)" << std::endl;
DebugBreak();
return 0;
}
@@ -99,7 +95,7 @@ Client* Entity::CastToClient() {
NPC* Entity::CastToNPC() {
#ifdef _EQDEBUG
if(!IsNPC()) {
cout << "CastToNPC error" << endl;
std::cout << "CastToNPC error" << std::endl;
DebugBreak();
return 0;
}
@@ -110,7 +106,7 @@ NPC* Entity::CastToNPC() {
Mob* Entity::CastToMob() {
#ifdef _EQDEBUG
if(!IsMob()) {
cout << "CastToMob error" << endl;
std::cout << "CastToMob error" << std::endl;
DebugBreak();
return 0;
}
@@ -121,7 +117,7 @@ Mob* Entity::CastToMob() {
Merc* Entity::CastToMerc() {
#ifdef _EQDEBUG
if(!IsMerc()) {
cout << "CastToMerc error" << endl;
std::cout << "CastToMerc error" << std::endl;
DebugBreak();
return 0;
}
@@ -145,7 +141,7 @@ Trap* Entity::CastToTrap()
Corpse* Entity::CastToCorpse() {
#ifdef _EQDEBUG
if(!IsCorpse()) {
cout << "CastToCorpse error" << endl;
std::cout << "CastToCorpse error" << std::endl;
DebugBreak();
return 0;
}
@@ -155,7 +151,7 @@ Corpse* Entity::CastToCorpse() {
Object* Entity::CastToObject() {
#ifdef _EQDEBUG
if(!IsObject()) {
cout << "CastToObject error" << endl;
std::cout << "CastToObject error" << std::endl;
DebugBreak();
return 0;
}
@@ -182,18 +178,15 @@ Beacon* Entity::CastToBeacon() {
return static_cast<Beacon*>(this);
}
const Client* Entity::CastToClient() const {
if(this==0x00){
cout << "CastToClient error (nullptr)" << endl;
std::cout << "CastToClient error (nullptr)" << std::endl;
DebugBreak();
return 0;
}
#ifdef _EQDEBUG
if(!IsClient()) {
cout << "CastToClient error (not client?)" << endl;
std::cout << "CastToClient error (not client?)" << std::endl;
DebugBreak();
return 0;
}
@@ -204,7 +197,7 @@ const Client* Entity::CastToClient() const {
const NPC* Entity::CastToNPC() const {
#ifdef _EQDEBUG
if(!IsNPC()) {
cout << "CastToNPC error" << endl;
std::cout << "CastToNPC error" << std::endl;
DebugBreak();
return 0;
}
@@ -215,7 +208,7 @@ const NPC* Entity::CastToNPC() const {
const Mob* Entity::CastToMob() const {
#ifdef _EQDEBUG
if(!IsMob()) {
cout << "CastToMob error" << endl;
std::cout << "CastToMob error" << std::endl;
DebugBreak();
return 0;
}
@@ -226,7 +219,7 @@ const Mob* Entity::CastToMob() const {
const Merc* Entity::CastToMerc() const {
#ifdef _EQDEBUG
if(!IsMerc()) {
cout << "CastToMerc error" << endl;
std::cout << "CastToMerc error" << std::endl;
DebugBreak();
return 0;
}
@@ -248,7 +241,7 @@ const Trap* Entity::CastToTrap() const {
const Corpse* Entity::CastToCorpse() const {
#ifdef _EQDEBUG
if(!IsCorpse()) {
cout << "CastToCorpse error" << endl;
std::cout << "CastToCorpse error" << std::endl;
DebugBreak();
return 0;
}
@@ -259,7 +252,7 @@ const Corpse* Entity::CastToCorpse() const {
const Object* Entity::CastToObject() const {
#ifdef _EQDEBUG
if(!IsObject()) {
cout << "CastToObject error" << endl;
std::cout << "CastToObject error" << std::endl;
DebugBreak();
return 0;
}
@@ -279,7 +272,7 @@ const Beacon* Entity::CastToBeacon() const {
Bot* Entity::CastToBot() {
#ifdef _EQDEBUG
if(!IsBot()) {
cout << "CastToBot error" << endl;
std::cout << "CastToBot error" << std::endl;
DebugBreak();
return 0;
}
@@ -354,7 +347,7 @@ void EntityList::TrapProcess() {
// to track down bugs.
void EntityList::CheckGroupList (const char *fname, const int fline)
{
list<Group *>::iterator it;
std::list<Group *>::iterator it;
for (it = group_list.begin(); it != group_list.end(); it++)
{
@@ -366,7 +359,7 @@ void EntityList::CheckGroupList (const char *fname, const int fline)
}
void EntityList::GroupProcess() {
list<Group *>::iterator iterator;
std::list<Group *>::iterator iterator;
uint32 count = 0;
if(numclients < 1)
@@ -398,7 +391,7 @@ void EntityList::GroupProcess() {
void EntityList::QueueToGroupsForNPCHealthAA(Mob* sender, const EQApplicationPacket* app)
{
list<Group *>::iterator iterator = group_list.begin();
std::list<Group *>::iterator iterator = group_list.begin();
_ZP(EntityList_QueueToGroupsForNPCHealthAA);
@@ -410,7 +403,7 @@ void EntityList::QueueToGroupsForNPCHealthAA(Mob* sender, const EQApplicationPac
}
void EntityList::RaidProcess() {
list<Raid *>::iterator iterator;
std::list<Raid *>::iterator iterator;
uint32 count = 0;
if(numclients < 1)
@@ -517,7 +510,7 @@ void EntityList::MobProcess() {
#ifdef _WINDOWS
struct in_addr in;
in.s_addr = mob->CastToClient()->GetIP();
cout << "Dropping client: Process=false, ip=" << inet_ntoa(in) << ", port=" << mob->CastToClient()->GetPort() << endl;
std::cout << "Dropping client: Process=false, ip=" << inet_ntoa(in) << ", port=" << mob->CastToClient()->GetPort() << std::endl;
#endif
zone->StartShutdownTimer();
Group *g = GetGroupByMob(mob);
@@ -1951,7 +1944,7 @@ Client* EntityList::GetClientByWID(uint32 iWID) {
Client* EntityList::GetRandomClient(float x, float y, float z, float Distance, Client* ExcludeClient)
{
vector<Client*> ClientsInRange;
std::vector<Client*> ClientsInRange;
LinkedListIterator<Client*> iterator(client_list);
@@ -2092,7 +2085,7 @@ int EntityList::RezzAllCorpsesByCharID(uint32 charid)
Group* EntityList::GetGroupByMob(Mob* mob)
{
list<Group *>::iterator iterator;
std::list<Group *>::iterator iterator;
iterator = group_list.begin();
@@ -2110,7 +2103,7 @@ Group* EntityList::GetGroupByMob(Mob* mob)
}
Group* EntityList::GetGroupByLeaderName(char* leader){
list<Group *>::iterator iterator;
std::list<Group *>::iterator iterator;
iterator = group_list.begin();
@@ -2127,7 +2120,7 @@ Group* EntityList::GetGroupByLeaderName(char* leader){
return 0;
}
Group* EntityList::GetGroupByID(uint32 group_id){
list<Group *>::iterator iterator;
std::list<Group *>::iterator iterator;
iterator = group_list.begin();
@@ -2145,7 +2138,7 @@ Group* EntityList::GetGroupByID(uint32 group_id){
}
Group* EntityList::GetGroupByClient(Client* client)
{
list <Group *>::iterator iterator;
std::list <Group *>::iterator iterator;
iterator = group_list.begin();
@@ -2163,7 +2156,7 @@ Group* EntityList::GetGroupByClient(Client* client)
}
Raid* EntityList::GetRaidByLeaderName(const char *leader){
list<Raid *>::iterator iterator;
std::list<Raid *>::iterator iterator;
iterator = raid_list.begin();
@@ -2179,7 +2172,7 @@ Raid* EntityList::GetRaidByLeaderName(const char *leader){
return 0;
}
Raid* EntityList::GetRaidByID(uint32 id){
list<Raid *>::iterator iterator;
std::list<Raid *>::iterator iterator;
iterator = raid_list.begin();
@@ -2195,7 +2188,7 @@ Raid* EntityList::GetRaidByID(uint32 id){
Raid* EntityList::GetRaidByClient(Client* client)
{
list<Raid *>::iterator iterator;
std::list<Raid *>::iterator iterator;
iterator = raid_list.begin();
@@ -2214,7 +2207,7 @@ Raid* EntityList::GetRaidByClient(Client* client)
}
Raid* EntityList::GetRaidByMob(Mob* mob) {
list<Raid *>::iterator iterator;
std::list<Raid *>::iterator iterator;
iterator = raid_list.begin();
@@ -2657,7 +2650,7 @@ bool EntityList::RemoveCorpse(uint16 delete_id){
return false;
}
bool EntityList::RemoveGroup(uint32 delete_id){
list<Group *>::iterator iterator;
std::list<Group *>::iterator iterator;
iterator = group_list.begin();
@@ -2679,7 +2672,7 @@ bool EntityList::RemoveGroup(uint32 delete_id){
}
bool EntityList::RemoveRaid(uint32 delete_id){
list<Raid *>::iterator iterator;
std::list<Raid *>::iterator iterator;
iterator = raid_list.begin();
@@ -3123,7 +3116,7 @@ void EntityList::FindPathsToAllNPCs()
{
VERTEX Node0 = zone->pathing->GetPathNodeCoordinates(0, false);
VERTEX Dest(Iterator.GetData()->GetX(), Iterator.GetData()->GetY(), Iterator.GetData()->GetZ());
list<int> Route = zone->pathing->FindRoute(Node0, Dest);
std::list<int> Route = zone->pathing->FindRoute(Node0, Dest);
if(Route.size() == 0)
printf("Unable to find a route to %s\n", Iterator.GetData()->GetName());
else
@@ -3253,7 +3246,7 @@ void EntityList::WriteEntityIDs() {
iterator.Reset();
while(iterator.MoreElements())
{
cout << "ID: " << iterator.GetData()->GetID() << " Name: " << iterator.GetData()->GetName() << endl;
std::cout << "ID: " << iterator.GetData()->GetID() << " Name: " << iterator.GetData()->GetName() << std::endl;
iterator.Advance();
}
}
@@ -3891,7 +3884,7 @@ bool EntityList::LimitCheckType(uint32 npc_type, int count) {
if(count < 1)
return(true);
map<uint16, SpawnLimitRecord>::iterator cur,end;
std::map<uint16, SpawnLimitRecord>::iterator cur,end;
cur = npc_limit_list.begin();
end = npc_limit_list.end();
@@ -3912,7 +3905,7 @@ bool EntityList::LimitCheckGroup(uint32 spawngroup_id, int count) {
if(count < 1)
return(true);
map<uint16, SpawnLimitRecord>::iterator cur,end;
std::map<uint16, SpawnLimitRecord>::iterator cur,end;
cur = npc_limit_list.begin();
end = npc_limit_list.end();
@@ -3934,7 +3927,7 @@ bool EntityList::LimitCheckBoth(uint32 npc_type, uint32 spawngroup_id, int group
if(group_count < 1 && type_count < 1)
return(true);
map<uint16, SpawnLimitRecord>::iterator cur,end;
std::map<uint16, SpawnLimitRecord>::iterator cur,end;
cur = npc_limit_list.begin();
end = npc_limit_list.end();
@@ -4542,7 +4535,7 @@ void EntityList::ZoneWho(Client *c, Who_All_Struct* Who) {
strncasecmp(guild_mgr.GetGuildName(ClientEntry->GuildID()), Who->whom, WhomLength))
continue;
string GuildName;
std::string GuildName;
if((ClientEntry->GuildID() != GUILD_NONE) && (ClientEntry->GuildID() > 0)) {
@@ -4748,7 +4741,7 @@ void EntityList::SignalAllClients(uint32 data)
}
}
void EntityList::GetMobList(list<Mob*> &m_list)
void EntityList::GetMobList(std::list<Mob*> &m_list)
{
m_list.clear();
LinkedListIterator<Mob*> iterator(mob_list);
@@ -4761,7 +4754,7 @@ void EntityList::GetMobList(list<Mob*> &m_list)
}
}
void EntityList::GetNPCList(list<NPC*> &n_list)
void EntityList::GetNPCList(std::list<NPC*> &n_list)
{
n_list.clear();
LinkedListIterator<NPC*> iterator(npc_list);
@@ -4774,7 +4767,7 @@ void EntityList::GetNPCList(list<NPC*> &n_list)
}
}
void EntityList::GetClientList(list<Client*> &c_list)
void EntityList::GetClientList(std::list<Client*> &c_list)
{
c_list.clear();
LinkedListIterator<Client*> iterator(client_list);
@@ -4787,7 +4780,7 @@ void EntityList::GetClientList(list<Client*> &c_list)
}
}
void EntityList::GetCorpseList(list<Corpse*> &c_list)
void EntityList::GetCorpseList(std::list<Corpse*> &c_list)
{
c_list.clear();
LinkedListIterator<Corpse*> iterator(corpse_list);
@@ -4800,7 +4793,7 @@ void EntityList::GetCorpseList(list<Corpse*> &c_list)
}
}
void EntityList::GetObjectList(list<Object*> &o_list)
void EntityList::GetObjectList(std::list<Object*> &o_list)
{
o_list.clear();
LinkedListIterator<Object*> iterator(object_list);
@@ -4813,7 +4806,7 @@ void EntityList::GetObjectList(list<Object*> &o_list)
}
}
void EntityList::GetDoorsList(list<Doors*> &o_list)
void EntityList::GetDoorsList(std::list<Doors*> &o_list)
{
o_list.clear();
LinkedListIterator<Doors*> iterator(door_list);
@@ -5082,7 +5075,7 @@ void EntityList::AddLootToNPCS(uint32 item_id, uint32 count)
while(count > 0)
{
vector<int> selection;
std::vector<int> selection;
selection.reserve(npc_count);
for(int j = 0; j < npc_count; ++j)
{
@@ -5205,7 +5198,7 @@ Mob* EntityList::GetClosestMobByBodyType(Mob* sender, bodyType BodyType)
return ClosestMob;
}
void EntityList::GetTargetsForConeArea(Mob *start, uint32 radius, uint32 height, list<Mob*> &m_list)
void EntityList::GetTargetsForConeArea(Mob *start, uint32 radius, uint32 height, std::list<Mob*> &m_list)
{
LinkedListIterator<Mob*> iterator(mob_list);
iterator.Reset();
@@ -5258,7 +5251,7 @@ Mob* EntityList::GetTargetForVirus(Mob* spreader)
{
int max_spread_range = RuleI(Spells, VirusSpreadDistance);
vector<Mob*> TargetsInRange;
std::vector<Mob*> TargetsInRange;
LinkedListIterator<Mob*> iterator(mob_list);
iterator.Reset();
+12 -12
View File
@@ -388,14 +388,14 @@ public:
void UpdateFindableNPCState(NPC *n, bool Remove);
void HideCorpses(Client *c, uint8 CurrentMode, uint8 NewMode);
void GetMobList(list<Mob*> &m_list);
void GetNPCList(list<NPC*> &n_list);
void GetMercList(list<Merc*> &n_list);
void GetClientList(list<Client*> &c_list);
void GetCorpseList(list<Corpse*> &c_list);
void GetObjectList(list<Object*> &o_list);
void GetDoorsList(list<Doors*> &d_list);
void GetTargetsForConeArea(Mob *start, uint32 radius, uint32 height, list<Mob*> &m_list);
void GetMobList(std::list<Mob*> &m_list);
void GetNPCList(std::list<NPC*> &n_list);
void GetMercList(std::list<Merc*> &n_list);
void GetClientList(std::list<Client*> &c_list);
void GetCorpseList(std::list<Corpse*> &c_list);
void GetObjectList(std::list<Object*> &o_list);
void GetDoorsList(std::list<Doors*> &d_list);
void GetTargetsForConeArea(Mob *start, uint32 radius, uint32 height, std::list<Mob*> &m_list);
void DepopAll(int NPCTypeID, bool StartSpawnTimer = true);
@@ -413,7 +413,7 @@ private:
//used for limiting spawns
class SpawnLimitRecord { public: uint32 spawngroup_id; uint32 npc_type; };
map<uint16, SpawnLimitRecord> npc_limit_list; //entity id -> npc type
std::map<uint16, SpawnLimitRecord> npc_limit_list; //entity id -> npc type
uint32 tsFirstSpawnOnQueue; // timestamp that the top spawn on the spawnqueue was added, should be 0xFFFFFFFF if queue is empty
uint32 NumSpawnsOnQueue;
@@ -423,14 +423,14 @@ private:
LinkedList<Mob*> mob_list;
LinkedList<NPC*> npc_list;
LinkedList<Merc *> merc_list;
list<Group*> group_list;
std::list<Group*> group_list;
LinkedList<Corpse*> corpse_list;
LinkedList<Object*> object_list;
LinkedList<Doors*> door_list;
LinkedList<Trap*> trap_list;
LinkedList<Beacon*> beacon_list;
LinkedList<NPC *> proximity_list;
list<Raid *> raid_list;
std::list<Raid *> raid_list;
uint16 last_insert_id;
// Please Do Not Declare Any EntityList Class Members After This Comment
@@ -442,7 +442,7 @@ private:
Mob* GetMobByBotID(uint32 botID);
Bot* GetBotByBotID(uint32 botID);
Bot* GetBotByBotName(std::string botName);
list<Bot*> GetBotsByBotOwnerCharacterID(uint32 botOwnerCharacterID);
std::list<Bot*> GetBotsByBotOwnerCharacterID(uint32 botOwnerCharacterID);
bool Bot_AICheckCloseBeneficialSpells(Bot* caster, uint8 iChance, float iRange, uint16 iSpellTypes); // TODO: Evaluate this closesly in hopes to eliminate
void ShowSpawnWindow(Client* client, int Distance, bool NamedOnly); // TODO: Implement ShowSpawnWindow in the bot class but it needs entity list stuff
+1 -1
View File
@@ -19,7 +19,7 @@
#include "../common/features.h"
#include "masterentity.h"
#include "StringIDs.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/rulesys.h"
#include "QuestParserCollection.h"
+1 -1
View File
@@ -159,7 +159,7 @@ void Mob::CalculateNewFearpoint()
VERTEX CurrentPosition(GetX(), GetY(), GetZ());
list<int> Route = zone->pathing->FindRoute(CurrentPosition, Loc);
std::list<int> Route = zone->pathing->FindRoute(CurrentPosition, Loc);
if(Route.size() > 0)
{
+2 -2
View File
@@ -17,7 +17,6 @@
*/
#include "../common/debug.h"
#include <iostream>
using namespace std;
#include <stdlib.h>
#include <math.h>
@@ -33,6 +32,7 @@ using namespace std;
#include "titles.h"
#include "StringIDs.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/rulesys.h"
#include "zonedb.h"
@@ -177,7 +177,7 @@ uint32 ZoneDatabase::GetZoneFishing(uint32 ZoneID, uint8 skill, uint32 &npc_id,
mysql_free_result(result);
}
else {
cerr << "Error in Fishing query '" << query << "' " << errbuf << endl;
std::cerr << "Error in Fishing query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return 0;
}
+2 -2
View File
@@ -20,7 +20,7 @@
#include "NpcAI.h"
#include "../common/packet_functions.h"
#include "../common/packet_dump.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "worldserver.h"
extern EntityList entity_list;
extern WorldServer worldserver;
@@ -158,7 +158,7 @@ void Group::SplitMoney(uint32 copper, uint32 silver, uint32 gold, uint32 platinu
char buf[128];
buf[63] = '\0';
string msg = "You receive";
std::string msg = "You receive";
bool one = false;
if(ppsplit > 0) {
+4 -4
View File
@@ -141,10 +141,10 @@ public:
private:
Mob* leader;
GroupLeadershipAA_Struct LeaderAbilities;
string MainTankName;
string MainAssistName;
string PullerName;
string NPCMarkerName;
std::string MainTankName;
std::string MainAssistName;
std::string PullerName;
std::string NPCMarkerName;
uint16 NPCMarkerID;
uint16 AssistTargetID;
uint16 TankTargetID;
+1 -1
View File
@@ -28,7 +28,7 @@
#include "../common/ZoneNumbers.h"
#include "../common/moremath.h"
#include "../common/guilds.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "guild_mgr.h"
#include "StringIDs.h"
#include "NpcAI.h"
+7 -8
View File
@@ -20,6 +20,7 @@
#include "zonedb.h"
#include "worldserver.h"
#include "../common/servertalk.h"
#include "../common/StringUtil.h"
#include "client.h"
#include "entity.h"
@@ -164,13 +165,13 @@ uint8 *ZoneGuildManager::MakeGuildMembers(uint32 guild_id, const char *prefix_na
return(retbuffer);
}
vector<CharGuildInfo *> members;
std::vector<CharGuildInfo *> members;
if(!GetEntireGuild(guild_id, members))
return(nullptr);
//figure out the actual packet length.
uint32 fixed_length = sizeof(Internal_GuildMembers_Struct) + members.size()*sizeof(Internal_GuildMemberEntry_Struct);
vector<CharGuildInfo *>::iterator cur, end;
std::vector<CharGuildInfo *>::iterator cur, end;
CharGuildInfo *ci;
cur = members.begin();
end = members.end();
@@ -242,7 +243,7 @@ uint8 *ZoneGuildManager::MakeGuildMembers(uint32 guild_id, const char *prefix_na
void ZoneGuildManager::ListGuilds(Client *c) const {
c->Message(0, "Listing guilds on the server:");
char leadername[64];
map<uint32, GuildInfo *>::const_iterator cur, end;
std::map<uint32, GuildInfo *>::const_iterator cur, end;
cur = m_guilds.begin();
end = m_guilds.end();
int r = 0;
@@ -260,7 +261,7 @@ void ZoneGuildManager::ListGuilds(Client *c) const {
void ZoneGuildManager::DescribeGuild(Client *c, uint32 guild_id) const {
map<uint32, GuildInfo *>::const_iterator res;
std::map<uint32, GuildInfo *>::const_iterator res;
res = m_guilds.find(guild_id);
if(res == m_guilds.end()) {
c->Message(0, "Guild %d not found.", guild_id);
@@ -292,11 +293,11 @@ void ZoneGuildManager::DescribeGuild(Client *c, uint32 guild_id) const {
//in theory, we could get a pile of unused entries in this array, but only if
//we had a malicious client sending controlled packets, plus its like 10 bytes per entry.
void ZoneGuildManager::RecordInvite(uint32 char_id, uint32 guild_id, uint8 rank) {
m_inviteQueue[char_id] = pair<uint32, uint8>(guild_id, rank);
m_inviteQueue[char_id] = std::pair<uint32, uint8>(guild_id, rank);
}
bool ZoneGuildManager::VerifyAndClearInvite(uint32 char_id, uint32 guild_id, uint8 rank) {
map<uint32, pair<uint32, uint8> >::iterator res;
std::map<uint32, std::pair<uint32, uint8> >::iterator res;
res = m_inviteQueue.find(char_id);
if(res == m_inviteQueue.end())
return(false); //no entry...
@@ -308,8 +309,6 @@ bool ZoneGuildManager::VerifyAndClearInvite(uint32 char_id, uint32 guild_id, uin
return(valid);
}
void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) {
switch(pack->opcode) {
case ServerOP_RefreshGuild: {
+2 -2
View File
@@ -20,12 +20,12 @@
#include "masterentity.h"
#include "../common/Item.h"
#include "../common/linked_list.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include <math.h>
#include <assert.h>
#include "worldserver.h"
map<uint16, const NPCType *> Horse::horse_types;
std::map<uint16, const NPCType *> Horse::horse_types;
LinkedList<NPCType *> horses_auto_delete;
Horse::Horse(Client *_owner, uint16 spell_id, float x, float y, float z, float heading)
+1 -2
View File
@@ -22,7 +22,6 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
#include "npc.h"
#include <map>
using namespace std;
class Horse : public NPC {
public:
@@ -36,7 +35,7 @@ protected:
Client *owner;
//generate npc type records for horses
static map<uint16, const NPCType *> horse_types;
static std::map<uint16, const NPCType *> horse_types;
static const NPCType *GetHorseType(uint16 spell_id);
static const NPCType *BuildHorseType(uint16 spell_id);
};
+12 -11
View File
@@ -29,6 +29,7 @@
#include "../common/moremath.h"
#include "../common/guilds.h"
#include "../common/logsys.h"
#include "../common/StringUtil.h"
#include "StringIDs.h"
#include "NpcAI.h"
extern WorldServer worldserver;
@@ -337,7 +338,7 @@ void Client::DropItem(int16 slot_id)
// Save client inventory change to database
if (slot_id==SLOT_CURSOR) {
list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
std::list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
database.SaveCursor(CharacterID(), s, e);
} else
database.SaveInventory(CharacterID(), nullptr, slot_id);
@@ -469,7 +470,7 @@ void Client::DeleteItemInInventory(int16 slot_id, int8 quantity, bool client_upd
const ItemInst* inst=nullptr;
if (slot_id==SLOT_CURSOR) {
list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
std::list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
if(update_db)
database.SaveCursor(character_id, s, e);
}
@@ -523,7 +524,7 @@ bool Client::PushItemOnCursor(const ItemInst& inst, bool client_update)
SendItemPacket(SLOT_CURSOR, &inst, ItemPacketSummonItem);
}
list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
std::list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
return database.SaveCursor(CharacterID(), s, e);
}
@@ -542,7 +543,7 @@ bool Client::PutItemInInventory(int16 slot_id, const ItemInst& inst, bool client
}
if (slot_id==SLOT_CURSOR) {
list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
std::list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
return database.SaveCursor(this->CharacterID(), s, e);
} else
return database.SaveInventory(this->CharacterID(), &inst, slot_id);
@@ -558,7 +559,7 @@ void Client::PutLootInInventory(int16 slot_id, const ItemInst &inst, ServerLootI
SendLootItemInPacket(&inst, slot_id);
if (slot_id==SLOT_CURSOR) {
list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
std::list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
database.SaveCursor(this->CharacterID(), s, e);
} else
database.SaveInventory(this->CharacterID(), &inst, slot_id);
@@ -712,7 +713,7 @@ void Client::MoveItemCharges(ItemInst &from, int16 to_slot, uint8 type)
from.SetCharges(from.GetCharges() - charges_to_move);
SendLootItemInPacket(tmp_inst, to_slot);
if (to_slot==SLOT_CURSOR){
list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
std::list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
database.SaveCursor(this->CharacterID(), s, e);
} else
database.SaveInventory(this->CharacterID(), tmp_inst, to_slot);
@@ -1207,7 +1208,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
safe_delete(world_inst);
if (src_slot_id==SLOT_CURSOR) {
list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
std::list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
database.SaveCursor(character_id, s, e);
} else
database.SaveInventory(character_id, m_inv[src_slot_id], src_slot_id);
@@ -1332,12 +1333,12 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
// Step 7: Save change to the database
if (src_slot_id==SLOT_CURSOR){
list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
std::list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
database.SaveCursor(character_id, s, e);
} else
database.SaveInventory(character_id, m_inv.GetItem(src_slot_id), src_slot_id);
if (dst_slot_id==SLOT_CURSOR) {
list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
std::list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
database.SaveCursor(character_id, s, e);
} else
database.SaveInventory(character_id, m_inv.GetItem(dst_slot_id), dst_slot_id);
@@ -1964,7 +1965,7 @@ void Client::SendItemPacket(int16 slot_id, const ItemInst* inst, ItemPacketType
return;
// Serialize item into |-delimited string
string packet = inst->Serialize(slot_id);
std::string packet = inst->Serialize(slot_id);
EmuOpcode opcode = OP_Unknown;
EQApplicationPacket* outapp = nullptr;
@@ -1989,7 +1990,7 @@ EQApplicationPacket* Client::ReturnItemPacket(int16 slot_id, const ItemInst* ins
return 0;
// Serialize item into |-delimited string
string packet = inst->Serialize(slot_id);
std::string packet = inst->Serialize(slot_id);
EmuOpcode opcode = OP_Unknown;
EQApplicationPacket* outapp = nullptr;
+1 -2
View File
@@ -18,7 +18,6 @@
#include "../common/debug.h"
#include <stdio.h>
#include <iostream>
using namespace std;
#include <stdlib.h>
#include "npc.h"
#include "masterentity.h"
@@ -45,7 +44,7 @@ void ZoneDatabase::AddLootTableToNPC(NPC* npc,uint32 loottable_id, ItemList* ite
// do coin
if (lts->mincash > lts->maxcash) {
cerr << "Error in loottable #" << loottable_id << ": mincash > maxcash" << endl;
std::cerr << "Error in loottable #" << loottable_id << ": mincash > maxcash" << std::endl;
}
else if (lts->maxcash != 0) {
uint32 cash = 0;
+5 -4
View File
@@ -9,6 +9,7 @@
#include "zone.h"
#include "StringIDs.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/rulesys.h"
#include "QuestParserCollection.h"
#include "watermap.h"
@@ -1122,7 +1123,7 @@ int32 Merc::CalcBaseEndurance()
int BonusUpto800 = int( at_most_800 / 4 ) ;
if(Stats > 400) {
Bonus400to800 = int( (at_most_800 - 400) / 4 );
HalfBonus400to800 = int( max( ( at_most_800 - 400 ), 0 ) / 8 );
HalfBonus400to800 = int( std::max( ( at_most_800 - 400 ), 0 ) / 8 );
if(Stats > 800) {
Bonus800plus = int( (Stats - 800) / 8 ) * 2;
@@ -1928,7 +1929,7 @@ bool Merc::AI_IdleCastCheck() {
if (AIautocastspell_timer->Check(false)) {
_ZP(Merc_AI_IdleCastCheck);
#if MobAI_DEBUG_Spells >= 25
cout << "Non-Engaged autocast check triggered: " << this->GetCleanName() << endl;
std::cout << "Non-Engaged autocast check triggered: " << this->GetCleanName() << std::endl;
#endif
AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting.
@@ -3751,7 +3752,7 @@ MercSpell Merc::GetBestMercSpellForCure(Merc* caster, Mob *tar) {
//Check for group cure first
if(countNeedsCured > 2) {
for(list<MercSpell>::iterator itr = cureList.begin(); itr != cureList.end(); itr++) {
for(std::list<MercSpell>::iterator itr = cureList.begin(); itr != cureList.end(); itr++) {
MercSpell selectedMercSpell = *itr;
if(IsGroupSpell(itr->spellid) && CheckSpellRecastTimers(caster, itr->spellid)) {
@@ -3791,7 +3792,7 @@ MercSpell Merc::GetBestMercSpellForCure(Merc* caster, Mob *tar) {
//no group cure for target- try to find single target spell
if(!spellSelected) {
for(list<MercSpell>::iterator itr = cureList.begin(); itr != cureList.end(); itr++) {
for(std::list<MercSpell>::iterator itr = cureList.begin(); itr != cureList.end(); itr++) {
MercSpell selectedMercSpell = *itr;
if(CheckSpellRecastTimers(caster, itr->spellid)) {
-1
View File
@@ -3,7 +3,6 @@
#include "mob.h"
#include "zonedb.h"
#include "npc.h"
using namespace std;
#define MAXMERCS 1
#define MERC_DEBUG 0
+7 -6
View File
@@ -21,6 +21,7 @@
#include "StringIDs.h"
#include "worldserver.h"
#include "QuestParserCollection.h"
#include "../common/StringUtil.h"
#include <sstream>
#include <math.h>
@@ -3782,7 +3783,7 @@ void Mob::InsertQuestGlobal(int charid, int npcid, int zoneid, const char *varna
char errbuf[MYSQL_ERRMSG_SIZE];
// Make duration string either "unix_timestamp(now()) + xxx" or "NULL"
stringstream duration_ss;
std::stringstream duration_ss;
if (duration == INT_MAX)
{
@@ -4487,7 +4488,7 @@ bool Mob::PassLimitToSkill(uint16 spell_id, uint16 skill) {
// Faction Mods for Alliance type spells
void Mob::AddFactionBonus(uint32 pFactionID,int32 bonus) {
map <uint32, int32> :: const_iterator faction_bonus;
std::map <uint32, int32> :: const_iterator faction_bonus;
typedef std::pair <uint32, int32> NewFactionBonus;
faction_bonus = faction_bonuses.find(pFactionID);
@@ -4507,7 +4508,7 @@ void Mob::AddFactionBonus(uint32 pFactionID,int32 bonus) {
// Faction Mods from items
void Mob::AddItemFactionBonus(uint32 pFactionID,int32 bonus) {
map <uint32, int32> :: const_iterator faction_bonus;
std::map <uint32, int32> :: const_iterator faction_bonus;
typedef std::pair <uint32, int32> NewFactionBonus;
faction_bonus = item_faction_bonuses.find(pFactionID);
@@ -4526,7 +4527,7 @@ void Mob::AddItemFactionBonus(uint32 pFactionID,int32 bonus) {
}
int32 Mob::GetFactionBonus(uint32 pFactionID) {
map <uint32, int32> :: const_iterator faction_bonus;
std::map <uint32, int32> :: const_iterator faction_bonus;
faction_bonus = faction_bonuses.find(pFactionID);
if(faction_bonus != faction_bonuses.end())
{
@@ -4536,7 +4537,7 @@ int32 Mob::GetFactionBonus(uint32 pFactionID) {
}
int32 Mob::GetItemFactionBonus(uint32 pFactionID) {
map <uint32, int32> :: const_iterator faction_bonus;
std::map <uint32, int32> :: const_iterator faction_bonus;
faction_bonus = item_faction_bonuses.find(pFactionID);
if(faction_bonus != item_faction_bonuses.end())
{
@@ -4546,7 +4547,7 @@ int32 Mob::GetItemFactionBonus(uint32 pFactionID) {
}
void Mob::ClearItemFactionBonuses() {
map <uint32, int32> :: iterator itr;
std::map <uint32, int32> :: iterator itr;
for(itr = item_faction_bonuses.begin(); itr != item_faction_bonuses.end(); itr++)
{
item_faction_bonuses.erase(itr->first);
+1 -1
View File
@@ -1096,7 +1096,7 @@ protected:
VERTEX PathingLastPosition;
int PathingLoopCount;
int PathingLastNodeVisited;
list<int> Route;
std::list<int> Route;
LOSType PathingLOSState;
Timer *PathingLOSCheckTimer;
Timer *PathingRouteUpdateTimerShort;
-2
View File
@@ -21,8 +21,6 @@ extern Zone* zone;
extern WorldServer worldserver;
using namespace std;
void Zone::mod_init() { return; }
void Zone::mod_repop() { return; }
-2
View File
@@ -21,8 +21,6 @@ extern Zone* zone;
extern WorldServer worldserver;
using namespace std;
void Zone::mod_init() { return; }
void Zone::mod_repop() { return; }
-2
View File
@@ -19,7 +19,6 @@
#include "../common/debug.h"
#include "../common/features.h"
#include <iostream>
using namespace std;
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -32,7 +31,6 @@ using namespace std;
#ifdef _CRTDBG_MAP_ALLOC
#define new new(_NORMAL_BLOCK, __FILE__, __LINE__)
#endif
using namespace std;
#ifdef _WINDOWS
#include <conio.h>
#define snprintf _snprintf
+51 -51
View File
@@ -19,7 +19,6 @@
#include <iostream>
#include <string>
#include <cctype>
using namespace std;
#include <math.h>
#include "../common/moremath.h"
#include <stdio.h>
@@ -42,6 +41,7 @@ using namespace std;
#include "../common/bodytypes.h"
#include "spawngroup.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/rulesys.h"
#include "StringIDs.h"
@@ -382,7 +382,7 @@ NPC::~NPC()
}
{
list<struct NPCFaction*>::iterator cur,end;
std::list<struct NPCFaction*>::iterator cur,end;
cur = faction_list.begin();
end = faction_list.end();
for(; cur != end; cur++) {
@@ -462,7 +462,7 @@ void NPC::CheckMinMaxLevel(Mob *them)
uint16 themlevel = them->GetLevel();
uint8 material;
list<ServerLootItem_Struct*>::iterator cur = itemlist.begin();
std::list<ServerLootItem_Struct*>::iterator cur = itemlist.begin();
while(cur != itemlist.end())
{
if(!(*cur))
@@ -2379,7 +2379,7 @@ FACTION_VALUE NPC::GetReverseFactionCon(Mob* iOther) {
//Look through our faction list and return a faction con based
//on the npc_value for the other person's primary faction in our list.
FACTION_VALUE NPC::CheckNPCFactionAlly(int32 other_faction) {
list<struct NPCFaction*>::iterator cur,end;
std::list<struct NPCFaction*>::iterator cur,end;
cur = faction_list.begin();
end = faction_list.end();
for(; cur != end; cur++) {
@@ -2402,62 +2402,62 @@ bool NPC::IsFactionListAlly(uint32 other_faction) {
int NPC::GetScore()
{
int lv = min(70, (int)GetLevel());
int basedmg = (lv*2)*(1+(lv / 100)) - (lv / 2);
int minx = 0;
int basehp = 0;
int hpcontrib = 0;
int dmgcontrib = 0;
int spccontrib = 0;
int hp = GetMaxHP();
int mindmg = min_dmg;
int maxdmg = max_dmg;
int final;
int lv = std::min(70, (int)GetLevel());
int basedmg = (lv*2)*(1+(lv / 100)) - (lv / 2);
int minx = 0;
int basehp = 0;
int hpcontrib = 0;
int dmgcontrib = 0;
int spccontrib = 0;
int hp = GetMaxHP();
int mindmg = min_dmg;
int maxdmg = max_dmg;
int final;
if(lv < 46)
{
if(lv < 46)
{
minx = static_cast<int> (ceil( ((lv - (lv / 10.0)) - 1.0) ));
basehp = (lv * 10) + (lv * lv);
}
else
{
minx = static_cast<int> (ceil( ((lv - (lv / 10.0)) - 1.0) - (( lv - 45.0 ) / 2.0) ));
basehp = (lv * 10) + ((lv * lv) * 4);
}
basehp = (lv * 10) + ((lv * lv) * 4);
}
if(hp > basehp)
if(hp > basehp)
{
hpcontrib = static_cast<int> (((hp / static_cast<float> (basehp)) * 1.5));
if(hpcontrib > 5) { hpcontrib = 5; }
if(maxdmg > basedmg)
{
dmgcontrib = static_cast<int> (ceil( ((maxdmg / basedmg) * 1.5) ));
}
if(HasNPCSpecialAtk("E")) { spccontrib++; } //Enrage
if(HasNPCSpecialAtk("F")) { spccontrib++; } //Flurry
if(HasNPCSpecialAtk("R")) { spccontrib++; } //Rampage
if(HasNPCSpecialAtk("r")) { spccontrib++; } //Area Rampage
if(HasNPCSpecialAtk("S")) { spccontrib++; } //Summon
if(HasNPCSpecialAtk("T")) { spccontrib += 2; } //Triple
if(HasNPCSpecialAtk("Q")) { spccontrib += 3; } //Quad
if(HasNPCSpecialAtk("U")) { spccontrib += 5; } //Unslowable
if(HasNPCSpecialAtk("L")) { spccontrib++; } //Innate Dual Wield
}
if(npc_spells_id > 12)
{
hpcontrib = static_cast<int> (((hp / static_cast<float> (basehp)) * 1.5));
if(hpcontrib > 5) { hpcontrib = 5; }
if(lv < 16)
spccontrib++;
else
spccontrib += static_cast<int> (floor(lv/15.0));
}
if(maxdmg > basedmg)
{
dmgcontrib = static_cast<int> (ceil( ((maxdmg / basedmg) * 1.5) ));
}
if(HasNPCSpecialAtk("E")) { spccontrib++; } //Enrage
if(HasNPCSpecialAtk("F")) { spccontrib++; } //Flurry
if(HasNPCSpecialAtk("R")) { spccontrib++; } //Rampage
if(HasNPCSpecialAtk("r")) { spccontrib++; } //Area Rampage
if(HasNPCSpecialAtk("S")) { spccontrib++; } //Summon
if(HasNPCSpecialAtk("T")) { spccontrib += 2; } //Triple
if(HasNPCSpecialAtk("Q")) { spccontrib += 3; } //Quad
if(HasNPCSpecialAtk("U")) { spccontrib += 5; } //Unslowable
if(HasNPCSpecialAtk("L")) { spccontrib++; } //Innate Dual Wield
}
if(npc_spells_id > 12)
{
if(lv < 16)
spccontrib++;
else
spccontrib += static_cast<int> (floor(lv/15.0));
}
final = minx + hpcontrib + dmgcontrib + spccontrib;
final = max(1, final);
final = min(100, final);
return(final);
final = minx + hpcontrib + dmgcontrib + spccontrib;
final = std::max(1, final);
final = std::min(100, final);
return(final);
}
uint32 NPC::GetSpawnKillCount()
@@ -2480,4 +2480,4 @@ void NPC::DoQuestPause(Mob *other) {
FaceTarget(other);
}
}
}
+4 -5
View File
@@ -25,7 +25,6 @@ class NPC;
#include <list>
#include <deque>
using namespace std;
#include "spawn2.h"
#include "../common/loottable.h"
@@ -256,7 +255,7 @@ public:
void ResumeWandering();
void PauseWandering(int pausetime);
void MoveTo(float mtx, float mty, float mtz, float mth, bool saveguardspot);
void GetClosestWaypoint(list<wplist> &wp_list, int count, float m_x, float m_y, float m_z);
void GetClosestWaypoint(std::list<wplist> &wp_list, int count, float m_x, float m_y, float m_z);
uint32 GetEquipment(uint8 material_slot) const; // returns item id
int32 GetEquipmentMaterial(uint8 material_slot) const;
@@ -363,7 +362,7 @@ protected:
NPCType* NPCTypedata_ours; //special case for npcs with uniquely created data.
friend class EntityList;
list<struct NPCFaction*> faction_list;
std::list<struct NPCFaction*> faction_list;
uint32 copper;
uint32 silver;
uint32 gold;
@@ -412,10 +411,10 @@ protected:
bool npc_aggro;
deque<int> signal_q;
std::deque<int> signal_q;
//waypoint crap:
vector<wplist> Waypoints;
std::vector<wplist> Waypoints;
void _ClearWaypints();
int max_wp;
int save_wp;
+23 -23
View File
@@ -209,7 +209,7 @@ VERTEX PathManager::GetPathNodeCoordinates(int NodeNumber, bool BestZ)
}
list<int> PathManager::FindRoute(int startID, int endID)
std::list<int> PathManager::FindRoute(int startID, int endID)
{
_ZP(Pathing_FindRoute_FromNodes);
@@ -217,9 +217,9 @@ list<int> PathManager::FindRoute(int startID, int endID)
memset(ClosedListFlag, 0, sizeof(int) * Head.PathNodeCount);
list<AStarNode> OpenList, ClosedList;
std::list<AStarNode> OpenList, ClosedList;
list<int>Route;
std::list<int>Route;
AStarNode AStarEntry, CurrentNode;
@@ -257,7 +257,7 @@ list<int> PathManager::FindRoute(int startID, int endID)
Route.push_back(endID);
list<AStarNode>::iterator RouteIterator;
std::list<AStarNode>::iterator RouteIterator;
while(CurrentNode.PathNodeID != startID)
{
@@ -306,7 +306,7 @@ list<int> PathManager::FindRoute(int startID, int endID)
bool AlreadyInOpenList = false;
list<AStarNode>::iterator OpenListIterator, InsertionPoint = OpenList.end();
std::list<AStarNode>::iterator OpenListIterator, InsertionPoint = OpenList.end();
for(OpenListIterator = OpenList.begin(); OpenListIterator != OpenList.end(); ++OpenListIterator)
{
@@ -356,14 +356,14 @@ bool SortPathNodesByDistance(PathNodeSortStruct n1, PathNodeSortStruct n2)
return n1.Distance < n2.Distance;
}
list<int> PathManager::FindRoute(VERTEX Start, VERTEX End)
std::list<int> PathManager::FindRoute(VERTEX Start, VERTEX End)
{
_ZP(Pathing_FindRoute_FromVertices);
_log(PATHING__DEBUG, "FindRoute(%8.3f, %8.3f, %8.3f, %8.3f, %8.3f, %8.3f)", Start.x, Start.y, Start.z, End.x, End.y, End.z);
list<int> noderoute;
std::list<int> noderoute;
float CandidateNodeRangeXY = RuleR(Pathing, CandidateNodeRangeXY);
@@ -374,7 +374,7 @@ list<int> PathManager::FindRoute(VERTEX Start, VERTEX End)
//
int ClosestPathNodeToStart = -1;
list<PathNodeSortStruct> SortedByDistance;
std::list<PathNodeSortStruct> SortedByDistance;
PathNodeSortStruct TempNode;
@@ -393,7 +393,7 @@ list<int> PathManager::FindRoute(VERTEX Start, VERTEX End)
SortedByDistance.sort(SortPathNodesByDistance);
for(list<PathNodeSortStruct>::iterator Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator)
for(std::list<PathNodeSortStruct>::iterator Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator)
{
_log(PATHING__DEBUG, "Checking Reachability of Node %i from Start Position.", PathNodes[(*Iterator).id].id);
@@ -431,7 +431,7 @@ list<int> PathManager::FindRoute(VERTEX Start, VERTEX End)
SortedByDistance.sort(SortPathNodesByDistance);
for(list<PathNodeSortStruct>::iterator Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator)
for(std::list<PathNodeSortStruct>::iterator Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator)
{
_log(PATHING__DEBUG, "Checking Reachability of Node %i from End Position.", PathNodes[(*Iterator).id].id);
_log(PATHING__DEBUG, " (%8.3f, %8.3f, %8.3f) to (%8.3f, %8.3f, %8.3f)",
@@ -465,7 +465,7 @@ list<int> PathManager::FindRoute(VERTEX Start, VERTEX End)
{
int CulledNodes = 0;
list<int>::iterator First, Second;
std::list<int>::iterator First, Second;
while((noderoute.size() >= 2) && (CulledNodes < NodesToAttemptToCull))
{
@@ -496,7 +496,7 @@ list<int> PathManager::FindRoute(VERTEX Start, VERTEX End)
{
int CulledNodes = 0;
list<int>::iterator First, Second;
std::list<int>::iterator First, Second;
while((noderoute.size() >= 2) && (CulledNodes < NodesToAttemptToCull))
{
@@ -620,7 +620,7 @@ void PathManager::MeshTest()
if(j == i)
continue;
list<int> Route = FindRoute(PathNodes[i].id, PathNodes[j].id);
std::list<int> Route = FindRoute(PathNodes[i].id, PathNodes[j].id);
if(Route.size() == 0)
{
@@ -647,7 +647,7 @@ void PathManager::SimpleMeshTest()
for(uint32 j = 1; j < Head.PathNodeCount; ++j)
{
list<int> Route = FindRoute(PathNodes[0].id, PathNodes[j].id);
std::list<int> Route = FindRoute(PathNodes[0].id, PathNodes[j].id);
if(Route.size() == 0)
{
@@ -1114,7 +1114,7 @@ int PathManager::FindNearestPathNode(VERTEX Position)
int ClosestPathNodeToStart = -1;
list<PathNodeSortStruct> SortedByDistance;
std::list<PathNodeSortStruct> SortedByDistance;
PathNodeSortStruct TempNode;
@@ -1133,7 +1133,7 @@ int PathManager::FindNearestPathNode(VERTEX Position)
SortedByDistance.sort(SortPathNodesByDistance);
for(list<PathNodeSortStruct>::iterator Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator)
for(std::list<PathNodeSortStruct>::iterator Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator)
{
_log(PATHING__DEBUG, "Checking Reachability of Node %i from Start Position.", PathNodes[(*Iterator).id].id);
@@ -1280,7 +1280,7 @@ void Mob::PrintRoute()
printf("Route is : ");
list<int>::iterator Iterator;
std::list<int>::iterator Iterator;
for(Iterator = Route.begin(); Iterator !=Route.end(); ++Iterator)
{
@@ -1324,7 +1324,7 @@ void PathManager::OpenDoors(int Node1, int Node2, Mob *ForWho)
//this assumes that the first point in the list is the player's
//current position, I dont know how well it works if its not.
void Client::SendPathPacket(vector<FindPerson_Point> &points) {
void Client::SendPathPacket(std::vector<FindPerson_Point> &points) {
if(points.size() < 2) {
//empty length packet == not found.
EQApplicationPacket outapp(OP_FindPersonReply, 0);
@@ -1336,7 +1336,7 @@ void Client::SendPathPacket(vector<FindPerson_Point> &points) {
EQApplicationPacket *outapp = new EQApplicationPacket(OP_FindPersonReply, len);
FindPersonResult_Struct* fpr=(FindPersonResult_Struct*)outapp->pBuffer;
vector<FindPerson_Point>::iterator cur, end;
std::vector<FindPerson_Point>::iterator cur, end;
cur = points.begin();
end = points.end();
unsigned int r;
@@ -1473,10 +1473,10 @@ void PathManager::NodeInfo(Client *c)
return;
}
void PathManager::DumpPath(string filename)
void PathManager::DumpPath(std::string filename)
{
ofstream o_file;
o_file.open(filename.c_str(), ios_base::binary | ios_base::trunc | ios_base::out);
std::ofstream o_file;
o_file.open(filename.c_str(), std::ios_base::binary | std::ios_base::trunc | std::ios_base::out);
o_file.write("EQEMUPATH", 9);
o_file.write((const char*)&Head, sizeof(Head));
o_file.write((const char*)PathNodes, (sizeof(PathNode)*Head.PathNodeCount));
@@ -2114,7 +2114,7 @@ bool PathManager::CheckLosFN(VERTEX a, VERTEX b)
return true;
}
void PathManager::ProcessNodesAndSave(string filename)
void PathManager::ProcessNodesAndSave(std::string filename)
{
if(zone->zonemap)
{
+4 -6
View File
@@ -7,8 +7,6 @@
#include <vector>
#include <algorithm>
using namespace std;
class Client;
#define PATHNODENEIGHBOURS 50
@@ -63,8 +61,8 @@ public:
static PathManager *LoadPathFile(const char *ZoneName);
bool loadPaths(FILE *fp);
void PrintPathing();
list<int> FindRoute(VERTEX Start, VERTEX End);
list<int> FindRoute(int startID, int endID);
std::list<int> FindRoute(VERTEX Start, VERTEX End);
std::list<int> FindRoute(int startID, int endID);
VERTEX GetPathNodeCoordinates(int NodeNumber, bool BestZ = true);
bool CheckLosFN(VERTEX a, VERTEX b);
@@ -93,8 +91,8 @@ public:
void MoveNode(Client *c);
void DisconnectAll(Client *c);
bool NodesConnected(PathNode *a, PathNode *b);
void DumpPath(string filename);
void ProcessNodesAndSave(string filename);
void DumpPath(std::string filename);
void ProcessNodesAndSave(std::string filename);
void ResortConnections();
void QuickConnect(Client *c, bool set = false);
void SortNodes();
-1
View File
@@ -20,7 +20,6 @@
#include <string>
#include <vector>
using namespace std;
#include "../common/emu_opcodes.h"
+5 -7
View File
@@ -28,13 +28,11 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
#endif
#ifdef _WINDOWS
#define snprintf _snprintf
#if (_MSC_VER < 1500)
#define vsnprintf _vsnprintf
#endif
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#define snprintf _snprintf
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#endif
#include "../common/StringUtil.h"
#include "../common/packet_functions.h"
#include "../common/packet_dump.h"
#include "../common/packet_dump_file.h"
@@ -300,7 +298,7 @@ void ZoneDatabase::RefreshPetitionsFromDB()
newpet->SetUnavails(atoi(row[11]));
newpet->SetSentTime2(atol(row[13]));
newpet->SetGMText(row[14]);
cout << "Petition " << row[0] << " pettime = " << newpet->GetSentTime() << endl;
std::cout << "Petition " << row[0] << " pettime = " << newpet->GetSentTime() << std::endl;
if (atoi(row[12]) == 1) newpet->SetCheckedOut(true);
else newpet->SetCheckedOut(false);
petition_list.AddPetition(newpet);
+1 -1
View File
@@ -26,7 +26,7 @@
#include "../common/skills.h"
#include "../common/bodytypes.h"
#include "../common/classes.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "pets.h"
#include <math.h>
#include <assert.h>
+14 -15
View File
@@ -58,7 +58,6 @@ And then at then end of embparser.cpp, add:
#include <sstream>
#include <iostream>
#include <list>
using namespace std;
#include "worldserver.h"
#include "net.h"
@@ -68,7 +67,7 @@ using namespace std;
#include "zonedb.h"
#include "../common/spdat.h"
#include "../common/packet_functions.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "spawn2.h"
#include "zone.h"
#include "event_codes.h"
@@ -115,7 +114,7 @@ QuestManager::~QuestManager() {
}
void QuestManager::Process() {
list<QuestTimer>::iterator cur = QTimerList.begin(), end, tmp;
std::list<QuestTimer>::iterator cur = QTimerList.begin(), end, tmp;
end = QTimerList.end();
while (cur != end) {
@@ -170,7 +169,7 @@ void QuestManager::EndQuest() {
running_quest run = quests_running_.top();
if(run.depop_npc && run.owner->IsNPC()) {
//clear out any timers for them...
list<QuestTimer>::iterator cur = QTimerList.begin(), end, tmp;
std::list<QuestTimer>::iterator cur = QTimerList.begin(), end, tmp;
end = QTimerList.end();
while (cur != end) {
@@ -191,7 +190,7 @@ void QuestManager::EndQuest() {
void QuestManager::ClearAllTimers() {
list<QuestTimer>::iterator cur = QTimerList.begin(), end, tmp;
std::list<QuestTimer>::iterator cur = QTimerList.begin(), end, tmp;
end = QTimerList.end();
while (cur != end)
@@ -459,7 +458,7 @@ void QuestManager::Zone(const char *zone_name) {
void QuestManager::settimer(const char *timer_name, int seconds) {
QuestManagerCurrentQuestVars();
list<QuestTimer>::iterator cur = QTimerList.begin(), end;
std::list<QuestTimer>::iterator cur = QTimerList.begin(), end;
end = QTimerList.end();
while (cur != end) {
@@ -479,7 +478,7 @@ void QuestManager::settimer(const char *timer_name, int seconds) {
void QuestManager::settimerMS(const char *timer_name, int milliseconds) {
QuestManagerCurrentQuestVars();
list<QuestTimer>::iterator cur = QTimerList.begin(), end;
std::list<QuestTimer>::iterator cur = QTimerList.begin(), end;
end = QTimerList.end();
while (cur != end) {
@@ -499,7 +498,7 @@ void QuestManager::settimerMS(const char *timer_name, int milliseconds) {
void QuestManager::stoptimer(const char *timer_name) {
QuestManagerCurrentQuestVars();
list<QuestTimer>::iterator cur = QTimerList.begin(), end;
std::list<QuestTimer>::iterator cur = QTimerList.begin(), end;
end = QTimerList.end();
while (cur != end)
@@ -516,7 +515,7 @@ void QuestManager::stoptimer(const char *timer_name) {
void QuestManager::stopalltimers() {
QuestManagerCurrentQuestVars();
list<QuestTimer>::iterator cur = QTimerList.begin(), end, tmp;
std::list<QuestTimer>::iterator cur = QTimerList.begin(), end, tmp;
end = QTimerList.end();
while (cur != end)
@@ -958,7 +957,7 @@ void QuestManager::givecash(int copper, int silver, int gold, int platinum) {
{
initiator->AddMoneyToPP(copper, silver, gold, platinum, true);
string tmp;
std::string tmp;
if (platinum > 0)
{
tmp = "You receive ";
@@ -1265,7 +1264,7 @@ void QuestManager::setglobal(const char *varname, const char *newvalue, int opti
}
if (options < 0 || options > 7)
{
cerr << "Invalid options for global var " << varname << " using defaults" << endl;
std::cerr << "Invalid options for global var " << varname << " using defaults" << std::endl;
} // default = 0 (only this npcid,player and zone)
else
{
@@ -1290,7 +1289,7 @@ int QuestManager::InsertQuestGlobal(
char errbuf[MYSQL_ERRMSG_SIZE];
// Make duration string either "unix_timestamp(now()) + xxx" or "NULL"
stringstream duration_ss;
std::stringstream duration_ss;
if (duration == INT_MAX)
{
duration_ss << "NULL";
@@ -1309,7 +1308,7 @@ int QuestManager::InsertQuestGlobal(
charid, npcid, zoneid, varname, varvalue, duration_ss.str().c_str()
), errbuf, nullptr, nullptr, &last_id))
{
cerr << "setglobal error inserting " << varname << " : " << errbuf << endl;
std::cerr << "setglobal error inserting " << varname << " : " << errbuf << std::endl;
}
safe_delete_array(query);
@@ -1395,7 +1394,7 @@ void QuestManager::delglobal(const char *varname) {
" && (npcid=0 || npcid=%i) && (charid=0 || charid=%i) && (zoneid=%i || zoneid=0)",
varname,qgNpcid,qgCharid,qgZoneid),errbuf))
{
cerr << "delglobal error deleting " << varname << " : " << errbuf << endl;
std::cerr << "delglobal error deleting " << varname << " : " << errbuf << std::endl;
}
safe_delete_array(query);
@@ -1632,7 +1631,7 @@ void QuestManager::showgrid(int grid) {
MYSQL_ROW row;
FindPerson_Point pt;
vector<FindPerson_Point> pts;
std::vector<FindPerson_Point> pts;
pt.x = initiator->GetX();
pt.y = initiator->GetY();
+4 -5
View File
@@ -24,7 +24,6 @@
#include <string>
#include <list>
#include <stack>
using namespace std;
class NPC;
class Client;
@@ -258,9 +257,9 @@ private:
class QuestTimer {
public:
inline QuestTimer(int duration, Mob *_mob, string _name) : mob(_mob), name(_name), Timer_(duration) { Timer_.Start(duration, false); }
inline QuestTimer(int duration, Mob *_mob, std::string _name) : mob(_mob), name(_name), Timer_(duration) { Timer_.Start(duration, false); }
Mob* mob;
string name;
std::string name;
Timer Timer_;
};
class SignalTimer {
@@ -270,8 +269,8 @@ private:
int signal_id;
Timer Timer_;
};
list<QuestTimer> QTimerList;
list<SignalTimer> STimerList;
std::list<QuestTimer> QTimerList;
std::list<SignalTimer> STimerList;
};
+2 -2
View File
@@ -20,7 +20,7 @@
#include "NpcAI.h"
#include "../common/packet_functions.h"
#include "../common/packet_dump.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "worldserver.h"
extern EntityList entity_list;
extern WorldServer worldserver;
@@ -612,7 +612,7 @@ void Raid::SplitMoney(uint32 copper, uint32 silver, uint32 gold, uint32 platinum
char buf[128];
buf[63] = '\0';
string msg = "You receive";
std::string msg = "You receive";
bool one = false;
if(ppsplit > 0) {
-2
View File
@@ -28,8 +28,6 @@
class Client;
class EQApplicationPacket;
using namespace std;
enum { //raid packet types:
raidAdd = 0,
raidRemove2 = 1, //parameter=0
+16 -15
View File
@@ -16,6 +16,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include "../common/StringUtil.h"
#include <stdlib.h>
#include "spawn2.h"
#include "entity.h"
@@ -599,7 +600,7 @@ void SpawnConditionManager::Process() {
return;
//at least one event should get triggered,
vector<SpawnEvent>::iterator cur,end;
std::vector<SpawnEvent>::iterator cur,end;
cur = spawn_events.begin();
end = spawn_events.end();
for(; cur != end; cur++) {
@@ -614,7 +615,7 @@ void SpawnConditionManager::Process() {
ExecEvent(cevent, true);
//add the period of the event to the trigger time
EQTime::AddMinutes(cevent.period, &cevent.next);
string t;
std::string t;
EQTime::ToString(&cevent.next, t);
_log(SPAWNS__CONDITIONS, "Event %d: Will trigger again in %d EQ minutes at %s.", cevent.id, cevent.period, t.c_str());
//save the next event time in the DB
@@ -631,7 +632,7 @@ void SpawnConditionManager::Process() {
}
void SpawnConditionManager::ExecEvent(SpawnEvent &event, bool send_update) {
map<uint16, SpawnCondition>::iterator condi;
std::map<uint16, SpawnCondition>::iterator condi;
condi = spawn_conditions.find(event.condition_id);
if(condi == spawn_conditions.end()) {
_log(SPAWNS__CONDITIONS, "Event %d: Unable to find condition %d to execute on.", event.id, event.condition_id);
@@ -712,7 +713,7 @@ void SpawnConditionManager::UpdateDBCondition(const char* zone_name, uint32 inst
safe_delete_array(query);
}
bool SpawnConditionManager::LoadDBEvent(uint32 event_id, SpawnEvent &event, string &zone_name) {
bool SpawnConditionManager::LoadDBEvent(uint32 event_id, SpawnEvent &event, std::string &zone_name) {
char errbuf[MYSQL_ERRMSG_SIZE];
char* query = 0;
MYSQL_RES *result;
@@ -742,7 +743,7 @@ bool SpawnConditionManager::LoadDBEvent(uint32 event_id, SpawnEvent &event, stri
event.argument = atoi(row[10]);
zone_name = row[11];
string t;
std::string t;
EQTime::ToString(&event.next, t);
_log(SPAWNS__CONDITIONS, "Loaded %s spawn event %d on condition %d with period %d, action %d, argument %d. Will trigger at %s",
event.enabled?"enabled":"disabled", event.id, event.condition_id, event.period, event.action, event.argument, t.c_str());
@@ -859,7 +860,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in
TimeOfDay_Struct tod;
zone->zone_time.getEQTimeOfDay(&tod);
vector<SpawnEvent>::iterator cur,end;
std::vector<SpawnEvent>::iterator cur,end;
cur = spawn_events.begin();
end = spawn_events.end();
bool ran;
@@ -907,7 +908,7 @@ void SpawnConditionManager::FindNearestEvent() {
//set a huge year which should never get reached normally
next_event.year = 0xFFFFFF;
vector<SpawnEvent>::iterator cur,end;
std::vector<SpawnEvent>::iterator cur,end;
cur = spawn_events.begin();
end = spawn_events.end();
int next_id = -1;
@@ -935,7 +936,7 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance
//this is an update coming from another zone, they
//have allready updated the DB, just need to update our
//memory, and check for condition changes
map<uint16, SpawnCondition>::iterator condi;
std::map<uint16, SpawnCondition>::iterator condi;
condi = spawn_conditions.find(condition_id);
if(condi == spawn_conditions.end()) {
_log(SPAWNS__CONDITIONS, "Condition update received from world for %d, but we do not have that conditon.", condition_id);
@@ -962,7 +963,7 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance
{
//this is a local spawn condition, we need to update the DB,
//our memory, then notify spawn points of the change.
map<uint16, SpawnCondition>::iterator condi;
std::map<uint16, SpawnCondition>::iterator condi;
condi = spawn_conditions.find(condition_id);
if(condi == spawn_conditions.end()) {
_log(SPAWNS__CONDITIONS, "Local Condition update requested for %d, but we do not have that conditon.", condition_id);
@@ -1011,12 +1012,12 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance
}
void SpawnConditionManager::ReloadEvent(uint32 event_id) {
string zone_short_name;
std::string zone_short_name;
_log(SPAWNS__CONDITIONS, "Requested to reload event %d from the database.", event_id);
//first look for the event in our local event list
vector<SpawnEvent>::iterator cur,end;
std::vector<SpawnEvent>::iterator cur,end;
cur = spawn_events.begin();
end = spawn_events.end();
for(; cur != end; cur++) {
@@ -1059,7 +1060,7 @@ void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool rese
_log(SPAWNS__CONDITIONS, "Request to %s spawn event %d %sresetting trigger time", enabled?"enable":"disable", event_id, reset_base?"":"without ");
//first look for the event in our local event list
vector<SpawnEvent>::iterator cur,end;
std::vector<SpawnEvent>::iterator cur,end;
cur = spawn_events.begin();
end = spawn_events.end();
for(; cur != end; cur++) {
@@ -1102,7 +1103,7 @@ void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool rese
//is up or not. The message to the zone will just tell it to
//update its in-memory event list
SpawnEvent e;
string zone_short_name;
std::string zone_short_name;
if(!LoadDBEvent(event_id, e, zone_short_name)) {
_log(SPAWNS__CONDITIONS, "Unable to find spawn event %d in the database.", event_id);
//unable to find the event in the database...
@@ -1142,7 +1143,7 @@ int16 SpawnConditionManager::GetCondition(const char *zone_short, uint32 instanc
if(!strcasecmp(zone_short, zone->GetShortName()) && instance_id == zone->GetInstanceID())
{
//this is a local spawn condition
map<uint16, SpawnCondition>::iterator condi;
std::map<uint16, SpawnCondition>::iterator condi;
condi = spawn_conditions.find(condition_id);
if(condi == spawn_conditions.end())
{
@@ -1185,7 +1186,7 @@ int16 SpawnConditionManager::GetCondition(const char *zone_short, uint32 instanc
}
bool SpawnConditionManager::Check(uint16 condition, int16 min_value) {
map<uint16, SpawnCondition>::iterator condi;
std::map<uint16, SpawnCondition>::iterator condi;
condi = spawn_conditions.find(condition);
if(condi == spawn_conditions.end())
return(false); //unable to find the spawn condition
+4 -5
View File
@@ -22,7 +22,6 @@
#include "npc.h"
#include <string>
using namespace std;
#define SC_AlwaysEnabled 0
@@ -129,7 +128,7 @@ public:
uint32 id;
uint16 condition_id;
string zone_name;
std::string zone_name;
bool enabled;
Action action;
@@ -153,12 +152,12 @@ public:
void ReloadEvent(uint32 event_id);
protected:
map<uint16, SpawnCondition> spawn_conditions;
vector<SpawnEvent> spawn_events;
std::map<uint16, SpawnCondition> spawn_conditions;
std::vector<SpawnEvent> spawn_events;
void ExecEvent(SpawnEvent &e, bool send_update);
void UpdateDBEvent(SpawnEvent &e);
bool LoadDBEvent(uint32 event_id, SpawnEvent &e, string &zone_name);
bool LoadDBEvent(uint32 event_id, SpawnEvent &e, std::string &zone_name);
void UpdateDBCondition(const char* zone_name, uint32 instance_id, uint16 cond_id, int16 value);
void FindNearestEvent();
+11 -11
View File
@@ -21,10 +21,10 @@
#include <string.h>
#include <stdlib.h>
#include <iostream>
using namespace std;
#include "../common/types.h"
#include "zonedb.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
extern EntityList entity_list;
@@ -60,8 +60,8 @@ uint32 SpawnGroup::GetNPCType() {
if(!entity_list.LimitCheckGroup(id, group_spawn_limit))
return(0);
list<SpawnEntry*>::iterator cur,end;
list<SpawnEntry*> possible;
std::list<SpawnEntry*>::iterator cur,end;
std::list<SpawnEntry*> possible;
cur = list_.begin();
end = list_.end();
for(; cur != end; cur++) {
@@ -101,7 +101,7 @@ void SpawnGroup::AddSpawnEntry( SpawnEntry* newEntry ) {
}
SpawnGroup::~SpawnGroup() {
list<SpawnEntry*>::iterator cur,end;
std::list<SpawnEntry*>::iterator cur,end;
cur = list_.begin();
end = list_.end();
for(; cur != end; cur++) {
@@ -112,7 +112,7 @@ SpawnGroup::~SpawnGroup() {
}
SpawnGroupList::~SpawnGroupList() {
map<uint32, SpawnGroup*>::iterator cur,end;
std::map<uint32, SpawnGroup*>::iterator cur,end;
cur = groups.begin();
end = groups.end();
for(; cur != end; cur++) {
@@ -161,7 +161,7 @@ bool ZoneDatabase::LoadSpawnGroups(const char* zone_name, uint16 version, SpawnG
}
else
{
cerr << "Error2 in PopulateZoneLists query '" << query << "' " << errbuf << endl;
std::cerr << "Error2 in PopulateZoneLists query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return false;
}
@@ -181,13 +181,13 @@ bool ZoneDatabase::LoadSpawnGroups(const char* zone_name, uint16 version, SpawnG
if (sg)
sg->AddSpawnEntry(newSpawnEntry);
else
cout << "Error in SpawngroupID: " << row[0] << endl;
std::cout << "Error in SpawngroupID: " << row[0] << std::endl;
}
mysql_free_result(result);
}
else
{
cerr << "Error3 in PopulateZoneLists query '" << query << "' " << errbuf << endl;
std::cerr << "Error3 in PopulateZoneLists query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return false;
}
@@ -216,7 +216,7 @@ bool ZoneDatabase::LoadSpawnGroupsByID(int spawngroupid, SpawnGroupList* spawn_g
}
else
{
cerr << "Error2 in PopulateZoneLists query '" << query << "' " << errbuf << endl;
std::cerr << "Error2 in PopulateZoneLists query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return false;
}
@@ -232,13 +232,13 @@ bool ZoneDatabase::LoadSpawnGroupsByID(int spawngroupid, SpawnGroupList* spawn_g
if (sg)
sg->AddSpawnEntry(newSpawnEntry);
else
cout << "Error in SpawngroupID: " << row[0] << endl;
std::cout << "Error in SpawngroupID: " << row[0] << std::endl;
}
mysql_free_result(result);
}
else
{
cerr << "Error3 in PopulateZoneLists query '" << query << "' " << errbuf << endl;
std::cerr << "Error3 in PopulateZoneLists query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return false;
}
+2 -3
View File
@@ -23,7 +23,6 @@
#include <map>
#include <list>
using namespace std;
class SpawnEntry
{
@@ -52,7 +51,7 @@ public:
uint32 despawn_timer;
private:
char name_[120];
list<SpawnEntry*> list_;
std::list<SpawnEntry*> list_;
uint8 group_spawn_limit; //max # of this entry which can be spawned by this group
};
@@ -67,7 +66,7 @@ public:
bool RemoveSpawnGroup(uint32 in_id);
private:
//LinkedList<SpawnGroup*> list_;
map<uint32, SpawnGroup*> groups;
std::map<uint32, SpawnGroup*> groups;
};
#endif
+2 -2
View File
@@ -3755,7 +3755,7 @@ int16 Client::CalcAAFocus(focusType type, uint32 aa_ID, uint16 spell_id)
return 0;
}
for (map<uint32, AA_Ability>::const_iterator iter = aa_effects[aa_ID].begin(); iter != aa_effects[aa_ID].end(); ++iter)
for (std::map<uint32, AA_Ability>::const_iterator iter = aa_effects[aa_ID].begin(); iter != aa_effects[aa_ID].end(); ++iter)
{
effect = iter->second.skill_id;
base1 = iter->second.base1;
@@ -4638,7 +4638,7 @@ int16 Client::GetSympatheticFocusEffect(focusType type, uint16 spell_id) {
uint8 SizeProcList = 0;
uint8 MAX_SYMPATHETIC = 10;
vector<int> SympatheticProcList;
std::vector<int> SympatheticProcList;
//item focus
if (itembonuses.FocusEffects[type]){
+9 -7
View File
@@ -83,13 +83,15 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
#include "../common/bodytypes.h"
#include "../common/classes.h"
#include "../common/rulesys.h"
#include "../common/StringUtil.h"
#include <math.h>
#include <assert.h>
#ifndef WIN32
// #include <pthread.h>
#include <stdlib.h>
#include "../common/unix.h"
#include <stdlib.h>
#include "../common/unix.h"
#endif
#ifdef _GOTFRAGS
#include "../common/packet_dump_file.h"
#endif
@@ -1951,8 +1953,8 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16
while(angle_end > 360.0f)
angle_end -= 360.0f;
list<Mob*> targets_in_range;
list<Mob*>::iterator iter;
std::list<Mob*> targets_in_range;
std::list<Mob*>::iterator iter;
entity_list.GetTargetsForConeArea(this, spells[spell_id].aoerange, spells[spell_id].aoerange / 2, targets_in_range);
iter = targets_in_range.begin();
@@ -2715,7 +2717,7 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid
int buffslot, ret, caster_level, emptyslot = -1;
bool will_overwrite = false;
vector<int> overwrite_slots;
std::vector<int> overwrite_slots;
if(level_override > 0)
caster_level = level_override;
@@ -2825,7 +2827,7 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid
// to remove some other buffs already worn if will_overwrite is true
if(will_overwrite)
{
vector<int>::iterator cur, end;
std::vector<int>::iterator cur, end;
cur = overwrite_slots.begin();
end = overwrite_slots.end();
for(; cur != end; cur++) {
+18 -17
View File
@@ -28,6 +28,7 @@ Copyright (C) 2001-2008 EQEMu Development Team (http://eqemulator.net)
#endif
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/rulesys.h"
#include "masterentity.h"
#include "../common/features.h"
@@ -381,7 +382,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) {
}
int UpdatedActivityCount = 0;
string UpdateActivityQuery = ActivityQuery;
std::string UpdateActivityQuery = ActivityQuery;
char *buf = 0;
for(int Activity=0; Activity<Tasks[TaskID]->ActivityCount; Activity++) {
@@ -812,8 +813,8 @@ void ClientTaskState::EnableTask(int CharID, int TaskCount, int *TaskList) {
// Check if the Task is already enabled for this client
//
vector<int> TasksEnabled;
vector<int>::iterator Iterator;
std::vector<int> TasksEnabled;
std::vector<int>::iterator Iterator;
for(int i=0; i<TaskCount; i++) {
Iterator = EnabledTasks.begin();
@@ -843,7 +844,7 @@ void ClientTaskState::EnableTask(int CharID, int TaskCount, int *TaskList) {
if(TasksEnabled.size() == 0 ) return;
string TaskQuery="REPLACE INTO character_enabledtasks (charid, taskid) VALUES ";
std::string TaskQuery="REPLACE INTO character_enabledtasks (charid, taskid) VALUES ";
const char *ERR_MYSQLERROR = "[TASKS]Error in ClientTaskState::EnableTask %s %s";
@@ -876,8 +877,8 @@ void ClientTaskState::DisableTask(int CharID, int TaskCount, int *TaskList) {
// Check if the Task is enabled for this client
//
vector<int> TasksDisabled;
vector<int>::iterator Iterator;
std::vector<int> TasksDisabled;
std::vector<int>::iterator Iterator;
for(int i=0; i<TaskCount; i++) {
Iterator = EnabledTasks.begin();
@@ -903,7 +904,7 @@ void ClientTaskState::DisableTask(int CharID, int TaskCount, int *TaskList) {
if(TasksDisabled.size() == 0) return;
string TaskQuery="DELETE FROM character_enabledtasks WHERE ";
std::string TaskQuery="DELETE FROM character_enabledtasks WHERE ";
const char *ERR_MYSQLERROR = "[TASKS]Error in ClientTaskState::DisableTask %s %s";
@@ -939,7 +940,7 @@ void ClientTaskState::DisableTask(int CharID, int TaskCount, int *TaskList) {
bool ClientTaskState::IsTaskEnabled(int TaskID) {
vector<int>::iterator Iterator;
std::vector<int>::iterator Iterator;
Iterator = EnabledTasks.begin();
@@ -1015,7 +1016,7 @@ int TaskManager::FirstTaskInSet(int TaskSetID) {
if(TaskSets[TaskSetID].size() == 0) return 0;
vector<int>::iterator Iterator = TaskSets[TaskSetID].begin();
std::vector<int>::iterator Iterator = TaskSets[TaskSetID].begin();
while(Iterator != TaskSets[TaskSetID].end()) {
if((*Iterator) > 0)
@@ -1079,7 +1080,7 @@ void TaskManager::TaskSetSelector(Client *c, ClientTaskState *state, Mob *mob, i
if(TaskSets[TaskSetID][0] == 0) {
_log(TASKS__UPDATE, "TaskSets[%i][0] == 0. All Tasks in Set enabled.", TaskSetID);
vector<int>::iterator Iterator = TaskSets[TaskSetID].begin();
std::vector<int>::iterator Iterator = TaskSets[TaskSetID].begin();
while((Iterator != TaskSets[TaskSetID].end()) && (TaskListIndex < MAXCHOOSERENTRIES)) {
if(AppropriateLevel((*Iterator), PlayerLevel) && !state->IsTaskActive((*Iterator)) &&
@@ -1487,7 +1488,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) {
if(AllActivitiesComplete && RuleB(TaskSystem, RecordCompletedTasks)) {
if(RuleB(TasksSystem, KeepOneRecordPerCompletedTask)) {
_log(TASKS__UPDATE, "KeepOneRecord enabled");
vector<CompletedTaskInformation>::iterator Iterator = CompletedTasks.begin();
std::vector<CompletedTaskInformation>::iterator Iterator = CompletedTasks.begin();
int ErasedElements = 0;
while(Iterator != CompletedTasks.end()) {
int TaskID = (*Iterator).TaskID;
@@ -1560,7 +1561,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) {
// the same task again, erase the previous completed entry for this task.
if(RuleB(TasksSystem, KeepOneRecordPerCompletedTask)) {
_log(TASKS__UPDATE, "KeepOneRecord enabled");
vector<CompletedTaskInformation>::iterator Iterator = CompletedTasks.begin();
std::vector<CompletedTaskInformation>::iterator Iterator = CompletedTasks.begin();
int ErasedElements = 0;
while(Iterator != CompletedTasks.end()) {
int TaskID = (*Iterator).TaskID;
@@ -2025,7 +2026,7 @@ void ClientTaskState::RewardTask(Client *c, TaskInformation *Task) {
if(!Task || !c) return;
const Item_Struct* Item;
vector<int> RewardList;
std::vector<int> RewardList;
switch(Task->RewardMethod) {
@@ -2069,7 +2070,7 @@ void ClientTaskState::RewardTask(Client *c, TaskInformation *Task) {
Silver = Copper / 10;
Copper = Copper - (Silver * 10);
string CashMessage;
std::string CashMessage;
if (Plat>0){
CashMessage = "You receive ";
@@ -2908,7 +2909,7 @@ void TaskManager::SendActiveTaskDescription(Client *c, int TaskID, int SequenceN
+ sizeof(TaskDescriptionData1_Struct) + strlen(Tasks[TaskID]->Description) + 1
+ sizeof(TaskDescriptionData2_Struct) + 1 + sizeof(TaskDescriptionTrailer_Struct);
string RewardText;
std::string RewardText;
int ItemID = 0;
// If there is an item make the Reward text into a link to the item (only the first item if a list
@@ -3427,9 +3428,9 @@ int TaskGoalListManager::GetFirstEntry(int ListID) {
return TaskGoalLists[ListIndex].GoalItemEntries[0];
}
vector<int> TaskGoalListManager::GetListContents(int ListID) {
std::vector<int> TaskGoalListManager::GetListContents(int ListID) {
vector<int> ListContents;
std::vector<int> ListContents;
int ListIndex = GetListByID(ListID);
+5 -8
View File
@@ -25,9 +25,6 @@ Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
#include <vector>
#include <queue>
using namespace std;
#define MAXTASKS 10000
#define MAXTASKSETS 1000
// The Client has a hard cap of 19 active tasks
@@ -68,7 +65,7 @@ public:
int GetListByID(int ListID);
bool IsInList(int ListID, int Entry);
int GetFirstEntry(int ListID);
vector<int> GetListContents(int ListIndex);
std::vector<int> GetListContents(int ListIndex);
private:
@@ -91,7 +88,7 @@ public:
int CheckProximities(float X, float Y, float Z);
private:
vector<TaskProximity> TaskProximities;
std::vector<TaskProximity> TaskProximities;
};
typedef enum { METHODSINGLEID = 0, METHODLIST = 1, METHODQUEST = 2 } TaskMethodType;
@@ -210,8 +207,8 @@ private:
void IncrementDoneCount(Client *c, TaskInformation *Task, int TaskIndex, int ActivityID, int Count=1);
int ActiveTaskCount;
ClientTaskInformation ActiveTasks[MAXACTIVETASKS];
vector<int>EnabledTasks;
vector<CompletedTaskInformation> CompletedTasks;
std::vector<int>EnabledTasks;
std::vector<CompletedTaskInformation> CompletedTasks;
int LastCompletedTaskLoaded;
bool CheckedTouchActivities;
};
@@ -254,7 +251,7 @@ private:
TaskGoalListManager GoalListManager;
TaskProximityManager ProximityManager;
TaskInformation* Tasks[MAXTASKS];
vector<int> TaskSets[MAXTASKSETS];
std::vector<int> TaskSets[MAXTASKSETS];
void SendActiveTaskDescription(Client *c, int TaskID, int SequenceNumber, int StartTime, int Duration, bool BringUpTaskJournal=false);
};
+11 -11
View File
@@ -19,7 +19,7 @@
#include "../common/eq_packet_structs.h"
#include "masterentity.h"
#include "titles.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "worldserver.h"
extern WorldServer worldserver;
@@ -73,9 +73,9 @@ bool TitleManager::LoadTitles()
EQApplicationPacket *TitleManager::MakeTitlesPacket(Client *c)
{
vector<TitleEntry>::iterator Iterator;
std::vector<TitleEntry>::iterator Iterator;
vector<TitleEntry> AvailableTitles;
std::vector<TitleEntry> AvailableTitles;
uint32 Length = 4;
@@ -122,7 +122,7 @@ int TitleManager::NumberOfAvailableTitles(Client *c)
{
int Count = 0;
vector<TitleEntry>::iterator Iterator;
std::vector<TitleEntry>::iterator Iterator;
Iterator = Titles.begin();
@@ -137,9 +137,9 @@ int TitleManager::NumberOfAvailableTitles(Client *c)
return Count;
}
string TitleManager::GetPrefix(int TitleID)
std::string TitleManager::GetPrefix(int TitleID)
{
vector<TitleEntry>::iterator Iterator;
std::vector<TitleEntry>::iterator Iterator;
Iterator = Titles.begin();
@@ -154,9 +154,9 @@ string TitleManager::GetPrefix(int TitleID)
return "";
}
string TitleManager::GetSuffix(int TitleID)
std::string TitleManager::GetSuffix(int TitleID)
{
vector<TitleEntry>::iterator Iterator;
std::vector<TitleEntry>::iterator Iterator;
Iterator = Titles.begin();
@@ -171,7 +171,7 @@ string TitleManager::GetSuffix(int TitleID)
return "";
}
bool TitleManager::IsClientEligibleForTitle(Client *c, vector<TitleEntry>::iterator Title)
bool TitleManager::IsClientEligibleForTitle(Client *c, std::vector<TitleEntry>::iterator Title)
{
if((Title->CharID >= 0) && (c->CharacterID() != static_cast<uint32>(Title->CharID)))
return false;
@@ -212,7 +212,7 @@ bool TitleManager::IsClientEligibleForTitle(Client *c, vector<TitleEntry>::itera
bool TitleManager::IsNewAATitleAvailable(int AAPoints, int Class)
{
vector<TitleEntry>::iterator Iterator;
std::vector<TitleEntry>::iterator Iterator;
Iterator = Titles.begin();
@@ -229,7 +229,7 @@ bool TitleManager::IsNewAATitleAvailable(int AAPoints, int Class)
bool TitleManager::IsNewTradeSkillTitleAvailable(int SkillID, int SkillValue)
{
vector<TitleEntry>::iterator Iterator;
std::vector<TitleEntry>::iterator Iterator;
Iterator = Titles.begin();
+6 -8
View File
@@ -25,8 +25,6 @@
class Client;
class EQApplicationPacket;
using namespace std;
struct TitleEntry
{
int TitleID;
@@ -40,8 +38,8 @@ struct TitleEntry
int CharID;
int Status;
int ItemID;
string Prefix;
string Suffix;
std::string Prefix;
std::string Suffix;
int TitleSet;
};
@@ -53,17 +51,17 @@ public:
bool LoadTitles();
EQApplicationPacket *MakeTitlesPacket(Client *c);
string GetPrefix(int TitleID);
string GetSuffix(int TitleID);
std::string GetPrefix(int TitleID);
std::string GetSuffix(int TitleID);
int NumberOfAvailableTitles(Client *c);
bool IsClientEligibleForTitle(Client *c, vector<TitleEntry>::iterator Title);
bool IsClientEligibleForTitle(Client *c, std::vector<TitleEntry>::iterator Title);
bool IsNewAATitleAvailable(int AAPoints, int Class);
bool IsNewTradeSkillTitleAvailable(int SkillID, int SkillValue);
void CreateNewPlayerTitle(Client *c, const char *Title);
void CreateNewPlayerSuffix(Client *c, const char *Suffix);
protected:
vector<TitleEntry> Titles;
std::vector<TitleEntry> Titles;
};
extern TitleManager title_manager;
+5 -4
View File
@@ -31,6 +31,7 @@
#include "titles.h"
#include "StringIDs.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/rulesys.h"
#include "QuestParserCollection.h"
@@ -843,7 +844,7 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) {
int16 higher_from_int_wis = (GetINT() > GetWIS()) ? GetINT() : GetWIS();
int16 bonusstat = (higher_from_int_wis > thirdstat) ? higher_from_int_wis : thirdstat;
vector< pair<uint32,uint8> >::iterator itr;
std::vector< std::pair<uint32,uint8> >::iterator itr;
//calculate the base success chance
@@ -1401,7 +1402,7 @@ bool ZoneDatabase::GetTradeRecipe(uint32 recipe_id, uint8 c_type, uint32 some_id
row = mysql_fetch_row(result);
uint32 item = (uint32)atoi(row[0]);
uint8 num = (uint8) atoi(row[1]);
spec->onsuccess.push_back(pair<uint32,uint8>(item, num));
spec->onsuccess.push_back(std::pair<uint32,uint8>(item, num));
}
mysql_free_result(result);
@@ -1418,7 +1419,7 @@ bool ZoneDatabase::GetTradeRecipe(uint32 recipe_id, uint8 c_type, uint32 some_id
row = mysql_fetch_row(result);
uint32 item = (uint32)atoi(row[0]);
uint8 num = (uint8) atoi(row[1]);
spec->onfail.push_back(pair<uint32,uint8>(item, num));
spec->onfail.push_back(std::pair<uint32,uint8>(item, num));
}
mysql_free_result(result);
}
@@ -1435,7 +1436,7 @@ bool ZoneDatabase::GetTradeRecipe(uint32 recipe_id, uint8 c_type, uint32 some_id
row = mysql_fetch_row(result);
uint32 item = (uint32)atoi(row[0]);
uint8 num = (uint8)atoi(row[1]);
spec->salvage.push_back(pair<uint32,uint8>(item, num));
spec->salvage.push_back(std::pair<uint32,uint8>(item, num));
}
mysql_free_result(result);
}
+6 -6
View File
@@ -18,7 +18,7 @@
#include "../common/debug.h"
#include "masterentity.h"
#include "StringIDs.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/rulesys.h"
#include "QuestParserCollection.h"
#include "worldserver.h"
@@ -856,7 +856,7 @@ void Client::Trader_EndTrader() {
void Client::SendTraderItem(uint32 ItemID, uint16 Quantity) {
string Packet;
std::string Packet;
int16 FreeSlotID=0;
const Item_Struct* item = database.GetItem(ItemID);
@@ -1381,7 +1381,7 @@ void Client::SendBazaarResults(uint32 TraderID, uint32 Class_, uint32 Race, uint
char errbuf[MYSQL_ERRMSG_SIZE];
char* Query = 0;
string Search, Values;
std::string Search, Values;
MYSQL_RES *Result;
MYSQL_ROW Row;
char Tmp[100] = {0};
@@ -1399,7 +1399,7 @@ void Client::SendBazaarResults(uint32 TraderID, uint32 Class_, uint32 Race, uint
}
}
string SearchrResults;
std::string SearchrResults;
if(MinPrice != 0){
sprintf(Tmp, " and trader.item_cost>=%i", MinPrice);
@@ -2017,7 +2017,7 @@ void Client::SendBuyerResults(char* SearchString, uint32 SearchID) {
char errbuf[MYSQL_ERRMSG_SIZE];
char* Query = 0;
char ItemName[64];
string Search, Values;
std::string Search, Values;
MYSQL_RES *Result;
MYSQL_ROW Row;
@@ -2150,7 +2150,7 @@ void Client::ShowBuyLines(const EQApplicationPacket *app) {
char errbuf[MYSQL_ERRMSG_SIZE];
char* Query = 0;
char ItemName[64];
string Search, Values;
std::string Search, Values;
MYSQL_RES *Result;
MYSQL_ROW Row;
+1
View File
@@ -21,6 +21,7 @@
#include "masterentity.h"
#include "../common/spdat.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
/*
+5 -7
View File
@@ -24,8 +24,6 @@
#include <string>
#include <map>
using namespace std;
#ifdef _WINDOWS
#include <windows.h>
#include <winsock.h>
@@ -58,12 +56,12 @@ public:
TributeLevel_Struct tiers[MAX_TRIBUTE_TIERS];
uint8 tier_count;
uint32 unknown;
string name;
string description;
std::string name;
std::string description;
bool is_guild; //is a guild tribute item
};
map<uint32, TributeData> tribute_list;
std::map<uint32, TributeData> tribute_list;
void Client::ToggleTribute(bool enabled) {
if(enabled) {
@@ -309,7 +307,7 @@ void Client::AddTributePoints(int32 ammount) {
void Client::SendTributes() {
map<uint32, TributeData>::iterator cur,end;
std::map<uint32, TributeData>::iterator cur,end;
cur = tribute_list.begin();
end = tribute_list.end();
@@ -343,7 +341,7 @@ void Client::SendTributes() {
void Client::SendGuildTributes() {
map<uint32, TributeData>::iterator cur,end;
std::map<uint32, TributeData>::iterator cur,end;
cur = tribute_list.begin();
end = tribute_list.end();
+1 -2
View File
@@ -23,7 +23,6 @@
#include "../common/timer.h"
#include <map>
using namespace std;
/*typedef enum {
updateMobPOS = 1,
@@ -55,7 +54,7 @@ public:
bool ack;
};
typedef map<uint32, UMType > UMMap;
typedef std::map<uint32, UMType > UMMap;
class UpdateManager {
protected:
+2 -1
View File
@@ -23,7 +23,8 @@
#include <float.h>
#include "watermap.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#ifdef _WINDOWS
#define snprintf _snprintf
#endif
+10 -10
View File
@@ -18,7 +18,6 @@
#include "../common/debug.h"
#ifdef _EQDEBUG
#include <iostream>
using namespace std;
#endif
//#include <iomanip>
#include <stdlib.h>
@@ -31,6 +30,7 @@ using namespace std;
#include "../common/moremath.h"
#include "StringIDs.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/rulesys.h"
#include "../common/features.h"
#include "QuestParserCollection.h"
@@ -70,7 +70,7 @@ void NPC::DisplayWaypointInfo(Client *c) {
GetMaxWp() );
vector<wplist>::iterator cur, end;
std::vector<wplist>::iterator cur, end;
cur = Waypoints.begin();
end = Waypoints.end();
for(; cur != end; cur++) {
@@ -216,7 +216,7 @@ void NPC::UpdateWaypoint(int wp_index)
mlog(AI__WAYPOINTS, "Update to waypoint %d failed. Not found.", wp_index);
return;
}
vector<wplist>::iterator cur;
std::vector<wplist>::iterator cur;
cur = Waypoints.begin();
cur += wp_index;
@@ -267,9 +267,9 @@ void NPC::CalculateNewWaypoint()
}
case 1: //10 closest
{
list<wplist> closest;
std::list<wplist> closest;
GetClosestWaypoint(closest, 10, GetX(), GetY(), GetZ());
list<wplist>::iterator iter = closest.begin();
std::list<wplist>::iterator iter = closest.begin();
if(closest.size() != 0)
{
int idx = MakeRandomInt(0, closest.size() - 1);
@@ -327,10 +327,10 @@ void NPC::CalculateNewWaypoint()
}
case 5: //pick random closest 5 and pick one that's in sight
{
list<wplist> closest;
std::list<wplist> closest;
GetClosestWaypoint(closest, 5, GetX(), GetY(), GetZ());
list<wplist>::iterator iter = closest.begin();
std::list<wplist>::iterator iter = closest.begin();
while(iter != closest.end())
{
if(CheckLosFN((*iter).x, (*iter).y, (*iter).z, GetSize()))
@@ -373,7 +373,7 @@ bool wp_distance_pred(const wp_distance& left, const wp_distance& right)
return left.dist < right.dist;
}
void NPC::GetClosestWaypoint(list<wplist> &wp_list, int count, float m_x, float m_y, float m_z)
void NPC::GetClosestWaypoint(std::list<wplist> &wp_list, int count, float m_x, float m_y, float m_z)
{
wp_list.clear();
if(Waypoints.size() <= count)
@@ -385,7 +385,7 @@ void NPC::GetClosestWaypoint(list<wplist> &wp_list, int count, float m_x, float
return;
}
list<wp_distance> distances;
std::list<wp_distance> distances;
for(int i = 0; i < Waypoints.size(); ++i)
{
float cur_x = (Waypoints[i].x - m_x);
@@ -402,7 +402,7 @@ void NPC::GetClosestWaypoint(list<wplist> &wp_list, int count, float m_x, float
}
distances.sort(wp_distance_pred);
list<wp_distance>::iterator iter = distances.begin();
std::list<wp_distance>::iterator iter = distances.begin();
for(int i = 0; i < count; ++i)
{
wp_list.push_back(Waypoints[(*iter).index]);
+17 -21
View File
@@ -17,7 +17,6 @@
*/
#include "../common/debug.h"
#include <iostream>
using namespace std;
#include <string.h>
#include <stdio.h>
#include <iomanip>
@@ -29,9 +28,6 @@ using namespace std;
#include <process.h>
#define snprintf _snprintf
#if (_MSC_VER < 1500)
#define vsnprintf _vsnprintf
#endif
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#endif
@@ -168,7 +164,7 @@ void WorldServer::Process() {
break;
}
case ServerOP_ZAAuthFailed: {
cout << "World server responded 'Not Authorized', disabling reconnect" << endl;
std::cout << "World server responded 'Not Authorized', disabling reconnect" << std::endl;
pTryReconnect = false;
Disconnect();
break;
@@ -454,7 +450,7 @@ void WorldServer::Process() {
}
case ServerOP_ZoneShutdown: {
if (pack->size != sizeof(ServerZoneStateChange_struct)) {
cout << "Wrong size on ServerOP_ZoneShutdown. Got: " << pack->size << ", Expected: " << sizeof(ServerZoneStateChange_struct) << endl;
std::cout << "Wrong size on ServerOP_ZoneShutdown. Got: " << pack->size << ", Expected: " << sizeof(ServerZoneStateChange_struct) << std::endl;
break;
}
// Annouce the change to the world
@@ -465,14 +461,14 @@ void WorldServer::Process() {
SendEmoteMessage(0, 0, 15, "Zone shutdown: %s", zone->GetLongName());
ServerZoneStateChange_struct* zst = (ServerZoneStateChange_struct *) pack->pBuffer;
cout << "Zone shutdown by " << zst->adminname << endl;
std::cout << "Zone shutdown by " << zst->adminname << std::endl;
Zone::Shutdown();
}
break;
}
case ServerOP_ZoneBootup: {
if (pack->size != sizeof(ServerZoneStateChange_struct)) {
cout << "Wrong size on ServerOP_ZoneBootup. Got: " << pack->size << ", Expected: " << sizeof(ServerZoneStateChange_struct) << endl;
std::cout << "Wrong size on ServerOP_ZoneBootup. Got: " << pack->size << ", Expected: " << sizeof(ServerZoneStateChange_struct) << std::endl;
break;
}
ServerZoneStateChange_struct* zst = (ServerZoneStateChange_struct *) pack->pBuffer;
@@ -489,7 +485,7 @@ void WorldServer::Process() {
}
if (zst->adminname[0] != 0)
cout << "Zone bootup by " << zst->adminname << endl;
std::cout << "Zone bootup by " << zst->adminname << std::endl;
if (!(Zone::Bootup(zst->zoneid, zst->instanceid, zst->makestatic))) {
SendChannelMessage(0, 0, 10, 0, 0, "%s:%i Zone::Bootup failed: %s", net.GetZoneAddress(), net.GetZonePort(), database.GetZoneName(zst->zoneid));
@@ -501,7 +497,7 @@ void WorldServer::Process() {
}
case ServerOP_ZoneIncClient: {
if (pack->size != sizeof(ServerZoneIncommingClient_Struct)) {
cout << "Wrong size on ServerOP_ZoneIncClient. Got: " << pack->size << ", Expected: " << sizeof(ServerZoneIncommingClient_Struct) << endl;
std::cout << "Wrong size on ServerOP_ZoneIncClient. Got: " << pack->size << ", Expected: " << sizeof(ServerZoneIncommingClient_Struct) << std::endl;
break;
}
ServerZoneIncommingClient_Struct* szic = (ServerZoneIncommingClient_Struct*) pack->pBuffer;
@@ -595,7 +591,7 @@ void WorldServer::Process() {
}
case ServerOP_GMGoto: {
if (pack->size != sizeof(ServerGMGoto_Struct)) {
cout << "Wrong size on ServerOP_GMGoto. Got: " << pack->size << ", Expected: " << sizeof(ServerGMGoto_Struct) << endl;
std::cout << "Wrong size on ServerOP_GMGoto. Got: " << pack->size << ", Expected: " << sizeof(ServerGMGoto_Struct) << std::endl;
break;
}
if (!ZoneLoaded)
@@ -634,7 +630,7 @@ void WorldServer::Process() {
}
case ServerOP_Uptime: {
if (pack->size != sizeof(ServerUptime_Struct)) {
cout << "Wrong size on ServerOP_Uptime. Got: " << pack->size << ", Expected: " << sizeof(ServerUptime_Struct) << endl;
std::cout << "Wrong size on ServerOP_Uptime. Got: " << pack->size << ", Expected: " << sizeof(ServerUptime_Struct) << std::endl;
break;
}
ServerUptime_Struct* sus = (ServerUptime_Struct*) pack->pBuffer;
@@ -654,7 +650,7 @@ void WorldServer::Process() {
this->SendEmoteMessage(sus->adminname, 0, 0, "Zone #%i Uptime: %02im %02is", sus->zoneserverid, m, s);
}
case ServerOP_Petition: {
cout << "Got Server Requested Petition List Refresh" << endl;
std::cout << "Got Server Requested Petition List Refresh" << std::endl;
ServerPetitionUpdate_Struct* sus = (ServerPetitionUpdate_Struct*) pack->pBuffer;
// solar: this was typoed to = instead of ==, not that it acts any different now though..
if (sus->status == 0) petition_list.ReadDatabase();
@@ -723,7 +719,7 @@ void WorldServer::Process() {
break;
}
case ServerOP_ZoneReboot: {
cout << "Got Server Requested Zone reboot" << endl;
std::cout << "Got Server Requested Zone reboot" << std::endl;
ServerZoneReboot_Struct* zb = (ServerZoneReboot_Struct*) pack->pBuffer;
// printf("%i\n",zb->zoneid);
struct in_addr in;
@@ -733,12 +729,12 @@ void WorldServer::Process() {
snprintf(buffer,200,". %s %i %s",zb->ip2, zb->port, inet_ntoa(in));
if(zb->zoneid != 0) {
snprintf(buffer,200,"%s %s %i %s",database.GetZoneName(zb->zoneid),zb->ip2, zb->port ,inet_ntoa(in));
cout << "executing: " << buffer;
std::cout << "executing: " << buffer;
ShellExecute(0,"Open",net.GetZoneFileName(), buffer, 0, SW_SHOWDEFAULT);
}
else
{
cout << "executing: " << net.GetZoneFileName() << " " << buffer;
std::cout << "executing: " << net.GetZoneFileName() << " " << buffer;
ShellExecute(0,"Open",net.GetZoneFileName(), buffer, 0, SW_SHOWDEFAULT);
}
#else
@@ -753,7 +749,7 @@ void WorldServer::Process() {
}
case ServerOP_SyncWorldTime: {
if(zone!=0) {
cout << "Received Message SyncWorldTime" << endl;
std::cout << "Received Message SyncWorldTime" << std::endl;
eqTimeOfDay* newtime = (eqTimeOfDay*) pack->pBuffer;
zone->zone_time.setEQTimeOfDay(newtime->start_eqtime, newtime->start_realtime);
EQApplicationPacket* outapp = new EQApplicationPacket(OP_TimeOfDay, sizeof(TimeOfDay_Struct));
@@ -774,7 +770,7 @@ void WorldServer::Process() {
eqTime.minute,
(eqTime.hour >= 13) ? "pm" : "am"
);
cout << "Time Broadcast Packet: " << timeMessage << endl;
std::cout << "Time Broadcast Packet: " << timeMessage << std::endl;
zone->GotCurTime(true);
//}
//Test
@@ -783,7 +779,7 @@ void WorldServer::Process() {
}
case ServerOP_ChangeWID: {
if (pack->size != sizeof(ServerChangeWID_Struct)) {
cout << "Wrong size on ServerChangeWID_Struct. Got: " << pack->size << ", Expected: " << sizeof(ServerChangeWID_Struct) << endl;
std::cout << "Wrong size on ServerChangeWID_Struct. Got: " << pack->size << ", Expected: " << sizeof(ServerChangeWID_Struct) << std::endl;
break;
}
ServerChangeWID_Struct* scw = (ServerChangeWID_Struct*) pack->pBuffer;
@@ -1819,8 +1815,8 @@ void WorldServer::Process() {
break;
}
default: {
cout << " Unknown ZSopcode:" << (int)pack->opcode;
cout << " size:" << pack->size << endl;
std::cout << " Unknown ZSopcode:" << (int)pack->opcode;
std::cout << " size:" << pack->size << std::endl;
break;
}
}
+27 -28
View File
@@ -17,7 +17,6 @@
*/
#include "../common/debug.h"
#include <iostream>
using namespace std;
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -46,7 +45,7 @@ using namespace std;
#include "../common/packet_dump_file.h"
#include "../common/EQStreamFactory.h"
#include "../common/EQStream.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "ZoneConfig.h"
#include "../common/breakdowns.h"
#include "map.h"
@@ -91,7 +90,7 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) {
if (iZoneID == 0 || zonename == 0)
return false;
if (zone != 0 || ZoneLoaded) {
cerr << "Error: Zone::Bootup call when zone already booted!" << endl;
std::cerr << "Error: Zone::Bootup call when zone already booted!" << std::endl;
worldserver.SetZone(0);
return false;
}
@@ -104,7 +103,7 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) {
//init the zone, loads all the data, etc
if (!zone->Init(iStaticZone)) {
safe_delete(zone);
cerr << "Zone->Init failed" << endl;
std::cerr << "Zone->Init failed" << std::endl;
worldserver.SetZone(0);
return false;
}
@@ -1154,7 +1153,7 @@ bool Zone::Init(bool iStaticZone) {
if(RuleManager::Instance()->GetActiveRulesetID() != default_ruleset)
{
string r_name = RuleManager::Instance()->GetRulesetName(&database, default_ruleset);
std::string r_name = RuleManager::Instance()->GetRulesetName(&database, default_ruleset);
if(r_name.size() > 0)
{
RuleManager::Instance()->LoadRules(&database, r_name.c_str());
@@ -1719,7 +1718,7 @@ bool ZoneDatabase::LoadStaticZonePoints(LinkedList<ZonePoint*>* zone_point_list,
}
else
{
cerr << "Error1 in LoadStaticZonePoints query '" << query << "' " << errbuf << endl;
std::cerr << "Error1 in LoadStaticZonePoints query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return false;
}
@@ -1731,7 +1730,7 @@ bool ZoneDatabase::DumpZoneState() {
char *query = 0;
if (!RunQuery(query, MakeAnyLenString(&query, "DELETE FROM zone_state_dump WHERE zonename='%s'", zone->GetShortName()), errbuf)) {
cerr << "Error in DumpZoneState query '" << query << "' " << errbuf << endl;
std::cerr << "Error in DumpZoneState query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return false;
}
@@ -1745,7 +1744,7 @@ bool ZoneDatabase::DumpZoneState() {
uint32 gmspawntype_count = 0;
entity_list.CountNPC(&npc_count, &npcloot_count, &gmspawntype_count);
cout << "DEBUG: spawn2count=" << spawn2_count << ", npc_count=" << npc_count << ", npcloot_count=" << npcloot_count << ", gmspawntype_count=" << gmspawntype_count << endl;
std::cout << "DEBUG: spawn2count=" << spawn2_count << ", npc_count=" << npc_count << ", npcloot_count=" << npcloot_count << ", gmspawntype_count=" << gmspawntype_count << std::endl;
ZSDump_Spawn2* spawn2_dump = 0;
ZSDump_NPC* npc_dump = 0;
@@ -1812,13 +1811,13 @@ bool ZoneDatabase::DumpZoneState() {
if (!RunQuery(query, (uint32) (end - query), errbuf, 0, &affected_rows)) {
// if (DoEscapeString(query, (unsigned int) (end - query))) {
safe_delete_array(query);
cerr << "Error in ZoneDump query " << errbuf << endl;
std::cerr << "Error in ZoneDump query " << errbuf << std::endl;
return false;
}
safe_delete_array(query);
if (affected_rows == 0) {
cerr << "Zone dump failed. (affected rows = 0)" << endl;
std::cerr << "Zone dump failed. (affected rows = 0)" << std::endl;
return false;
}
return true;
@@ -1848,13 +1847,13 @@ int8 ZoneDatabase::LoadZoneState(const char* zonename, LinkedList<Spawn2*>& spaw
safe_delete_array(query);
if (mysql_num_rows(result) == 1) {
row = mysql_fetch_row(result);
cout << "Elapsed time: " << row[8] << endl;
std::cout << "Elapsed time: " << row[8] << std::endl;
elapsedtime = atoi(row[8]) * 1000;
lengths = mysql_fetch_lengths(result);
spawn2_count = atoi(row[0]);
cout << "Spawn2count: " << spawn2_count << endl;
std::cout << "Spawn2count: " << spawn2_count << std::endl;
if (lengths[4] != (sizeof(ZSDump_Spawn2) * spawn2_count)) {
cerr << "Error in LoadZoneState: spawn2_dump length mismatch l=" << lengths[4] << ", e=" << (sizeof(ZSDump_Spawn2) * spawn2_count) << endl;
std::cerr << "Error in LoadZoneState: spawn2_dump length mismatch l=" << lengths[4] << ", e=" << (sizeof(ZSDump_Spawn2) * spawn2_count) << std::endl;
CleanupLoadZoneState(spawn2_count, &spawn2_dump, &npc_dump, &npcloot_dump, &gmspawntype_dump, &spawn2_loaded, &npc_loaded, &result);
return -1;
}
@@ -1870,7 +1869,7 @@ int8 ZoneDatabase::LoadZoneState(const char* zonename, LinkedList<Spawn2*>& spaw
else
spawn2_loaded[i] = LoadSpawn2(spawn2_list, spawn2_dump[i].spawn2_id, spawn2_dump[i].time_left - elapsedtime);
if (spawn2_loaded[i] == 0) {
cerr << "Error in LoadZoneState: spawn2_loaded[" << i << "] == 0" << endl;
std::cerr << "Error in LoadZoneState: spawn2_loaded[" << i << "] == 0" << std::endl;
CleanupLoadZoneState(spawn2_count, &spawn2_dump, &npc_dump, &npcloot_dump, &gmspawntype_dump, &spawn2_loaded, &npc_loaded, &result);
return -1;
@@ -1879,9 +1878,9 @@ int8 ZoneDatabase::LoadZoneState(const char* zonename, LinkedList<Spawn2*>& spaw
}
gmspawntype_count = atoi(row[3]);
cout << "gmspawntype_count: " << gmspawntype_count << endl;
std::cout << "gmspawntype_count: " << gmspawntype_count << std::endl;
if (lengths[7] != (sizeof(NPCType) * gmspawntype_count)) {
cerr << "Error in LoadZoneState: gmspawntype_dump length mismatch l=" << lengths[7] << ", e=" << (sizeof(NPCType) * gmspawntype_count) << endl;
std::cerr << "Error in LoadZoneState: gmspawntype_dump length mismatch l=" << lengths[7] << ", e=" << (sizeof(NPCType) * gmspawntype_count) << std::endl;
CleanupLoadZoneState(spawn2_count, &spawn2_dump, &npc_dump, &npcloot_dump, &gmspawntype_dump, &spawn2_loaded, &npc_loaded, &result);
return -1;
}
@@ -1891,9 +1890,9 @@ int8 ZoneDatabase::LoadZoneState(const char* zonename, LinkedList<Spawn2*>& spaw
}
npc_count = atoi(row[1]);
cout << "npc_count: " << npc_count << endl;
std::cout << "npc_count: " << npc_count << std::endl;
if (lengths[5] != (sizeof(ZSDump_NPC) * npc_count)) {
cerr << "Error in LoadZoneState: npc_dump length mismatch l=" << lengths[5] << ", e=" << (sizeof(ZSDump_NPC) * npc_count) << endl;
std::cerr << "Error in LoadZoneState: npc_dump length mismatch l=" << lengths[5] << ", e=" << (sizeof(ZSDump_NPC) * npc_count) << std::endl;
CleanupLoadZoneState(spawn2_count, &spawn2_dump, &npc_dump, &npcloot_dump, &gmspawntype_dump, &spawn2_loaded, &npc_loaded, &result);
return -1;
}
@@ -1906,14 +1905,14 @@ int8 ZoneDatabase::LoadZoneState(const char* zonename, LinkedList<Spawn2*>& spaw
memcpy(npc_dump, row[5], lengths[5]);
for (i=0; i < npc_count; i++) {
if (npc_loaded[i] != 0) {
cerr << "Error in LoadZoneState: npc_loaded[" << i << "] != 0" << endl;
std::cerr << "Error in LoadZoneState: npc_loaded[" << i << "] != 0" << std::endl;
CleanupLoadZoneState(spawn2_count, &spawn2_dump, &npc_dump, &npcloot_dump, &gmspawntype_dump, &spawn2_loaded, &npc_loaded, &result);
return -1;
}
Spawn2* tmp = 0;
if (!npc_dump[i].corpse && npc_dump[i].spawn2_dump_index != 0xFFFFFFFF) {
if (spawn2_loaded == 0 || npc_dump[i].spawn2_dump_index >= spawn2_count) {
cerr << "Error in LoadZoneState: (spawn2_loaded == 0 || index >= count) && npc_dump[" << i << "].spawn2_dump_index != 0xFFFFFFFF" << endl;
std::cerr << "Error in LoadZoneState: (spawn2_loaded == 0 || index >= count) && npc_dump[" << i << "].spawn2_dump_index != 0xFFFFFFFF" << std::endl;
CleanupLoadZoneState(spawn2_count, &spawn2_dump, &npc_dump, &npcloot_dump, &gmspawntype_dump, &spawn2_loaded, &npc_loaded, &result);
return -1;
}
@@ -1922,7 +1921,7 @@ int8 ZoneDatabase::LoadZoneState(const char* zonename, LinkedList<Spawn2*>& spaw
}
if (npc_dump[i].npctype_id == 0) {
if (npc_dump[i].gmspawntype_index == 0xFFFFFFFF) {
cerr << "Error in LoadZoneState: gmspawntype index invalid" << endl;
std::cerr << "Error in LoadZoneState: gmspawntype index invalid" << std::endl;
safe_delete(tmp);
CleanupLoadZoneState(spawn2_count, &spawn2_dump, &npc_dump, &npcloot_dump, &gmspawntype_dump, &spawn2_loaded, &npc_loaded, &result);
@@ -1930,7 +1929,7 @@ int8 ZoneDatabase::LoadZoneState(const char* zonename, LinkedList<Spawn2*>& spaw
}
else {
if (gmspawntype_dump == 0 || npc_dump[i].gmspawntype_index >= gmspawntype_count) {
cerr << "Error in LoadZoneState: (gmspawntype_dump == 0 || index >= count) && npc_dump[" << i << "].npctype_id == 0" << endl;
std::cerr << "Error in LoadZoneState: (gmspawntype_dump == 0 || index >= count) && npc_dump[" << i << "].npctype_id == 0" << std::endl;
safe_delete(tmp);
CleanupLoadZoneState(spawn2_count, &spawn2_dump, &npc_dump, &npcloot_dump, &gmspawntype_dump, &spawn2_loaded, &npc_loaded, &result);
@@ -1944,7 +1943,7 @@ int8 ZoneDatabase::LoadZoneState(const char* zonename, LinkedList<Spawn2*>& spaw
if (crap != 0)
npc_loaded[i] = new NPC(crap, tmp, npc_dump[i].x, npc_dump[i].y, npc_dump[i].z, npc_dump[i].heading, FlyMode3, npc_dump[i].corpse);
else {
cerr << "Error in LoadZoneState: Unknown npctype_id: " << npc_dump[i].npctype_id << endl;
std::cerr << "Error in LoadZoneState: Unknown npctype_id: " << npc_dump[i].npctype_id << std::endl;
safe_delete(tmp);
}
}
@@ -1962,15 +1961,15 @@ int8 ZoneDatabase::LoadZoneState(const char* zonename, LinkedList<Spawn2*>& spaw
}
npcloot_count = atoi(row[2]);
cout << "npcloot_count: " << npcloot_count << endl;
std::cout << "npcloot_count: " << npcloot_count << std::endl;
if (lengths[6] != (sizeof(ZSDump_NPC_Loot) * npcloot_count)) {
cerr << "Error in LoadZoneState: npcloot_dump length mismatch l=" << lengths[6] << ", e=" << (sizeof(ZSDump_NPC_Loot) * npcloot_count) << endl;
std::cerr << "Error in LoadZoneState: npcloot_dump length mismatch l=" << lengths[6] << ", e=" << (sizeof(ZSDump_NPC_Loot) * npcloot_count) << std::endl;
CleanupLoadZoneState(spawn2_count, &spawn2_dump, &npc_dump, &npcloot_dump, &gmspawntype_dump, &spawn2_loaded, &npc_loaded, &result);
return -1;
}
else if (npcloot_count > 0) {
if (npc_loaded == 0) {
cerr << "Error in LoadZoneState: npcloot_count > 0 && npc_loaded == 0" << endl;
std::cerr << "Error in LoadZoneState: npcloot_count > 0 && npc_loaded == 0" << std::endl;
CleanupLoadZoneState(spawn2_count, &spawn2_dump, &npc_dump, &npcloot_dump, &gmspawntype_dump, &spawn2_loaded, &npc_loaded, &result);
return -1;
}
@@ -1978,7 +1977,7 @@ int8 ZoneDatabase::LoadZoneState(const char* zonename, LinkedList<Spawn2*>& spaw
memcpy(npcloot_dump, row[6], lengths[6]);
for (i=0; i < npcloot_count; i++) {
if (npcloot_dump[i].npc_dump_index >= npc_count) {
cerr << "Error in LoadZoneState: npcloot_dump[" << i << "].npc_dump_index >= npc_count" << endl;
std::cerr << "Error in LoadZoneState: npcloot_dump[" << i << "].npc_dump_index >= npc_count" << std::endl;
CleanupLoadZoneState(spawn2_count, &spawn2_dump, &npc_dump, &npcloot_dump, &gmspawntype_dump, &spawn2_loaded, &npc_loaded, &result);
return -1;
}
@@ -1996,7 +1995,7 @@ int8 ZoneDatabase::LoadZoneState(const char* zonename, LinkedList<Spawn2*>& spaw
CleanupLoadZoneState(spawn2_count, &spawn2_dump, &npc_dump, &npcloot_dump, &gmspawntype_dump, &spawn2_loaded, &npc_loaded, &result);
}
else {
cerr << "Error in LoadZoneState query '" << query << "' " << errbuf << endl;
std::cerr << "Error in LoadZoneState query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return -1;
+14 -14
View File
@@ -185,19 +185,19 @@ public:
void LoadLDoNTrapEntries();
void LoadAdventureFlavor();
map<uint32,NPCType *> npctable;
map<uint32,NPCType *> merctable;
map<uint32,std::list<MerchantList> > merchanttable;
map<uint32,std::list<TempMerchantList> > tmpmerchanttable;
map<uint32,std::string> adventure_entry_list_flavor;
map<uint32,LDoNTrapTemplate*> ldon_trap_list;
map<uint32,std::list<LDoNTrapTemplate*> > ldon_trap_entry_list;
map<uint32,std::list<MercStanceInfo> > merc_stance_list;
map<uint32, MercTemplate> merc_templates;
map<uint32,std::list<MercSpellEntry> > merc_spells_list;
map<uint32, ZoneEXPModInfo> level_exp_mod;
list<InternalVeteranReward> VeteranRewards;
list<AltCurrencyDefinition_Struct> AlternateCurrencies;
std::map<uint32,NPCType *> npctable;
std::map<uint32,NPCType *> merctable;
std::map<uint32,std::list<MerchantList> > merchanttable;
std::map<uint32,std::list<TempMerchantList> > tmpmerchanttable;
std::map<uint32,std::string> adventure_entry_list_flavor;
std::map<uint32,LDoNTrapTemplate*> ldon_trap_list;
std::map<uint32,std::list<LDoNTrapTemplate*> > ldon_trap_entry_list;
std::map<uint32,std::list<MercStanceInfo> > merc_stance_list;
std::map<uint32, MercTemplate> merc_templates;
std::map<uint32,std::list<MercSpellEntry> > merc_spells_list;
std::map<uint32, ZoneEXPModInfo> level_exp_mod;
std::list<InternalVeteranReward> VeteranRewards;
std::list<AltCurrencyDefinition_Struct> AlternateCurrencies;
char *adv_data;
bool did_adventure_actions;
@@ -265,7 +265,7 @@ public:
void LoadTickItems();
uint32 GetSpawnKillCount(uint32 in_spawnid);
void UpdateHotzone();
unordered_map<int, item_tick_struct> tick_items;
std::unordered_map<int, item_tick_struct> tick_items;
//MODDING HOOKS
void mod_init();
+2 -4
View File
@@ -42,8 +42,6 @@
#include <vector>
#include <algorithm>
using namespace std;
#ifdef COMMON_PROFILE
CommonProfiler _cp;
#endif
@@ -248,7 +246,7 @@ void DumpZoneProfile() {
newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec,
__DZP_timer.getTotalDuration());
vector<_DZP_Data> data;
std::vector<_DZP_Data> data;
int r;
@@ -268,7 +266,7 @@ void DumpZoneProfile() {
sort(data.begin(), data.end());
vector<_DZP_Data>::iterator cur,end;
std::vector<_DZP_Data>::iterator cur,end;
cur = data.begin();
end = data.end();
+37 -39
View File
@@ -1,7 +1,7 @@
#include "zonedb.h"
#include "../common/Item.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/extprofile.h"
#include "../common/guilds.h"
#include "../common/rulesys.h"
@@ -14,8 +14,6 @@
#include <string>
#include <sstream>
using namespace std;
extern Zone* zone;
ZoneDatabase database;
@@ -272,7 +270,7 @@ bool ZoneDatabase::logevents(const char* accountname,uint32 accountid,uint8 stat
DoEscapeString(descriptiontext, description, len);
DoEscapeString(targetarr, target, len2);
if (!RunQuery(query, MakeAnyLenString(&query, "Insert into eventlog (accountname,accountid,status,charname,target,descriptiontype,description,event_nid) values('%s',%i,%i,'%s','%s','%s','%s','%i')", accountname,accountid,status,charname,targetarr,descriptiontype,descriptiontext,event_nid), errbuf)) {
cerr << "Error in logevents" << query << "' " << errbuf << endl;
std::cerr << "Error in logevents" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return false;
}
@@ -320,7 +318,7 @@ void ZoneDatabase::UpdateBug(BugStruct* bug){
"values('%s', '%s', '%s', '%.2f', '%.2f', '%.2f', '%s', %d, '%s', '%s', CURDATE())", zone->GetShortName(), bug->name,
uitext==nullptr?"":uitext, bug->y, bug->x, bug->z, bug->chartype, bug->type, targettext==nullptr?"Unknown Target":targettext,
bugtext==nullptr?"":bugtext), errbuf)) {
cerr << "Error in UpdateBug" << query << "' " << errbuf << endl;
std::cerr << "Error in UpdateBug" << query << "' " << errbuf << std::endl;
}
safe_delete_array(query);
safe_delete_array(bugtext);
@@ -336,7 +334,7 @@ void ZoneDatabase::UpdateBug(PetitionBug_Struct* bug){
memset(bugtext, 0, 2*len+1);
DoEscapeString(bugtext, bug->text, len);
if (!RunQuery(query, MakeAnyLenString(&query, "Insert into bugs (type,name,bugtext,flag) values('%s','%s','%s',%i)","Petition",bug->name,bugtext,25), errbuf)) {
cerr << "Error in UpdateBug" << query << "' " << errbuf << endl;
std::cerr << "Error in UpdateBug" << query << "' " << errbuf << std::endl;
}
safe_delete_array(query);
safe_delete_array(bugtext);
@@ -988,7 +986,7 @@ bool ZoneDatabase::NoRentExpired(const char* name){
*/
const NPCType* ZoneDatabase::GetNPCType (uint32 id) {
const NPCType *npc=nullptr;
map<uint32,NPCType *>::iterator itr;
std::map<uint32,NPCType *>::iterator itr;
// If NPC is already in tree, return it.
if((itr = zone->npctable.find(id)) != zone->npctable.end())
@@ -1267,7 +1265,7 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) {
// free item we attempted to add.
if (zone->npctable.find(tmpNPCType->npc_id) != zone->npctable.end())
{
cerr << "Error loading duplicate NPC " << tmpNPCType->npc_id << endl;
std::cerr << "Error loading duplicate NPC " << tmpNPCType->npc_id << std::endl;
delete tmpNPCType;
npc = nullptr;
} else {
@@ -1282,7 +1280,7 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) {
mysql_free_result(result);
}
} else
cerr << "Error loading NPCs from database. Bad query: " << errbuf << endl;
std::cerr << "Error loading NPCs from database. Bad query: " << errbuf << std::endl;
safe_delete_array(query);
return npc;
@@ -1291,7 +1289,7 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) {
const NPCType* ZoneDatabase::GetMercType(uint32 id, uint16 raceid, uint32 clientlevel) {
const NPCType *npc=nullptr;
map<uint32,NPCType *>::iterator itr;
std::map<uint32,NPCType *>::iterator itr;
//need to save based on merc_npc_type & client level
uint32 merc_type_id = id * 100 + clientlevel;
@@ -1592,7 +1590,7 @@ const NPCType* ZoneDatabase::GetMercType(uint32 id, uint16 raceid, uint32 client
mysql_free_result(result);
}
} else
cerr << "Error loading NPCs from database. Bad query: " << errbuf << endl;
std::cerr << "Error loading NPCs from database. Bad query: " << errbuf << std::endl;
safe_delete_array(query);
return npc;
@@ -1985,7 +1983,7 @@ uint8 ZoneDatabase::GetGridType(uint32 grid, uint32 zoneid ) {
}
mysql_free_result(result);
} else {
cerr << "Error in GetGridType query '" << query << "' " << errbuf << endl;
std::cerr << "Error in GetGridType query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
}
return type;
@@ -1998,7 +1996,7 @@ void ZoneDatabase::SaveMerchantTemp(uint32 npcid, uint32 slot, uint32 item, uint
char *query = 0;
if (!RunQuery(query, MakeAnyLenString(&query, "replace into merchantlist_temp (npcid,slot,itemid,charges) values(%d,%d,%d,%d)", npcid, slot, item, charges), errbuf)) {
cerr << "Error in SaveMerchantTemp query '" << query << "' " << errbuf << endl;
std::cerr << "Error in SaveMerchantTemp query '" << query << "' " << errbuf << std::endl;
}
safe_delete_array(query);
}
@@ -2007,7 +2005,7 @@ void ZoneDatabase::DeleteMerchantTemp(uint32 npcid, uint32 slot){
char *query = 0;
if (!RunQuery(query, MakeAnyLenString(&query, "delete from merchantlist_temp where npcid=%d and slot=%d", npcid, slot), errbuf)) {
cerr << "Error in DeleteMerchantTemp query '" << query << "' " << errbuf << endl;
std::cerr << "Error in DeleteMerchantTemp query '" << query << "' " << errbuf << std::endl;
}
safe_delete_array(query);
}
@@ -2059,7 +2057,7 @@ uint8 ZoneDatabase::GetUseCFGSafeCoords()
else
{
cerr << "Error in GetUseCFGSafeCoords query '" << query << "' " << errbuf << endl;
std::cerr << "Error in GetUseCFGSafeCoords query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return false;
}
@@ -2088,7 +2086,7 @@ uint32 ZoneDatabase::GetServerFilters(char* name, ServerSideFilters_Struct *ssfs
memcpy(ssfs, row[0], sizeof(ServerSideFilters_Struct));
}
else {
cerr << "Player profile length mismatch in ServerSideFilters" << endl;
std::cerr << "Player profile length mismatch in ServerSideFilters" << std::endl;
mysql_free_result(result);
return 0;
}
@@ -2103,7 +2101,7 @@ uint32 ZoneDatabase::GetServerFilters(char* name, ServerSideFilters_Struct *ssfs
return len;
}
else {
cerr << "Error in ServerSideFilters query '" << query << "' " << errbuf << endl;
std::cerr << "Error in ServerSideFilters query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return 0;
}
@@ -2136,7 +2134,7 @@ bool ZoneDatabase::SetServerFilters(char* name, ServerSideFilters_Struct *ssfs)
uint32 affected_rows = 0;
if (!RunQuery(query, (uint32) (end - query), errbuf, 0, &affected_rows)) {
cerr << "Error in SetServerSideFilters query " << errbuf << endl;
std::cerr << "Error in SetServerSideFilters query " << errbuf << std::endl;
return false;
}
@@ -2167,7 +2165,7 @@ uint32 ZoneDatabase::GetZoneTZ(uint32 zoneid, uint32 version) {
mysql_free_result(result);
}
else {
cerr << "Error in GetZoneTZ query '" << query << "' " << errbuf << endl;
std::cerr << "Error in GetZoneTZ query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
}
return 0;
@@ -2187,7 +2185,7 @@ bool ZoneDatabase::SetZoneTZ(uint32 zoneid, uint32 version, uint32 tz) {
return false;
}
else {
cerr << "Error in SetZoneTZ query '" << query << "' " << errbuf << endl;
std::cerr << "Error in SetZoneTZ query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return false;
}
@@ -2217,7 +2215,7 @@ uint8 ZoneDatabase::GetZoneWeather(uint32 zoneid, uint32 version) {
}
else {
cerr << "Error in GetZoneWeather query '" << query << "' " << errbuf << endl;
std::cerr << "Error in GetZoneWeather query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
}
return 0;
@@ -2236,7 +2234,7 @@ bool ZoneDatabase::SetZoneWeather(uint32 zoneid, uint32 version, uint8 w) {
return false;
}
else {
cerr << "Error in SetZoneWeather query '" << query << "' " << errbuf << endl;
std::cerr << "Error in SetZoneWeather query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return false;
}
@@ -2262,7 +2260,7 @@ bool ZoneDatabase::GetAccountInfoForLogin(uint32 account_id, int16* admin, char*
}
else
{
cerr << "Error in GetAccountInfoForLogin query '" << query << "' " << errbuf << endl;
std::cerr << "Error in GetAccountInfoForLogin query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return false;
}
@@ -2384,7 +2382,7 @@ int32 ZoneDatabase::GetBlockedSpellsCount(uint32 zoneid)
mysql_free_result(result);
}
else {
cerr << "Error in GetBlockedSpellsCount query '" << query << "' " << errbuf << endl;
std::cerr << "Error in GetBlockedSpellsCount query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return -1;
}
@@ -2408,7 +2406,7 @@ bool ZoneDatabase::LoadBlockedSpells(int32 blockedSpellsCount, ZoneSpellsBlocked
int32 r;
for(r = 0; (row = mysql_fetch_row(result)); r++) {
if(r >= blockedSpellsCount) {
cerr << "Error, Blocked Spells Count of " << blockedSpellsCount << " exceeded." << endl;
std::cerr << "Error, Blocked Spells Count of " << blockedSpellsCount << " exceeded." << std::endl;
break;
}
memset(&into[r], 0, sizeof(ZoneSpellsBlocked));
@@ -2428,7 +2426,7 @@ bool ZoneDatabase::LoadBlockedSpells(int32 blockedSpellsCount, ZoneSpellsBlocked
}
else
{
cerr << "Error in LoadBlockedSpells query '" << query << "' " << errbuf << endl;
std::cerr << "Error in LoadBlockedSpells query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return false;
}
@@ -2453,14 +2451,14 @@ int ZoneDatabase::getZoneShutDownDelay(uint32 zoneID, uint32 version)
return (retVal);
}
else {
cerr << "Error in getZoneShutDownDelay no result '" << query << "' " << errbuf << endl;
std::cerr << "Error in getZoneShutDownDelay no result '" << query << "' " << errbuf << std::endl;
mysql_free_result(result);
safe_delete_array(query);
return (RuleI(Zone, AutoShutdownDelay));
}
}
else {
cerr << "Error in getZoneShutDownDelay query '" << query << "' " << errbuf << endl;
std::cerr << "Error in getZoneShutDownDelay query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
}
return (RuleI(Zone, AutoShutdownDelay));
@@ -2500,7 +2498,7 @@ void ZoneDatabase::UpdateKarma(uint32 acct_id, uint32 amount)
if (RunQuery(query, MakeAnyLenString(&query, "UPDATE account set karma=%i where id=%i", amount, acct_id), errbuf, 0, &affected_rows)){
safe_delete_array(query);}
else {
cerr << "Error in UpdateKarma query '" << query << "' " << errbuf << endl;
std::cerr << "Error in UpdateKarma query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
}
}
@@ -2552,7 +2550,7 @@ void ZoneDatabase::InsertDoor(uint32 ddoordbid, uint16 ddoorid, const char* ddoo
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
if (!RunQuery(query, MakeAnyLenString(&query, "replace into doors (id, doorid,zone,version,name,pos_x,pos_y,pos_z,heading,opentype,guild,lockpick,keyitem,door_param,invert_state,incline,size) values('%i','%i','%s','%i', '%s','%f','%f','%f','%f','%i','%i','%i', '%i','%i','%i','%i','%i')", ddoordbid ,ddoorid ,zone->GetShortName(), zone->GetInstanceVersion(), ddoor_name, dxpos, dypos, dzpos, dheading, dopentype, dguildid, dlockpick, dkeyitem, ddoor_param, dinvert, dincline, dsize), errbuf)) {
cerr << "Error in InsertDoor" << query << "' " << errbuf << endl;
std::cerr << "Error in InsertDoor" << query << "' " << errbuf << std::endl;
}
safe_delete_array(query);
}
@@ -2820,7 +2818,7 @@ void ZoneDatabase::RemoveTempFactions(Client *c){
char *query = 0;
if (!RunQuery(query, MakeAnyLenString(&query, "DELETE FROM faction_values WHERE temp = 1 AND char_id=%u", c->CharacterID()), errbuf)) {
cerr << "Error in RemoveTempFactions query '" << query << "' " << errbuf << endl;
std::cerr << "Error in RemoveTempFactions query '" << query << "' " << errbuf << std::endl;
}
safe_delete_array(query);
}
@@ -3015,7 +3013,7 @@ bool ZoneDatabase::LoadFactionValues(uint32 char_id, faction_map & val_list) {
return ret;
}
else {
cerr << "Error in LoadFactionValues query '" << query << "' " << errbuf << endl;
std::cerr << "Error in LoadFactionValues query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
}
return false;
@@ -3083,7 +3081,7 @@ bool ZoneDatabase::SetCharacterFactionLevel(uint32 char_id, int32 faction_id, in
if (!RunQuery(query, MakeAnyLenString(&query,
"DELETE FROM faction_values WHERE char_id=%i AND faction_id = %i",
char_id, faction_id), errbuf)) {
cerr << "Error in SetCharacterFactionLevel query '" << query << "' " << errbuf << endl;
std::cerr << "Error in SetCharacterFactionLevel query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return false;
}
@@ -3103,7 +3101,7 @@ bool ZoneDatabase::SetCharacterFactionLevel(uint32 char_id, int32 faction_id, in
if (!RunQuery(query, MakeAnyLenString(&query,
"INSERT INTO faction_values (char_id,faction_id,current_value,temp) VALUES (%i,%i,%i,%i)",
char_id, faction_id,value,temp), errbuf, 0, &affected_rows)) {
cerr << "Error in SetCharacterFactionLevel query '" << query << "' " << errbuf << endl;
std::cerr << "Error in SetCharacterFactionLevel query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return false;
}
@@ -3169,7 +3167,7 @@ bool ZoneDatabase::LoadFactionData()
mysql_free_result(result);
}
else {
cerr << "Error in LoadFactionData '" << query << "' " << errbuf << endl;
std::cerr << "Error in LoadFactionData '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return false;
}
@@ -3179,16 +3177,16 @@ bool ZoneDatabase::LoadFactionData()
}
}
else {
cerr << "Error in LoadFactionData '" << query << "' " << errbuf << endl;
std::cerr << "Error in LoadFactionData '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return false;
}
return true;
}
bool ZoneDatabase::GetFactionIdsForNPC(uint32 nfl_id, list<struct NPCFaction*> *faction_list, int32* primary_faction) {
bool ZoneDatabase::GetFactionIdsForNPC(uint32 nfl_id, std::list<struct NPCFaction*> *faction_list, int32* primary_faction) {
if (nfl_id <= 0) {
list<struct NPCFaction*>::iterator cur,end;
std::list<struct NPCFaction*>::iterator cur,end;
cur = faction_list->begin();
end = faction_list->end();
for(; cur != end; cur++) {
@@ -3207,7 +3205,7 @@ bool ZoneDatabase::GetFactionIdsForNPC(uint32 nfl_id, list<struct NPCFaction*> *
if (primary_faction)
*primary_faction = nfl->primaryfaction;
list<struct NPCFaction*>::iterator cur,end;
std::list<struct NPCFaction*>::iterator cur,end;
cur = faction_list->begin();
end = faction_list->end();
for(; cur != end; cur++) {
+6 -6
View File
@@ -44,10 +44,10 @@ struct DBTradeskillRecipe_Struct {
uint16 trivial;
bool nofail;
bool replace_container;
vector< pair<uint32,uint8> > onsuccess;
vector< pair<uint32,uint8> > onfail;
vector< pair<uint32,uint8> > salvage;
string name;
std::vector< std::pair<uint32,uint8> > onsuccess;
std::vector< std::pair<uint32,uint8> > onfail;
std::vector< std::pair<uint32,uint8> > salvage;
std::string name;
uint8 must_learn;
bool has_learnt;
uint32 madecount;
@@ -172,7 +172,7 @@ struct LootTable_Struct;
class ZoneDatabase : public SharedDatabase {
typedef list<ServerLootItem_Struct*> ItemList;
typedef std::list<ServerLootItem_Struct*> ItemList;
public:
ZoneDatabase();
ZoneDatabase(const char* host, const char* user, const char* passwd, const char* database,uint32 port);
@@ -272,7 +272,7 @@ public:
bool GetNPCFactionList(uint32 npcfaction_id, int32* faction_id, int32* value, uint8* temp, int32* primary_faction = 0);
bool GetFactionData(FactionMods* fd, uint32 class_mod, uint32 race_mod, uint32 deity_mod, int32 faction_id); //rembrant, needed for factions Dec, 16 2001
bool GetFactionName(int32 faction_id, char* name, uint32 buflen); // rembrant, needed for factions Dec, 16 2001
bool GetFactionIdsForNPC(uint32 nfl_id, list<struct NPCFaction*> *faction_list, int32* primary_faction = 0); // neotokyo: improve faction handling
bool GetFactionIdsForNPC(uint32 nfl_id, std::list<struct NPCFaction*> *faction_list, int32* primary_faction = 0); // neotokyo: improve faction handling
bool SetCharacterFactionLevel(uint32 char_id, int32 faction_id, int32 value, uint8 temp, faction_map &val_list); // rembrant, needed for factions Dec, 16 2001
bool LoadFactionData();
bool LoadFactionValues(uint32 char_id, faction_map & val_list);
+3 -4
View File
@@ -1,9 +1,8 @@
#include "../common/debug.h"
#include <iostream>
using namespace std;
#include "entity.h"
#include "masterentity.h"
#include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/breakdowns.h"
#include <stdlib.h>
@@ -45,7 +44,7 @@ void DispatchFinishedDBAsync(DBAsyncWork* dbaw) {
break;
}
default: {
cout << "Error: DispatchFinishedDBAsync(): Unknown workpt.b4: " << (int) workpt.b4() << ", workpt=" << workpt << endl;
std::cout << "Error: DispatchFinishedDBAsync(): Unknown workpt.b4: " << (int) workpt.b4() << ", workpt=" << workpt << std::endl;
break;
}
}
@@ -112,7 +111,7 @@ bool DBAsyncCB_CharacterBackup(DBAsyncWork* iWork) { // return true means delete
"Insert Delayed into character_backup (charid, account_id, name, profile, level, class, x, y, z, zoneid) "
"select id, account_id, name, profile, level, class, x, y, z, zoneid "
"from character_ where id=%u", iWork->WPT()), errbuf)) {
cout << "Error in DBAsyncCB_CharacterBackup query3 '" << query << "' " << errbuf << endl;
std::cout << "Error in DBAsyncCB_CharacterBackup query3 '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return true;
}
+2 -1
View File
@@ -22,6 +22,7 @@
#include "masterentity.h"
#include "../common/packet_dump.h"
#include "../common/rulesys.h"
#include "../common/StringUtil.h"
#include "StringIDs.h"
#include "QuestParserCollection.h"
@@ -787,7 +788,7 @@ void Client::SendZoneFlagInfo(Client *to) const {
return;
}
set<uint32>::const_iterator cur, end;
std::set<uint32>::const_iterator cur, end;
cur = zone_flags.begin();
end = zone_flags.end();
char empty[1] = { '\0' };