Remove 'using namespaces std' fixes #61

This commit is contained in:
Michael Cook
2013-05-22 16:17:19 -04:00
parent 312100e1c6
commit 0fdfe025cb
190 changed files with 1801 additions and 2004 deletions
+12 -12
View File
@@ -49,7 +49,7 @@ Adventure::~Adventure()
safe_delete(current_timer);
}
void Adventure::AddPlayer(string character_name, bool add_client_to_instance)
void Adventure::AddPlayer(std::string character_name, bool add_client_to_instance)
{
if(!PlayerExists(character_name))
{
@@ -62,9 +62,9 @@ void Adventure::AddPlayer(string character_name, bool add_client_to_instance)
}
}
void Adventure::RemovePlayer(string character_name)
void Adventure::RemovePlayer(std::string character_name)
{
list<string>::iterator iter = players.begin();
std::list<std::string>::iterator iter = players.begin();
while(iter != players.end())
{
if((*iter).compare(character_name) == 0)
@@ -77,9 +77,9 @@ void Adventure::RemovePlayer(string character_name)
}
}
bool Adventure::PlayerExists(string character_name)
bool Adventure::PlayerExists(std::string character_name)
{
list<string>::iterator iter = players.begin();
std::list<std::string>::iterator iter = players.begin();
while(iter != players.end())
{
if(character_name.compare((*iter)) == 0)
@@ -209,7 +209,7 @@ void Adventure::SetStatus(AdventureStatus new_status)
return;
}
list<string>::iterator iter = players.begin();
std::list<std::string>::iterator iter = players.begin();
while(iter != players.end())
{
adventure_manager.GetAdventureData((*iter).c_str());
@@ -223,7 +223,7 @@ void Adventure::SendAdventureMessage(uint32 type, const char *msg)
ServerEmoteMessage_Struct *sms = (ServerEmoteMessage_Struct*)pack->pBuffer;
sms->type = type;
strcpy(sms->message, msg);
list<string>::iterator iter = players.begin();
std::list<std::string>::iterator iter = players.begin();
while(iter != players.end())
{
ClientListEntry *current = client_list.FindCharacter((*iter).c_str());
@@ -277,7 +277,7 @@ void Adventure::IncrementAssassinationCount()
void Adventure::Finished(AdventureWinStatus ws)
{
list<string>::iterator iter = players.begin();
std::list<std::string>::iterator iter = players.begin();
while(iter != players.end())
{
ClientListEntry *current = client_list.FindCharacter((*iter).c_str());
@@ -371,8 +371,8 @@ void Adventure::MoveCorpsesToGraveyard()
return;
}
list<uint32> dbid_list;
list<uint32> charid_list;
std::list<uint32> dbid_list;
std::list<uint32> charid_list;
char errbuf[MYSQL_ERRMSG_SIZE];
char* query = 0;
MYSQL_RES *result;
@@ -394,7 +394,7 @@ void Adventure::MoveCorpsesToGraveyard()
safe_delete_array(query);
}
list<uint32>::iterator iter = dbid_list.begin();
std::list<uint32>::iterator iter = dbid_list.begin();
while(iter != dbid_list.end())
{
float x = GetTemplate()->graveyard_x + MakeRandomFloat(-GetTemplate()->graveyard_radius, GetTemplate()->graveyard_radius);
@@ -414,7 +414,7 @@ void Adventure::MoveCorpsesToGraveyard()
}
iter = dbid_list.begin();
list<uint32>::iterator c_iter = charid_list.begin();
std::list<uint32>::iterator c_iter = charid_list.begin();
while(iter != dbid_list.end())
{
ServerPacket* pack = new ServerPacket(ServerOP_DepopAllPlayersCorpses, sizeof(ServerDepopAllPlayersCorpses_Struct));
+8 -10
View File
@@ -9,8 +9,6 @@
#include <string>
#include <stdlib.h>
using namespace std;
enum AdventureStatus
{
AS_WaitingForZoneIn,
@@ -28,7 +26,7 @@ enum AdventureWinStatus
struct AdventureZones
{
string zone;
std::string zone;
int version;
};
@@ -40,7 +38,7 @@ struct AdventureZoneIn
struct AdventureFinishEvent
{
string name;
std::string name;
bool win;
int points;
int theme;
@@ -48,7 +46,7 @@ struct AdventureFinishEvent
struct LeaderboardInfo
{
string name;
std::string name;
uint32 wins;
uint32 guk_wins;
uint32 mir_wins;
@@ -71,9 +69,9 @@ public:
~Adventure();
bool Process();
bool IsActive();
void AddPlayer(string character_name, bool add_client_to_instance = true);
void RemovePlayer(string character_name);
bool PlayerExists(string character_name);
void AddPlayer(std::string character_name, bool add_client_to_instance = true);
void RemovePlayer(std::string character_name);
bool PlayerExists(std::string character_name);
bool CreateInstance();
void IncrementCount();
void IncrementAssassinationCount();
@@ -85,7 +83,7 @@ public:
uint16 GetInstanceID() const { return instance_id; }
const AdventureTemplate *GetTemplate() const { return adventure_template; }
AdventureStatus GetStatus() const { return status; }
list<string> GetPlayers() { return players; }
std::list<std::string> GetPlayers() { return players; }
int GetCount() const { return count; }
int GetAssassinationCount() const { return assassination_count; }
uint32 GetRemainingTime() const { if(current_timer) { return (current_timer->GetRemainingTime() / 1000); } else { return 0; } }
@@ -95,7 +93,7 @@ protected:
int assassination_count;
AdventureTemplate *adventure_template;
AdventureStatus status;
list<string> players;
std::list<std::string> players;
Timer *current_timer;
int instance_id;
};
+51 -51
View File
@@ -32,7 +32,7 @@ void AdventureManager::Process()
{
if(process_timer->Check())
{
list<Adventure*>::iterator iter = adventure_list.begin();
std::list<Adventure*>::iterator iter = adventure_list.begin();
while(iter != adventure_list.end())
{
if(!(*iter)->Process())
@@ -70,7 +70,7 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data)
/**
* This block checks to see if we actually have any adventures for the requested theme.
*/
map<uint32, list<AdventureTemplate*> >::iterator adv_list_iter = adventure_entries.find(sar->template_id);
std::map<uint32, std::list<AdventureTemplate*> >::iterator adv_list_iter = adventure_entries.find(sar->template_id);
if(adv_list_iter == adventure_entries.end())
{
ServerPacket *pack = new ServerPacket(ServerOP_AdventureRequestDeny, sizeof(ServerAdventureRequestDeny_Struct));
@@ -88,7 +88,7 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data)
* Active being in progress, finished adventures that are still waiting to expire do not count
* Though they will count against you for which new adventure you can get.
*/
list<Adventure*>::iterator iter = adventure_list.begin();
std::list<Adventure*>::iterator iter = adventure_list.begin();
while(iter != adventure_list.end())
{
Adventure* current = (*iter);
@@ -102,7 +102,7 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data)
ServerAdventureRequestDeny_Struct *deny = (ServerAdventureRequestDeny_Struct*)pack->pBuffer;
strcpy(deny->leader, sar->leader);
stringstream ss(stringstream::out | stringstream::in);
std::stringstream ss(std::stringstream::out | std::stringstream::in);
ss << (data + sizeof(ServerAdventureRequest_Struct) + (64 * i)) << " is already apart of an active adventure.";
strcpy(deny->reason, ss.str().c_str());
@@ -120,8 +120,8 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data)
* Now we need to get every available adventure for our selected theme and exclude ones we can't use.
* ie. the ones that would cause overlap issues for new adventures with the old unexpired adventures.
*/
list<AdventureZones> excluded_zones;
list<AdventureZoneIn> excluded_zone_ins;
std::list<AdventureZones> excluded_zones;
std::list<AdventureZoneIn> excluded_zone_ins;
for(int i = 0; i < sar->member_count; ++i)
{
int finished_adventures_count;
@@ -147,12 +147,12 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data)
safe_delete_array(finished_adventures);
}
list<AdventureTemplate*> eligible_adventures = adventure_entries[sar->template_id];
std::list<AdventureTemplate*> eligible_adventures = adventure_entries[sar->template_id];
/**
* Remove zones from eligible zones based on their difficulty and type.
* ie only use difficult zones for difficult, collect for collect, etc.
*/
list<AdventureTemplate*>::iterator ea_iter = eligible_adventures.begin();
std::list<AdventureTemplate*>::iterator ea_iter = eligible_adventures.begin();
while(ea_iter != eligible_adventures.end())
{
if((*ea_iter)->is_hard != ((sar->risk == 2) ? true : false))
@@ -252,7 +252,7 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data)
ServerAdventureRequestDeny_Struct *deny = (ServerAdventureRequestDeny_Struct*)pack->pBuffer;
strcpy(deny->leader, sar->leader);
stringstream ss(stringstream::out | stringstream::in);
std::stringstream ss(std::stringstream::out | std::stringstream::in);
ss << "The maximum level range for this adventure is " << RuleI(Adventure, MaxLevelRange);
ss << " but the level range calculated was " << (max_level - min_level) << ".";
strcpy(deny->reason, ss.str().c_str());
@@ -265,10 +265,10 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data)
/**
* Remove the zones from our eligible zones based on the exclusion above
*/
list<AdventureZones>::iterator ez_iter = excluded_zones.begin();
std::list<AdventureZones>::iterator ez_iter = excluded_zones.begin();
while(ez_iter != excluded_zones.end())
{
list<AdventureTemplate*>::iterator ea_iter = eligible_adventures.begin();
std::list<AdventureTemplate*>::iterator ea_iter = eligible_adventures.begin();
while(ea_iter != eligible_adventures.end())
{
if((*ez_iter).zone.compare((*ea_iter)->zone) == 0 && (*ez_iter).version == (*ea_iter)->zone_version)
@@ -281,10 +281,10 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data)
ez_iter++;
}
list<AdventureZoneIn>::iterator ezi_iter = excluded_zone_ins.begin();
std::list<AdventureZoneIn>::iterator ezi_iter = excluded_zone_ins.begin();
while(ezi_iter != excluded_zone_ins.end())
{
list<AdventureTemplate*>::iterator ea_iter = eligible_adventures.begin();
std::list<AdventureTemplate*>::iterator ea_iter = eligible_adventures.begin();
while(ea_iter != eligible_adventures.end())
{
if((*ezi_iter).zone_id == (*ea_iter)->zone_in_zone_id && (*ezi_iter).door_id == (*ea_iter)->zone_in_object_id)
@@ -447,8 +447,8 @@ void AdventureManager::TryAdventureCreate(const char *data)
void AdventureManager::GetAdventureData(Adventure *adv)
{
list<string> player_list = adv->GetPlayers();
list<string>::iterator iter = player_list.begin();
std::list<std::string> player_list = adv->GetPlayers();
std::list<std::string>::iterator iter = player_list.begin();
while(iter != player_list.end())
{
GetAdventureData((*iter).c_str());
@@ -523,9 +523,9 @@ void AdventureManager::GetAdventureData(const char *name)
}
}
bool AdventureManager::IsInExcludedZoneList(list<AdventureZones> excluded_zones, string zone_name, int version)
bool AdventureManager::IsInExcludedZoneList(std::list<AdventureZones> excluded_zones, std::string zone_name, int version)
{
list<AdventureZones>::iterator iter = excluded_zones.begin();
std::list<AdventureZones>::iterator iter = excluded_zones.begin();
while(iter != excluded_zones.end())
{
if(((*iter).zone.compare(zone_name) == 0) && ((*iter).version == version))
@@ -537,9 +537,9 @@ bool AdventureManager::IsInExcludedZoneList(list<AdventureZones> excluded_zones,
return false;
}
bool AdventureManager::IsInExcludedZoneInList(list<AdventureZoneIn> excluded_zone_ins, int zone_id, int door_object)
bool AdventureManager::IsInExcludedZoneInList(std::list<AdventureZoneIn> excluded_zone_ins, int zone_id, int door_object)
{
list<AdventureZoneIn>::iterator iter = excluded_zone_ins.begin();
std::list<AdventureZoneIn>::iterator iter = excluded_zone_ins.begin();
while(iter != excluded_zone_ins.end())
{
if(((*iter).zone_id == zone_id) && ((*iter).door_id == door_object))
@@ -556,7 +556,7 @@ Adventure **AdventureManager::GetFinishedAdventures(const char *player, int &cou
Adventure **ret = nullptr;
count = 0;
list<Adventure*>::iterator iter = adventure_list.begin();
std::list<Adventure*>::iterator iter = adventure_list.begin();
while(iter != adventure_list.end())
{
if((*iter)->PlayerExists(player))
@@ -589,7 +589,7 @@ Adventure **AdventureManager::GetFinishedAdventures(const char *player, int &cou
Adventure *AdventureManager::GetActiveAdventure(const char *player)
{
list<Adventure*>::iterator iter = adventure_list.begin();
std::list<Adventure*>::iterator iter = adventure_list.begin();
while(iter != adventure_list.end())
{
if((*iter)->PlayerExists(player) && (*iter)->IsActive())
@@ -603,13 +603,13 @@ Adventure *AdventureManager::GetActiveAdventure(const char *player)
AdventureTemplate *AdventureManager::GetAdventureTemplate(int theme, int id)
{
map<uint32, list<AdventureTemplate*> >::iterator iter = adventure_entries.find(theme);
std::map<uint32, std::list<AdventureTemplate*> >::iterator iter = adventure_entries.find(theme);
if(iter == adventure_entries.end())
{
return nullptr;
}
list<AdventureTemplate*>::iterator l_iter = (*iter).second.begin();
std::list<AdventureTemplate*>::iterator l_iter = (*iter).second.begin();
while(l_iter != (*iter).second.end())
{
if((*l_iter)->id == id)
@@ -623,7 +623,7 @@ AdventureTemplate *AdventureManager::GetAdventureTemplate(int theme, int id)
AdventureTemplate *AdventureManager::GetAdventureTemplate(int id)
{
map<uint32, AdventureTemplate*>::iterator iter = adventure_templates.find(id);
std::map<uint32, AdventureTemplate*>::iterator iter = adventure_templates.find(id);
if(iter == adventure_templates.end())
{
return nullptr;
@@ -712,7 +712,7 @@ bool AdventureManager::LoadAdventureEntries()
int template_id = atoi(row[1]);
AdventureTemplate* tid = nullptr;
map<uint32, AdventureTemplate*>::iterator t_iter = adventure_templates.find(template_id);
std::map<uint32, AdventureTemplate*>::iterator t_iter = adventure_templates.find(template_id);
if(t_iter == adventure_templates.end())
{
continue;
@@ -722,8 +722,8 @@ bool AdventureManager::LoadAdventureEntries()
tid = adventure_templates[template_id];
}
list<AdventureTemplate*> temp;
map<uint32, list<AdventureTemplate*> >::iterator iter = adventure_entries.find(id);
std::list<AdventureTemplate*> temp;
std::map<uint32, std::list<AdventureTemplate*> >::iterator iter = adventure_entries.find(id);
if(iter == adventure_entries.end())
{
temp.push_back(tid);
@@ -751,7 +751,7 @@ bool AdventureManager::LoadAdventureEntries()
void AdventureManager::PlayerClickedDoor(const char *player, int zone_id, int door_id)
{
list<Adventure*>::iterator iter = adventure_list.begin();
std::list<Adventure*>::iterator iter = adventure_list.begin();
while(iter != adventure_list.end())
{
const AdventureTemplate *t = (*iter)->GetTemplate();
@@ -841,7 +841,7 @@ void AdventureManager::LeaveAdventure(const char *name)
void AdventureManager::IncrementCount(uint16 instance_id)
{
list<Adventure*>::iterator iter = adventure_list.begin();
std::list<Adventure*>::iterator iter = adventure_list.begin();
Adventure *current = nullptr;
while(iter != adventure_list.end())
{
@@ -856,8 +856,8 @@ void AdventureManager::IncrementCount(uint16 instance_id)
if(current)
{
current->IncrementCount();
list<string> slist = current->GetPlayers();
list<string>::iterator siter = slist.begin();
std::list<std::string> slist = current->GetPlayers();
std::list<std::string>::iterator siter = slist.begin();
ServerPacket *pack = new ServerPacket(ServerOP_AdventureCountUpdate, sizeof(ServerAdventureCountUpdate_Struct));
ServerAdventureCountUpdate_Struct *ac = (ServerAdventureCountUpdate_Struct*)pack->pBuffer;
ac->count = current->GetCount();
@@ -881,7 +881,7 @@ void AdventureManager::IncrementCount(uint16 instance_id)
void AdventureManager::IncrementAssassinationCount(uint16 instance_id)
{
list<Adventure*>::iterator iter = adventure_list.begin();
std::list<Adventure*>::iterator iter = adventure_list.begin();
Adventure *current = nullptr;
while(iter != adventure_list.end())
{
@@ -902,7 +902,7 @@ void AdventureManager::IncrementAssassinationCount(uint16 instance_id)
void AdventureManager::GetZoneData(uint16 instance_id)
{
list<Adventure*>::iterator iter = adventure_list.begin();
std::list<Adventure*>::iterator iter = adventure_list.begin();
Adventure *current = nullptr;
while(iter != adventure_list.end())
{
@@ -1282,7 +1282,7 @@ void AdventureManager::DoLeaderboardRequestWins(const char* player)
int our_successes;
int our_failures;
int i = 0;
list<LeaderboardInfo>::iterator iter = leaderboard_info_wins.begin();
std::list<LeaderboardInfo>::iterator iter = leaderboard_info_wins.begin();
while(i < 100 && iter != leaderboard_info_wins.end())
{
LeaderboardInfo li = (*iter);
@@ -1349,7 +1349,7 @@ void AdventureManager::DoLeaderboardRequestPercentage(const char* player)
int our_successes;
int our_failures;
int i = 0;
list<LeaderboardInfo>::iterator iter = leaderboard_info_percentage.begin();
std::list<LeaderboardInfo>::iterator iter = leaderboard_info_percentage.begin();
while(i < 100 && iter != leaderboard_info_percentage.end())
{
LeaderboardInfo li = (*iter);
@@ -1416,7 +1416,7 @@ void AdventureManager::DoLeaderboardRequestWinsGuk(const char* player)
int our_successes;
int our_failures;
int i = 0;
list<LeaderboardInfo>::iterator iter = leaderboard_info_wins_guk.begin();
std::list<LeaderboardInfo>::iterator iter = leaderboard_info_wins_guk.begin();
while(i < 100 && iter != leaderboard_info_wins_guk.end())
{
LeaderboardInfo li = (*iter);
@@ -1483,7 +1483,7 @@ void AdventureManager::DoLeaderboardRequestPercentageGuk(const char* player)
int our_successes;
int our_failures;
int i = 0;
list<LeaderboardInfo>::iterator iter = leaderboard_info_percentage_guk.begin();
std::list<LeaderboardInfo>::iterator iter = leaderboard_info_percentage_guk.begin();
while(i < 100 && iter != leaderboard_info_percentage_guk.end())
{
LeaderboardInfo li = (*iter);
@@ -1550,7 +1550,7 @@ void AdventureManager::DoLeaderboardRequestWinsMir(const char* player)
int our_successes;
int our_failures;
int i = 0;
list<LeaderboardInfo>::iterator iter = leaderboard_info_wins_mir.begin();
std::list<LeaderboardInfo>::iterator iter = leaderboard_info_wins_mir.begin();
while(i < 100 && iter != leaderboard_info_wins_mir.end())
{
LeaderboardInfo li = (*iter);
@@ -1617,7 +1617,7 @@ void AdventureManager::DoLeaderboardRequestPercentageMir(const char* player)
int our_successes;
int our_failures;
int i = 0;
list<LeaderboardInfo>::iterator iter = leaderboard_info_percentage_mir.begin();
std::list<LeaderboardInfo>::iterator iter = leaderboard_info_percentage_mir.begin();
while(i < 100 && iter != leaderboard_info_percentage_mir.end())
{
LeaderboardInfo li = (*iter);
@@ -1684,7 +1684,7 @@ void AdventureManager::DoLeaderboardRequestWinsMmc(const char* player)
int our_successes;
int our_failures;
int i = 0;
list<LeaderboardInfo>::iterator iter = leaderboard_info_wins_mmc.begin();
std::list<LeaderboardInfo>::iterator iter = leaderboard_info_wins_mmc.begin();
while(i < 100 && iter != leaderboard_info_wins_mmc.end())
{
LeaderboardInfo li = (*iter);
@@ -1751,7 +1751,7 @@ void AdventureManager::DoLeaderboardRequestPercentageMmc(const char* player)
int our_successes;
int our_failures;
int i = 0;
list<LeaderboardInfo>::iterator iter = leaderboard_info_percentage_mmc.begin();
std::list<LeaderboardInfo>::iterator iter = leaderboard_info_percentage_mmc.begin();
while(i < 100 && iter != leaderboard_info_percentage_mmc.end())
{
LeaderboardInfo li = (*iter);
@@ -1818,7 +1818,7 @@ void AdventureManager::DoLeaderboardRequestWinsRuj(const char* player)
int our_successes;
int our_failures;
int i = 0;
list<LeaderboardInfo>::iterator iter = leaderboard_info_wins_ruj.begin();
std::list<LeaderboardInfo>::iterator iter = leaderboard_info_wins_ruj.begin();
while(i < 100 && iter != leaderboard_info_wins_ruj.end())
{
LeaderboardInfo li = (*iter);
@@ -1885,7 +1885,7 @@ void AdventureManager::DoLeaderboardRequestPercentageRuj(const char* player)
int our_successes;
int our_failures;
int i = 0;
list<LeaderboardInfo>::iterator iter = leaderboard_info_percentage_ruj.begin();
std::list<LeaderboardInfo>::iterator iter = leaderboard_info_percentage_ruj.begin();
while(i < 100 && iter != leaderboard_info_percentage_ruj.end())
{
LeaderboardInfo li = (*iter);
@@ -1952,7 +1952,7 @@ void AdventureManager::DoLeaderboardRequestWinsTak(const char* player)
int our_successes;
int our_failures;
int i = 0;
list<LeaderboardInfo>::iterator iter = leaderboard_info_wins_ruj.begin();
std::list<LeaderboardInfo>::iterator iter = leaderboard_info_wins_ruj.begin();
while(i < 100 && iter != leaderboard_info_wins_ruj.end())
{
LeaderboardInfo li = (*iter);
@@ -2019,7 +2019,7 @@ void AdventureManager::DoLeaderboardRequestPercentageTak(const char* player)
int our_successes;
int our_failures;
int i = 0;
list<LeaderboardInfo>::iterator iter = leaderboard_info_percentage_tak.begin();
std::list<LeaderboardInfo>::iterator iter = leaderboard_info_percentage_tak.begin();
while(i < 100 && iter != leaderboard_info_percentage_tak.end())
{
LeaderboardInfo li = (*iter);
@@ -2075,7 +2075,7 @@ void AdventureManager::DoLeaderboardRequestPercentageTak(const char* player)
bool AdventureManager::PopFinishedEvent(const char *name, AdventureFinishEvent &fe)
{
list<AdventureFinishEvent>::iterator iter = finished_list.begin();
std::list<AdventureFinishEvent>::iterator iter = finished_list.begin();
while(iter != finished_list.end())
{
if((*iter).name.compare(name) == 0)
@@ -2115,13 +2115,13 @@ void AdventureManager::Save()
//disabled for now
return;
stringstream ss(stringstream::in | stringstream::out);
std::stringstream ss(std::stringstream::in | std::stringstream::out);
int number_of_elements = adventure_list.size();
ss.write((const char*)&number_of_elements, sizeof(int));
char null_term = 0;
list<Adventure*>::iterator a_iter = adventure_list.begin();
std::list<Adventure*>::iterator a_iter = adventure_list.begin();
while(a_iter != adventure_list.end())
{
int cur = (*a_iter)->GetCount();
@@ -2142,11 +2142,11 @@ void AdventureManager::Save()
cur = (*a_iter)->GetRemainingTime();
ss.write((const char*)&cur, sizeof(int));
list<string> players = (*a_iter)->GetPlayers();
std::list<std::string> players = (*a_iter)->GetPlayers();
cur = players.size();
ss.write((const char*)&cur, sizeof(int));
list<string>::iterator s_iter = players.begin();
std::list<std::string>::iterator s_iter = players.begin();
while(s_iter != players.end())
{
ss.write((const char*)(*s_iter).c_str(), (*s_iter).size());
@@ -2159,7 +2159,7 @@ void AdventureManager::Save()
number_of_elements = finished_list.size();
ss.write((const char*)&number_of_elements, sizeof(int));
list<AdventureFinishEvent>::iterator f_iter = finished_list.begin();
std::list<AdventureFinishEvent>::iterator f_iter = finished_list.begin();
while(f_iter != finished_list.end())
{
ss.write((const char*)&(*f_iter).win, sizeof(bool));
+19 -21
View File
@@ -9,8 +9,6 @@
#include <map>
#include <list>
using namespace std;
class AdventureManager
{
public:
@@ -44,8 +42,8 @@ public:
AdventureTemplate *GetAdventureTemplate(int id);
void GetZoneData(uint16 instance_id);
protected:
bool IsInExcludedZoneList(list<AdventureZones> excluded_zones, string zone_name, int version);
bool IsInExcludedZoneInList(list<AdventureZoneIn> excluded_zone_ins, int zone_id, int door_object);
bool IsInExcludedZoneList(std::list<AdventureZones> excluded_zones, std::string zone_name, int version);
bool IsInExcludedZoneInList(std::list<AdventureZoneIn> excluded_zone_ins, int zone_id, int door_object);
void DoLeaderboardRequestWins(const char* player);
void DoLeaderboardRequestPercentage(const char* player);
void DoLeaderboardRequestWinsGuk(const char* player);
@@ -59,22 +57,22 @@ protected:
void DoLeaderboardRequestWinsTak(const char* player);
void DoLeaderboardRequestPercentageTak(const char* player);
map<uint32, AdventureTemplate*> adventure_templates;
map<uint32, list<AdventureTemplate*> > adventure_entries;
list<Adventure*> adventure_list;
list<AdventureFinishEvent> finished_list;
list<LeaderboardInfo> leaderboard_info_wins;
list<LeaderboardInfo> leaderboard_info_percentage;
list<LeaderboardInfo> leaderboard_info_wins_guk;
list<LeaderboardInfo> leaderboard_info_percentage_guk;
list<LeaderboardInfo> leaderboard_info_wins_mir;
list<LeaderboardInfo> leaderboard_info_percentage_mir;
list<LeaderboardInfo> leaderboard_info_wins_mmc;
list<LeaderboardInfo> leaderboard_info_percentage_mmc;
list<LeaderboardInfo> leaderboard_info_wins_ruj;
list<LeaderboardInfo> leaderboard_info_percentage_ruj;
list<LeaderboardInfo> leaderboard_info_wins_tak;
list<LeaderboardInfo> leaderboard_info_percentage_tak;
std::map<uint32, AdventureTemplate*> adventure_templates;
std::map<uint32, std::list<AdventureTemplate*> > adventure_entries;
std::list<Adventure*> adventure_list;
std::list<AdventureFinishEvent> finished_list;
std::list<LeaderboardInfo> leaderboard_info_wins;
std::list<LeaderboardInfo> leaderboard_info_percentage;
std::list<LeaderboardInfo> leaderboard_info_wins_guk;
std::list<LeaderboardInfo> leaderboard_info_percentage_guk;
std::list<LeaderboardInfo> leaderboard_info_wins_mir;
std::list<LeaderboardInfo> leaderboard_info_percentage_mir;
std::list<LeaderboardInfo> leaderboard_info_wins_mmc;
std::list<LeaderboardInfo> leaderboard_info_percentage_mmc;
std::list<LeaderboardInfo> leaderboard_info_wins_ruj;
std::list<LeaderboardInfo> leaderboard_info_percentage_ruj;
std::list<LeaderboardInfo> leaderboard_info_wins_tak;
std::list<LeaderboardInfo> leaderboard_info_percentage_tak;
bool leaderboard_sorted_wins;
bool leaderboard_sorted_percentage;
bool leaderboard_sorted_wins_guk;
@@ -92,4 +90,4 @@ protected:
Timer *leaderboard_info_timer;
};
#endif
#endif
+8 -8
View File
@@ -96,7 +96,7 @@ EQLConfig *EQLConfig::CreateLauncher(const char *name, uint8 dynamic_count) {
}
void EQLConfig::GetZones(std::vector<LauncherZone> &result) {
map<string, LauncherZone>::iterator cur, end;
std::map<std::string, LauncherZone>::iterator cur, end;
cur = m_zones.begin();
end = m_zones.end();
for(; cur != end; cur++) {
@@ -104,12 +104,12 @@ void EQLConfig::GetZones(std::vector<LauncherZone> &result) {
}
}
vector<string> EQLConfig::ListZones() {
std::vector<std::string> EQLConfig::ListZones() {
LauncherLink *ll = launcher_list.Get(m_name.c_str());
vector<string> res;
std::vector<std::string> res;
if(ll == nullptr) {
//if the launcher isnt connected, use the list from the database.
map<string, LauncherZone>::iterator cur, end;
std::map<std::string, LauncherZone>::iterator cur, end;
cur = m_zones.begin();
end = m_zones.end();
for(; cur != end; cur++) {
@@ -224,7 +224,7 @@ bool EQLConfig::ChangeStaticZone(Const_char *short_name, uint16 port) {
return(false);
//check internal state
map<string, LauncherZone>::iterator res;
std::map<std::string, LauncherZone>::iterator res;
res = m_zones.find(short_name);
if(res == m_zones.end()) {
//not found.
@@ -268,7 +268,7 @@ bool EQLConfig::ChangeStaticZone(Const_char *short_name, uint16 port) {
bool EQLConfig::DeleteStaticZone(Const_char *short_name) {
//check internal state
map<string, LauncherZone>::iterator res;
std::map<std::string, LauncherZone>::iterator res;
res = m_zones.find(short_name);
if(res == m_zones.end()) {
//not found.
@@ -341,8 +341,8 @@ int EQLConfig::GetDynamicCount() const {
return(m_dynamics);
}
map<string,string> EQLConfig::GetZoneDetails(Const_char *zone_ref) {
map<string,string> res;
std::map<std::string,std::string> EQLConfig::GetZoneDetails(Const_char *zone_ref) {
std::map<std::string,std::string> res;
LauncherLink *ll = launcher_list.Get(m_name.c_str());
if(ll == nullptr) {
+4 -6
View File
@@ -23,8 +23,6 @@
#include <map>
#include <string>
using namespace std;
class LauncherLink;
typedef struct {
@@ -60,16 +58,16 @@ public:
bool SetDynamicCount(int count);
int GetDynamicCount() const;
vector<string> ListZones(); //returns an array of zone refs
map<string,string> GetZoneDetails(Const_char *zone_ref);
std::vector<std::string> ListZones(); //returns an array of zone refs
std::map<std::string,std::string> GetZoneDetails(Const_char *zone_ref);
//END PERL EXPORT
protected:
const string m_name;
const std::string m_name;
uint8 m_dynamics;
map<string, LauncherZone> m_zones; //static zones.
std::map<std::string, LauncherZone> m_zones; //static zones.
};
#endif /*EQLCONFIG_H_*/
+20 -24
View File
@@ -38,16 +38,12 @@
#include "LauncherLink.h"
#include "wguild_mgr.h"
#ifdef seed
#undef seed
#endif
#include <algorithm>
using namespace std;
extern ZSList zoneserver_list;
extern ClientList client_list;
extern uint32 numzones;
@@ -115,13 +111,13 @@ int EQW::CountZones() {
}
//returns an array of zone_refs (opaque)
vector<string> EQW::ListBootedZones() {
vector<string> res;
std::vector<std::string> EQW::ListBootedZones() {
std::vector<std::string> res;
vector<uint32> zones;
std::vector<uint32> zones;
zoneserver_list.GetZoneIDList(zones);
vector<uint32>::iterator cur, end;
std::vector<uint32>::iterator cur, end;
cur = zones.begin();
end = zones.end();
for(; cur != end; cur++) {
@@ -131,8 +127,8 @@ vector<string> EQW::ListBootedZones() {
return(res);
}
map<string,string> EQW::GetZoneDetails(Const_char *zone_ref) {
map<string,string> res;
std::map<std::string,std::string> EQW::GetZoneDetails(Const_char *zone_ref) {
std::map<std::string,std::string> res;
ZoneServer *zs = zoneserver_list.FindByID(atoi(zone_ref));
if(zs == nullptr) {
@@ -165,13 +161,13 @@ int EQW::CountPlayers() {
}
//returns an array of character names in the zone (empty=all zones)
vector<string> EQW::ListPlayers(Const_char *zone_name) {
vector<string> res;
std::vector<std::string> EQW::ListPlayers(Const_char *zone_name) {
std::vector<std::string> res;
vector<ClientListEntry *> list;
std::vector<ClientListEntry *> list;
client_list.GetClients(zone_name, list);
vector<ClientListEntry *>::iterator cur, end;
std::vector<ClientListEntry *>::iterator cur, end;
cur = list.begin();
end = list.end();
for(; cur != end; cur++) {
@@ -180,8 +176,8 @@ vector<string> EQW::ListPlayers(Const_char *zone_name) {
return(res);
}
map<string,string> EQW::GetPlayerDetails(Const_char *char_name) {
map<string,string> res;
std::map<std::string,std::string> EQW::GetPlayerDetails(Const_char *char_name) {
std::map<std::string,std::string> res;
ClientListEntry *cle = client_list.FindCharacter(char_name);
if(cle == nullptr) {
@@ -213,7 +209,7 @@ int EQW::CountLaunchers(bool active_only) {
if(active_only)
return(launcher_list.GetLauncherCount());
vector<string> it(EQW::ListLaunchers());
std::vector<std::string> it(EQW::ListLaunchers());
return(it.size());
}
/*
@@ -223,10 +219,10 @@ vector<string> EQW::ListActiveLaunchers() {
return(launchers);
}*/
vector<string> EQW::ListLaunchers() {
std::vector<std::string> EQW::ListLaunchers() {
// vector<string> list;
// database.GetLauncherList(list);
vector<string> launchers;
std::vector<std::string> launchers;
launcher_list.GetLauncherNameList(launchers);
return(launchers);
@@ -405,8 +401,8 @@ int EQW::CountBugs() {
return 0;
}
vector<string> EQW::ListBugs(uint32 offset) {
vector<string> res;
std::vector<std::string> EQW::ListBugs(uint32 offset) {
std::vector<std::string> res;
char errbuf[MYSQL_ERRMSG_SIZE];
char* query = 0;
MYSQL_RES *result;
@@ -422,8 +418,8 @@ vector<string> EQW::ListBugs(uint32 offset) {
return res;
}
map<string,string> EQW::GetBugDetails(Const_char *id) {
map<string,string> res;
std::map<std::string,std::string> EQW::GetBugDetails(Const_char *id) {
std::map<std::string,std::string> res;
char errbuf[MYSQL_ERRMSG_SIZE];
char* query = 0;
MYSQL_RES *result;
@@ -447,7 +443,7 @@ map<string,string> EQW::GetBugDetails(Const_char *id) {
}
void EQW::ResolveBug(const char *id) {
vector<string> res;
std::vector<std::string> res;
char errbuf[MYSQL_ERRMSG_SIZE];
char* query = 0;
if(database.RunQuery(query, MakeAnyLenString(&query, "UPDATE bugs SET status=1 WHERE id=%s", id), errbuf)) {
+7 -8
View File
@@ -22,7 +22,6 @@
#include <vector>
#include <map>
#include "../common/types.h"
using namespace std;
class EQLConfig;
@@ -46,16 +45,16 @@ public:
void LSReconnect();
int CountZones();
vector<string> ListBootedZones(); //returns an array of zone_refs (opaque)
map<string,string> GetZoneDetails(Const_char *zone_ref); //returns a hash ref of details
std::vector<std::string> ListBootedZones(); //returns an array of zone_refs (opaque)
std::map<std::string,std::string> GetZoneDetails(Const_char *zone_ref); //returns a hash ref of details
int CountPlayers();
vector<string> ListPlayers(Const_char *zone_name = ""); //returns an array of player refs (opaque)
map<string,string> GetPlayerDetails(Const_char *player_ref); //returns a hash ref of details
std::vector<std::string> ListPlayers(Const_char *zone_name = ""); //returns an array of player refs (opaque)
std::map<std::string,std::string> GetPlayerDetails(Const_char *player_ref); //returns a hash ref of details
int CountLaunchers(bool active_only);
// vector<string> ListActiveLaunchers(); //returns an array of launcher names
vector<string> ListLaunchers(); //returns an array of launcher names
std::vector<std::string> ListLaunchers(); //returns an array of launcher names
EQLConfig * GetLauncher(Const_char *launcher_name); //returns the EQLConfig object for the specified launcher.
void CreateLauncher(Const_char *launcher_name, int dynamic_count);
// EQLConfig * FindLauncher(Const_char *zone_ref);
@@ -74,8 +73,8 @@ public:
//bugs
int CountBugs();
vector<string> ListBugs(uint32 offset); //returns an array of zone_refs (opaque)
map<string,string> GetBugDetails(const char *id);
std::vector<std::string> ListBugs(uint32 offset); //returns an array of zone_refs (opaque)
std::map<std::string,std::string> GetBugDetails(const char *id);
void ResolveBug(const char *id);
void SendMessage(uint32 type, const char *msg);
+18 -20
View File
@@ -25,8 +25,6 @@
#include "worlddb.h"
#include "console.h"
using namespace std;
Mime EQWHTTPHandler::s_mime;
#ifdef EMBPERL
EQWParser *EQWHTTPHandler::s_parser = nullptr;
@@ -48,7 +46,7 @@ EQWParser *EQWHTTPHandler::GetParser() {
if(s_parser == nullptr) {
EQW::Singleton()->ClearOutput();
s_parser = new EQWParser();
const string &res = EQW::Singleton()->GetOutput();
const std::string &res = EQW::Singleton()->GetOutput();
if(!res.empty()) {
printf("EQWParser Init output:\n%s\n\n", res.c_str());
EQW::Singleton()->ClearOutput();
@@ -75,7 +73,7 @@ void EQWHTTPHandler::Exec() {
SetHttpVersion("HTTP/1.0");
AddResponseHeader("Connection", "close");
if(GetUri().find("..") != string::npos) {
if(GetUri().find("..") != std::string::npos) {
SendResponse("403", "Forbidden");
printf("%s is forbidden.\n", GetUri().c_str());
return;
@@ -87,9 +85,9 @@ void EQWHTTPHandler::Exec() {
SendResponse("401", "Authorization Required");
SendString("Gotta Authenticate.");
} else {
string::size_type start = GetUri().find_first_not_of('/');
string page;
if(start != string::npos)
std::string::size_type start = GetUri().find_first_not_of('/');
std::string page;
if(start != std::string::npos)
page = GetUri().substr(start);
else
page = "index.html";
@@ -122,7 +120,7 @@ void EQWHTTPHandler::OnHeader(const std::string& key,const std::string& value) {
std::string::size_type cpos;
cpos = dec.find_first_of(':');
if(cpos == string::npos) {
if(cpos == std::string::npos) {
printf("Invalid auth string: %s\n", dec.c_str());
return;
}
@@ -154,7 +152,7 @@ bool EQWHTTPHandler::CheckAuth() const {
void EQWHTTPHandler::SendPage(const std::string &file) {
string path = "templates/";
std::string path = "templates/";
path += file;
FILE *f = fopen(path.c_str(), "rb");
@@ -165,7 +163,7 @@ void EQWHTTPHandler::SendPage(const std::string &file) {
return;
}
string type = s_mime.GetMimeFromFilename(file);
std::string type = s_mime.GetMimeFromFilename(file);
AddResponseHeader("Content-type", type);
bool process = false;
@@ -183,7 +181,7 @@ void EQWHTTPHandler::SendPage(const std::string &file) {
char *buffer = new char[READ_BUFFER_LEN+1];
size_t len;
string to_process;
std::string to_process;
while((len = fread(buffer, 1, READ_BUFFER_LEN, f)) > 0) {
buffer[len] = '\0';
if(process)
@@ -213,12 +211,12 @@ bool EQWHTTPHandler::LoadMimeTypes(const char *filename) {
}
#ifdef EMBPERL
void EQWHTTPHandler::ProcessAndSend(const string &str) {
string::size_type len = str.length();
string::size_type start = 0;
string::size_type pos, end;
void EQWHTTPHandler::ProcessAndSend(const std::string &str) {
std::string::size_type len = str.length();
std::string::size_type start = 0;
std::string::size_type pos, end;
while((pos = str.find("<?", start)) != string::npos) {
while((pos = str.find("<?", start)) != std::string::npos) {
//send all the crap leading up to the script block
if(pos != start) {
ProcessText(str.c_str() + start, pos-start);
@@ -226,15 +224,15 @@ void EQWHTTPHandler::ProcessAndSend(const string &str) {
//look for the end of this script block...
end = str.find("?>", pos+2);
if(end == string::npos) {
if(end == std::string::npos) {
//terminal ?> not found... should issue a warning or something...
string scriptBody = str.substr(pos+2);
std::string scriptBody = str.substr(pos+2);
ProcessScript(scriptBody);
start = len;
break;
} else {
//script only consumes some of this buffer...
string scriptBody = str.substr(pos+2, end-pos-2);
std::string scriptBody = str.substr(pos+2, end-pos-2);
ProcessScript(scriptBody);
start = end + 2;
}
@@ -253,7 +251,7 @@ void EQWHTTPHandler::ProcessScript(const std::string &script_body) {
// printf("Script: ''''%s''''\n\n", script_body.c_str());
GetParser()->EQW_eval("testing", script_body.c_str());
const string &res = EQW::Singleton()->GetOutput();
const std::string &res = EQW::Singleton()->GetOutput();
if(!res.empty()) {
ProcessText(res.c_str(), res.length());
EQW::Singleton()->ClearOutput();
+4 -7
View File
@@ -27,13 +27,10 @@
#include "../common/logsys.h"
#include "worlddb.h"
using namespace std;
#ifndef GvCV_set
#define GvCV_set(gv,cv) (GvCV(gv) = (cv))
#endif
XS(XS_EQWIO_PRINT);
//so embedded scripts can use xs extensions (ala 'use socket;')
@@ -186,7 +183,7 @@ void EQWParser::DoInit() {
#ifdef EMBPERL_PLUGIN
_log(WORLD__PERL, "Loading worldui perl plugins.");
string err;
std::string err;
if(!eval_file("world", "worldui.pl", err)) {
_log(WORLD__PERL_ERR, "Warning - world.pl: %s", err.c_str());
}
@@ -224,7 +221,7 @@ bool EQWParser::eval_file(const char * packagename, const char * filename, std::
return(dosub("eval_file", args, error));
}
bool EQWParser::dosub(const char * subname, const std::vector<std::string> &args, string &error, int mode) {
bool EQWParser::dosub(const char * subname, const std::vector<std::string> &args, std::string &error, int mode) {
bool err = false;
dSP; // initialize stack pointer
ENTER; // everything created after here
@@ -254,7 +251,7 @@ bool EQWParser::dosub(const char * subname, const std::vector<std::string> &args
return(true);
}
bool EQWParser::eval(const char * code, string &error) {
bool EQWParser::eval(const char * code, std::string &error) {
std::vector<std::string> arg;
arg.push_back(code);
return(dosub("my_eval", arg, error, G_SCALAR|G_DISCARD|G_EVAL|G_KEEPERR));
@@ -289,7 +286,7 @@ void EQWParser::EQW_eval(const char *pkg, const char *code) {
sv_setsv(l_db, _empty_sv);
}
string err;
std::string err;
if(!eval(code, err)) {
EQW::Singleton()->AppendOutput(err.c_str());
}
+2 -4
View File
@@ -22,12 +22,10 @@
#include "../common/SocketLib/HttpdForm.h"
#include <cstdlib>
using namespace std;
HTTPRequest::HTTPRequest(EQWHTTPHandler *h, HttpdForm *form)
: m_handler(h)
{
string name, value;
std::string name, value;
if(form->getfirst(name, value)) {
m_values[name] = value;
while(form->getnext(name, value))
@@ -47,7 +45,7 @@ const char *HTTPRequest::get(const char *name, const char *default_value) const
return(res->second.c_str());
}
map<string,string> HTTPRequest::get_all() const {
std::map<std::string,std::string> HTTPRequest::get_all() const {
return m_values;
}
+1 -3
View File
@@ -29,8 +29,6 @@
class HttpdForm;
class EQWHTTPHandler;
using namespace std;
class HTTPRequest {
public:
HTTPRequest(EQWHTTPHandler *h, HttpdForm *form);
@@ -44,7 +42,7 @@ public:
//returns a database-safe string
Const_char * getEscaped(Const_char *name, Const_char *default_value = "") const;
map<string,string> get_all() const;
std::map<std::string,std::string> get_all() const;
void redirect(Const_char *URL);
void SetResponseCode(Const_char *code);
-2
View File
@@ -30,11 +30,9 @@
#include <vector>
#include <string>
using namespace std;
extern LauncherList launcher_list;
LauncherLink::LauncherLink(int id, EmuTCPConnection *c)
: ID(id),
tcpc(c),
+18 -20
View File
@@ -23,29 +23,27 @@
#include "../common/logsys.h"
#include "EQLConfig.h"
using namespace std;
LauncherList::LauncherList()
: nextID(1)
{
}
LauncherList::~LauncherList() {
vector<LauncherLink *>::iterator cur, end;
std::vector<LauncherLink *>::iterator cur, end;
cur = m_pendingLaunchers.begin();
end = m_pendingLaunchers.end();
for(; cur != end; cur++) {
delete *cur;
}
map<string, EQLConfig *>::iterator curc, endc;
std::map<std::string, EQLConfig *>::iterator curc, endc;
curc = m_configs.begin();
endc = m_configs.end();
for(; curc != endc; curc++) {
delete curc->second;
}
map<string, LauncherLink *>::iterator curl, endl;
std::map<std::string, LauncherLink *>::iterator curl, endl;
curl = m_launchers.begin();
endl = m_launchers.end();
for(; curl != endl; curl++) {
@@ -55,7 +53,7 @@ LauncherList::~LauncherList() {
void LauncherList::Process() {
//process pending launchers..
vector<LauncherLink *>::iterator cur, end;
std::vector<LauncherLink *>::iterator cur, end;
cur = m_pendingLaunchers.begin();
while(cur != m_pendingLaunchers.end()) {
LauncherLink *l = *cur;
@@ -69,9 +67,9 @@ void LauncherList::Process() {
//launcher has identified itself now.
//remove ourself from the pending list
cur = m_pendingLaunchers.erase(cur);
string name = l->GetName();
std::string name = l->GetName();
//kill off anybody else using our name.
map<string, LauncherLink *>::iterator res;
std::map<std::string, LauncherLink *>::iterator res;
res = m_launchers.find(name);
if(res != m_launchers.end()) {
_log(WORLD__LAUNCH, "Ghosting launcher %s", name.c_str());
@@ -86,7 +84,7 @@ void LauncherList::Process() {
}
//process active launchers.
map<string, LauncherLink *>::iterator curl, tmp;
std::map<std::string, LauncherLink *>::iterator curl, tmp;
curl = m_launchers.begin();
while(curl != m_launchers.end()) {
LauncherLink *l = curl->second;
@@ -105,14 +103,14 @@ void LauncherList::Process() {
}
LauncherLink *LauncherList::Get(const char *name) {
map<string, LauncherLink *>::iterator res;
std::map<std::string, LauncherLink *>::iterator res;
res = m_launchers.find(name);
if(res == m_launchers.end())
return(nullptr);
return(res->second);
/* string goal(name);
/* std::string goal(name);
vector<LauncherLink *>::iterator cur, end;
std::vector<LauncherLink *>::iterator cur, end;
cur = m_launchers.begin();
end = m_launchers.end();
for(; cur != end; cur++) {
@@ -123,7 +121,7 @@ LauncherLink *LauncherList::Get(const char *name) {
}
LauncherLink *LauncherList::FindByZone(const char *short_name) {
map<string, LauncherLink *>::iterator cur, end;
std::map<std::string, LauncherLink *>::iterator cur, end;
cur = m_launchers.begin();
end = m_launchers.end();
for(; cur != end; cur++) {
@@ -144,8 +142,8 @@ int LauncherList::GetLauncherCount() {
return(m_launchers.size());
}
void LauncherList::GetLauncherNameList(std::vector<string> &res) {
map<string, EQLConfig *>::iterator cur, end;
void LauncherList::GetLauncherNameList(std::vector<std::string> &res) {
std::map<std::string, EQLConfig *>::iterator cur, end;
cur = m_configs.begin();
end = m_configs.end();
for(; cur != end; cur++) {
@@ -154,11 +152,11 @@ void LauncherList::GetLauncherNameList(std::vector<string> &res) {
}
void LauncherList::LoadList() {
vector<string> launchers;
std::vector<std::string> launchers;
database.GetLauncherList(launchers);
vector<string>::iterator cur, end;
std::vector<std::string>::iterator cur, end;
cur = launchers.begin();
end = launchers.end();
for(; cur != end; cur++) {
@@ -167,7 +165,7 @@ void LauncherList::LoadList() {
}
EQLConfig *LauncherList::GetConfig(const char *name) {
map<string, EQLConfig *>::iterator res;
std::map<std::string, EQLConfig *>::iterator res;
res = m_configs.find(name);
if(res == m_configs.end()) {
return(nullptr);
@@ -180,14 +178,14 @@ void LauncherList::CreateLauncher(const char *name, uint8 dynamic_count) {
}
void LauncherList::Remove(const char *name) {
map<string, EQLConfig *>::iterator resc;
std::map<std::string, EQLConfig *>::iterator resc;
resc = m_configs.find(name);
if(resc != m_configs.end()) {
delete resc->second;
m_configs.erase(resc);
}
map<string, LauncherLink *>::iterator resl;
std::map<std::string, LauncherLink *>::iterator resl;
resl = m_launchers.find(name);
if(resl != m_launchers.end()) {
resl->second->Disconnect();
-2
View File
@@ -17,11 +17,9 @@
*/
#include "../common/debug.h"
#include <iostream>
using namespace std;
#include <string.h>
#include <stdio.h>
#include <iomanip>
using namespace std;
#include <stdlib.h>
#include "../common/version.h"
-2
View File
@@ -17,11 +17,9 @@
*/
#include "../common/debug.h"
#include <iostream>
using namespace std;
#include <string.h>
#include <stdio.h>
#include <iomanip>
using namespace std;
#include <stdlib.h>
#include "../common/version.h"
+1 -1
View File
@@ -21,7 +21,7 @@
WorldConfig *WorldConfig::_world_config = nullptr;
string WorldConfig::GetByName(const string &var_name) const {
std::string WorldConfig::GetByName(const std::string &var_name) const {
if(var_name == "UpdateStats")
return(UpdateStats?"true":"false");
if(var_name == "LoginDisabled")
+3 -3
View File
@@ -22,7 +22,7 @@
class WorldConfig : public EQEmuConfig {
public:
virtual string GetByName(const string &var_name) const;
virtual std::string GetByName(const std::string &var_name) const;
bool UpdateStats;
bool LoginDisabled;
@@ -65,8 +65,8 @@ public:
static void DisableLoginserver() { if (_world_config) _world_config->LoginDisabled=true; }
static void EnableLoginserver() { if (_world_config) _world_config->LoginDisabled=false; }
static void SetWorldAddress(string addr) { if (_world_config) _world_config->WorldAddress=addr; }
static void SetLocalAddress(string addr) { if (_world_config) _world_config->LocalAddress=addr; }
static void SetWorldAddress(std::string addr) { if (_world_config) _world_config->WorldAddress=addr; }
static void SetLocalAddress(std::string addr) { if (_world_config) _world_config->LocalAddress=addr; }
void Dump() const;
};
+1 -3
View File
@@ -3,9 +3,7 @@
#include "../common/EQStreamIntf.h"
#include "../common/misc.h"
#include <iostream>
using namespace std;
#include <iomanip>
using namespace std;
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
@@ -133,7 +131,7 @@ void Client::SendLogServer()
safe_delete(outapp);
}
void Client::SendEnterWorld(string name)
void Client::SendEnterWorld(std::string name)
{
char char_name[32]= { 0 };
if (pZoning && database.GetLiveChar(GetAccountID(), char_name)) {
+4 -10
View File
@@ -29,13 +29,11 @@
#include "wguild_mgr.h"
#include <set>
using namespace std;
extern ConsoleList console_list;
extern ZSList zoneserver_list;
uint32 numplayers = 0; //this really wants to be a member variable of ClientList...
ClientList::ClientList()
: CLStale_timer(45000)
{
@@ -45,13 +43,11 @@ ClientList::ClientList()
ClientList::~ClientList() {
}
void ClientList::Process() {
if (CLStale_timer.Check())
CLCheckStale();
LinkedListIterator<Client*> iterator(list);
iterator.Reset();
@@ -69,7 +65,6 @@ void ClientList::Process() {
}
}
void ClientList::CLERemoveZSRef(ZoneServer* iZS) {
LinkedListIterator<ClientListEntry*> iterator(clientlist);
@@ -86,7 +81,6 @@ void ClientList::CLERemoveZSRef(ZoneServer* iZS) {
ClientListEntry* ClientList::GetCLE(uint32 iID) {
LinkedListIterator<ClientListEntry*> iterator(clientlist);
iterator.Reset();
while(iterator.MoreElements()) {
if (iterator.GetData()->GetID() == iID) {
@@ -760,7 +754,7 @@ void ClientList::SendWhoAll(uint32 fromid,const char* to, int16 admin, Who_All_S
void ClientList::SendFriendsWho(ServerFriendsWho_Struct *FriendsWho, WorldTCPConnection* connection) {
vector<ClientListEntry*> FriendsCLEs;
std::vector<ClientListEntry*> FriendsCLEs;
FriendsCLEs.reserve(100);
char Friend_[65];
@@ -1235,7 +1229,7 @@ bool ClientList::SendPacket(const char* to, ServerPacket* pack) {
}
void ClientList::SendGuildPacket(uint32 guild_id, ServerPacket* pack) {
set<uint32> zone_ids;
std::set<uint32> zone_ids;
LinkedListIterator<ClientListEntry*> iterator(clientlist);
@@ -1249,7 +1243,7 @@ void ClientList::SendGuildPacket(uint32 guild_id, ServerPacket* pack) {
//now we know all the zones, send it to each one... this is kinda a shitty way to do this
//since its basically O(n^2)
set<uint32>::iterator cur, end;
std::set<uint32>::iterator cur, end;
cur = zone_ids.begin();
end = zone_ids.end();
for(; cur != end; cur++) {
@@ -1276,7 +1270,7 @@ int ClientList::GetClientCount() {
return(numplayers);
}
void ClientList::GetClients(const char *zone_name, vector<ClientListEntry *> &res) {
void ClientList::GetClients(const char *zone_name, std::vector<ClientListEntry *> &res) {
LinkedListIterator<ClientListEntry *> iterator(clientlist);
iterator.Reset();
-1
View File
@@ -17,7 +17,6 @@
*/
#include "../common/debug.h"
#include <iostream>
using namespace std;
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
+21 -22
View File
@@ -18,7 +18,6 @@
#include "../common/debug.h"
#include <iostream>
using namespace std;
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
@@ -194,21 +193,21 @@ int main(int argc, char** argv) {
if (argc >= 2) {
char tmp[2];
if (strcasecmp(argv[1], "help") == 0 || strcasecmp(argv[1], "?") == 0 || strcasecmp(argv[1], "/?") == 0 || strcasecmp(argv[1], "-?") == 0 || strcasecmp(argv[1], "-h") == 0 || strcasecmp(argv[1], "-help") == 0) {
cout << "Worldserver command line commands:" << endl;
cout << "adduser username password flag - adds a user account" << endl;
cout << "flag username flag - sets GM flag on the account" << endl;
cout << "startzone zoneshortname - sets the starting zone" << endl;
cout << "-holdzones - reboots lost zones" << endl;
std::cout << "Worldserver command line commands:" << std::endl;
std::cout << "adduser username password flag - adds a user account" << std::endl;
std::cout << "flag username flag - sets GM flag on the account" << std::endl;
std::cout << "startzone zoneshortname - sets the starting zone" << std::endl;
std::cout << "-holdzones - reboots lost zones" << std::endl;
return 0;
}
else if (strcasecmp(argv[1], "-holdzones") == 0) {
cout << "Reboot Zones mode ON" << endl;
std::cout << "Reboot Zones mode ON" << std::endl;
holdzones = true;
}
else if (database.GetVariable("disablecommandline", tmp, 2)) {
if (strlen(tmp) == 1) {
if (tmp[0] == '1') {
cout << "Command line disabled in database... exiting" << endl;
std::cout << "Command line disabled in database... exiting" << std::endl;
return 0;
}
}
@@ -218,15 +217,15 @@ int main(int argc, char** argv) {
if (Seperator::IsNumber(argv[4])) {
if (atoi(argv[4]) >= 0 && atoi(argv[4]) <= 255) {
if (database.CreateAccount(argv[2], argv[3], atoi(argv[4])) == 0)
cout << "database.CreateAccount failed." << endl;
std::cout << "database.CreateAccount failed." << std::endl;
else
cout << "Account created: Username='" << argv[2] << "', Password='" << argv[3] << "', status=" << argv[4] << endl;
std::cout << "Account created: Username='" << argv[2] << "', Password='" << argv[3] << "', status=" << argv[4] << std::endl;
return 0;
}
}
}
cout << "Usage: world adduser username password flag" << endl;
cout << "flag = 0, 1 or 2" << endl;
std::cout << "Usage: world adduser username password flag" << std::endl;
std::cout << "flag = 0, 1 or 2" << std::endl;
return 0;
}
else if (strcasecmp(argv[1], "flag") == 0) {
@@ -235,38 +234,38 @@ int main(int argc, char** argv) {
if (atoi(argv[3]) >= 0 && atoi(argv[3]) <= 255) {
if (database.SetAccountStatus(argv[2], atoi(argv[3])))
cout << "Account flagged: Username='" << argv[2] << "', status=" << argv[3] << endl;
std::cout << "Account flagged: Username='" << argv[2] << "', status=" << argv[3] << std::endl;
else
cout << "database.SetAccountStatus failed." << endl;
std::cout << "database.SetAccountStatus failed." << std::endl;
return 0;
}
}
}
cout << "Usage: world flag username flag" << endl;
cout << "flag = 0-200" << endl;
std::cout << "Usage: world flag username flag" << std::endl;
std::cout << "flag = 0-200" << std::endl;
return 0;
}
else if (strcasecmp(argv[1], "startzone") == 0) {
if (argc == 3) {
if (strlen(argv[2]) < 3) {
cout << "Error: zone name too short" << endl;
std::cout << "Error: zone name too short" << std::endl;
}
else if (strlen(argv[2]) > 15) {
cout << "Error: zone name too long" << endl;
std::cout << "Error: zone name too long" << std::endl;
}
else {
if (database.SetVariable("startzone", argv[2]))
cout << "Starting zone changed: '" << argv[2] << "'" << endl;
std::cout << "Starting zone changed: '" << argv[2] << "'" << std::endl;
else
cout << "database.SetVariable failed." << endl;
std::cout << "database.SetVariable failed." << std::endl;
}
return 0;
}
cout << "Usage: world startzone zoneshortname" << endl;
std::cout << "Usage: world startzone zoneshortname" << std::endl;
return 0;
}
else {
cout << "Error, unknown command line option" << endl;
std::cout << "Error, unknown command line option" << std::endl;
return 0;
}
}
+4 -4
View File
@@ -358,7 +358,7 @@ XS(XS_EQLConfig_ListZones)
Perl_croak(aTHX_ "Usage: EQLConfig::ListZones(THIS)");
{
EQLConfig * THIS;
vector<string> RETVAL;
std::vector<std::string> RETVAL;
if (sv_derived_from(ST(0), "EQLConfig")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
@@ -379,7 +379,7 @@ XS(XS_EQLConfig_ListZones)
/* grow the stack to the number of elements being returned */
EXTEND(SP, RETVAL.size());
for (ix_RETVAL = 0; ix_RETVAL < RETVAL.size(); ix_RETVAL++) {
const string &it = RETVAL[ix_RETVAL];
const std::string &it = RETVAL[ix_RETVAL];
ST(ix_RETVAL) = sv_newmortal();
sv_setpvn(ST(ix_RETVAL), it.c_str(), it.length());
}
@@ -398,7 +398,7 @@ XS(XS_EQLConfig_GetZoneDetails)
Perl_croak(aTHX_ "Usage: EQLConfig::GetZoneDetails(THIS, zone_ref)");
{
EQLConfig * THIS;
map<string,string> RETVAL;
std::map<std::string,std::string> RETVAL;
Const_char * zone_ref = (Const_char *)SvPV_nolen(ST(1));
if (sv_derived_from(ST(0), "EQLConfig")) {
@@ -419,7 +419,7 @@ XS(XS_EQLConfig_GetZoneDetails)
sv_2mortal((SV*)hv);
ST(0) = newRV((SV*)hv);
map<string,string>::const_iterator cur, end;
std::map<std::string,std::string>::const_iterator cur, end;
cur = RETVAL.begin();
end = RETVAL.end();
for(; cur != end; cur++) {
+14 -14
View File
@@ -197,7 +197,7 @@ XS(XS_EQW_ListBootedZones)
Perl_croak(aTHX_ "Usage: EQW::ListBootedZones(THIS)");
{
EQW * THIS;
vector<string> RETVAL;
std::vector<std::string> RETVAL;
if (sv_derived_from(ST(0), "EQW")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
@@ -218,7 +218,7 @@ XS(XS_EQW_ListBootedZones)
/* grow the stack to the number of elements being returned */
EXTEND(SP, RETVAL.size());
for (ix_RETVAL = 0; ix_RETVAL < RETVAL.size(); ix_RETVAL++) {
const string &it = RETVAL[ix_RETVAL];
const std::string &it = RETVAL[ix_RETVAL];
ST(ix_RETVAL) = sv_newmortal();
sv_setpvn(ST(ix_RETVAL), it.c_str(), it.length());
}
@@ -237,7 +237,7 @@ XS(XS_EQW_GetZoneDetails)
Perl_croak(aTHX_ "Usage: EQW::GetZoneDetails(THIS, zone_ref)");
{
EQW * THIS;
map<string,string> RETVAL;
std::map<std::string,std::string> RETVAL;
Const_char * zone_ref = (Const_char *)SvPV_nolen(ST(1));
if (sv_derived_from(ST(0), "EQW")) {
@@ -258,7 +258,7 @@ XS(XS_EQW_GetZoneDetails)
sv_2mortal((SV*)hv);
ST(0) = newRV((SV*)hv);
map<string,string>::const_iterator cur, end;
std::map<std::string,std::string>::const_iterator cur, end;
cur = RETVAL.begin();
end = RETVAL.end();
for(; cur != end; cur++) {
@@ -310,7 +310,7 @@ XS(XS_EQW_ListPlayers)
Perl_croak(aTHX_ "Usage: EQW::ListPlayers(THIS, zone_name= \"\")");
{
EQW * THIS;
vector<string> RETVAL;
std::vector<std::string> RETVAL;
Const_char * zone_name;
if (sv_derived_from(ST(0), "EQW")) {
@@ -338,7 +338,7 @@ XS(XS_EQW_ListPlayers)
/* grow the stack to the number of elements being returned */
EXTEND(SP, RETVAL.size());
for (ix_RETVAL = 0; ix_RETVAL < RETVAL.size(); ix_RETVAL++) {
const string &it = RETVAL[ix_RETVAL];
const std::string &it = RETVAL[ix_RETVAL];
ST(ix_RETVAL) = sv_newmortal();
sv_setpvn(ST(ix_RETVAL), it.c_str(), it.length());
}
@@ -357,7 +357,7 @@ XS(XS_EQW_GetPlayerDetails)
Perl_croak(aTHX_ "Usage: EQW::GetPlayerDetails(THIS, player_ref)");
{
EQW * THIS;
map<string,string> RETVAL;
std::map<std::string,std::string> RETVAL;
Const_char * player_ref = (Const_char *)SvPV_nolen(ST(1));
if (sv_derived_from(ST(0), "EQW")) {
@@ -378,7 +378,7 @@ XS(XS_EQW_GetPlayerDetails)
sv_2mortal((SV*)hv);
ST(0) = newRV((SV*)hv);
map<string,string>::const_iterator cur, end;
std::map<std::string,std::string>::const_iterator cur, end;
cur = RETVAL.begin();
end = RETVAL.end();
for(; cur != end; cur++) {
@@ -431,7 +431,7 @@ XS(XS_EQW_ListLaunchers)
Perl_croak(aTHX_ "Usage: EQW::ListLaunchers(THIS)");
{
EQW * THIS;
vector<string> RETVAL;
std::vector<std::string> RETVAL;
if (sv_derived_from(ST(0), "EQW")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
@@ -452,7 +452,7 @@ XS(XS_EQW_ListLaunchers)
/* grow the stack to the number of elements being returned */
EXTEND(SP, RETVAL.size());
for (ix_RETVAL = 0; ix_RETVAL < RETVAL.size(); ix_RETVAL++) {
const string &it = RETVAL[ix_RETVAL];
const std::string &it = RETVAL[ix_RETVAL];
ST(ix_RETVAL) = sv_newmortal();
sv_setpvn(ST(ix_RETVAL), it.c_str(), it.length());
}
@@ -831,7 +831,7 @@ XS(XS_EQW_ListBugs)
{
EQW * THIS;
uint32 id = (uint32)SvUV(ST(1));
vector<string> RETVAL;
std::vector<std::string> RETVAL;
if (sv_derived_from(ST(0), "EQW")) {
@@ -853,7 +853,7 @@ XS(XS_EQW_ListBugs)
/* grow the stack to the number of elements being returned */
EXTEND(SP, RETVAL.size());
for (ix_RETVAL = 0; ix_RETVAL < RETVAL.size(); ix_RETVAL++) {
const string &it = RETVAL[ix_RETVAL];
const std::string &it = RETVAL[ix_RETVAL];
ST(ix_RETVAL) = sv_newmortal();
sv_setpvn(ST(ix_RETVAL), it.c_str(), it.length());
}
@@ -872,7 +872,7 @@ XS(XS_EQW_GetBugDetails)
Perl_croak(aTHX_ "Usage: EQW::GetBugDetails(THIS, bug_ref)");
{
EQW * THIS;
map<string,string> RETVAL;
std::map<std::string,std::string> RETVAL;
Const_char * bug_ref = (Const_char *)SvPV_nolen(ST(1));
if (sv_derived_from(ST(0), "EQW")) {
@@ -893,7 +893,7 @@ XS(XS_EQW_GetBugDetails)
sv_2mortal((SV*)hv);
ST(0) = newRV((SV*)hv);
map<string,string>::const_iterator cur, end;
std::map<std::string,std::string>::const_iterator cur, end;
cur = RETVAL.begin();
end = RETVAL.end();
for(; cur != end; cur++) {
+2 -2
View File
@@ -185,7 +185,7 @@ XS(XS_HTTPRequest_get_all)
Perl_croak(aTHX_ "Usage: HTTPRequest::get_all(THIS)");
{
HTTPRequest * THIS;
map<string,string> RETVAL;
std::map<std::string,std::string> RETVAL;
if (sv_derived_from(ST(0), "HTTPRequest")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
@@ -205,7 +205,7 @@ XS(XS_HTTPRequest_get_all)
sv_2mortal((SV*)hv);
ST(0) = newRV((SV*)hv);
map<string,string>::const_iterator cur, end;
std::map<std::string,std::string>::const_iterator cur, end;
cur = RETVAL.begin();
end = RETVAL.end();
for(; cur != end; cur++) {
+3 -4
View File
@@ -28,7 +28,6 @@
#include <vector>
#include "SoFCharCreateData.h"
using namespace std;
WorldDatabase database;
extern std::vector<RaceClassAllocation> character_create_allocations;
extern std::vector<RaceClassCombos> character_create_race_class_combos;
@@ -220,8 +219,8 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct*
}
else
{
cout << "Got a bogus character (" << row[0] << ") Ignoring!!!" << endl;
cout << "PP length ="<<lengths[1]<<" but PP should be "<<sizeof(PlayerProfile_Struct)<<endl;
std::cout << "Got a bogus character (" << row[0] << ") Ignoring!!!" << std::endl;
std::cout << "PP length ="<<lengths[1]<<" but PP should be "<<sizeof(PlayerProfile_Struct) << std::endl;
//DeleteCharacter(row[0]);
}
}
@@ -229,7 +228,7 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct*
}
else
{
cerr << "Error in GetCharSelectInfo query '" << query << "' " << errbuf << endl;
std::cerr << "Error in GetCharSelectInfo query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
return;
}
+1 -1
View File
@@ -705,7 +705,7 @@ int ZSList::GetZoneCount() {
return(numzones);
}
void ZSList::GetZoneIDList(vector<uint32> &zones) {
void ZSList::GetZoneIDList(std::vector<uint32> &zones) {
LinkedListIterator<ZoneServer*> iterator(list);
iterator.Reset();
while(iterator.MoreElements()) {