Merge fixes, hopefully didn't break anything.

This commit is contained in:
KimLS
2015-01-23 13:36:27 -08:00
259 changed files with 4107 additions and 6086 deletions
+9 -56
View File
@@ -15,7 +15,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include "../common/global_define.h"
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
@@ -75,13 +75,11 @@ Client *Entity::CastToClient()
{
if (this == 0x00) {
std::cout << "CastToClient error (nullptr)" << std::endl;
DebugBreak();
return 0;
}
#ifdef _EQDEBUG
if (!IsClient()) {
std::cout << "CastToClient error (not client?)" << std::endl;
DebugBreak();
return 0;
}
#endif
@@ -93,7 +91,6 @@ NPC *Entity::CastToNPC()
#ifdef _EQDEBUG
if (!IsNPC()) {
std::cout << "CastToNPC error" << std::endl;
DebugBreak();
return 0;
}
#endif
@@ -105,7 +102,6 @@ Mob *Entity::CastToMob()
#ifdef _EQDEBUG
if (!IsMob()) {
std::cout << "CastToMob error" << std::endl;
DebugBreak();
return 0;
}
#endif
@@ -117,7 +113,6 @@ Merc *Entity::CastToMerc()
#ifdef _EQDEBUG
if (!IsMerc()) {
std::cout << "CastToMerc error" << std::endl;
DebugBreak();
return 0;
}
#endif
@@ -129,7 +124,6 @@ Trap *Entity::CastToTrap()
{
#ifdef DEBUG
if (!IsTrap()) {
//std::cout << "CastToTrap error" << std::endl;
return 0;
}
#endif
@@ -141,7 +135,6 @@ Corpse *Entity::CastToCorpse()
#ifdef _EQDEBUG
if (!IsCorpse()) {
std::cout << "CastToCorpse error" << std::endl;
DebugBreak();
return 0;
}
#endif
@@ -153,7 +146,6 @@ Object *Entity::CastToObject()
#ifdef _EQDEBUG
if (!IsObject()) {
std::cout << "CastToObject error" << std::endl;
DebugBreak();
return 0;
}
#endif
@@ -164,7 +156,6 @@ Object *Entity::CastToObject()
#ifdef _EQDEBUG
if(!IsGroup()) {
std::cout << "CastToGroup error" << std::endl;
DebugBreak();
return 0;
}
#endif
@@ -185,13 +176,11 @@ const Client *Entity::CastToClient() const
{
if (this == 0x00) {
std::cout << "CastToClient error (nullptr)" << std::endl;
DebugBreak();
return 0;
}
#ifdef _EQDEBUG
if (!IsClient()) {
std::cout << "CastToClient error (not client?)" << std::endl;
DebugBreak();
return 0;
}
#endif
@@ -203,7 +192,6 @@ const NPC *Entity::CastToNPC() const
#ifdef _EQDEBUG
if (!IsNPC()) {
std::cout << "CastToNPC error" << std::endl;
DebugBreak();
return 0;
}
#endif
@@ -215,7 +203,6 @@ const Mob *Entity::CastToMob() const
#ifdef _EQDEBUG
if (!IsMob()) {
std::cout << "CastToMob error" << std::endl;
DebugBreak();
return 0;
}
#endif
@@ -227,7 +214,6 @@ const Merc *Entity::CastToMerc() const
#ifdef _EQDEBUG
if (!IsMerc()) {
std::cout << "CastToMerc error" << std::endl;
DebugBreak();
return 0;
}
#endif
@@ -238,7 +224,6 @@ const Trap *Entity::CastToTrap() const
{
#ifdef DEBUG
if (!IsTrap()) {
//std::cout << "CastToTrap error" << std::endl;
return 0;
}
#endif
@@ -250,7 +235,6 @@ const Corpse *Entity::CastToCorpse() const
#ifdef _EQDEBUG
if (!IsCorpse()) {
std::cout << "CastToCorpse error" << std::endl;
DebugBreak();
return 0;
}
#endif
@@ -262,7 +246,6 @@ const Object *Entity::CastToObject() const
#ifdef _EQDEBUG
if (!IsObject()) {
std::cout << "CastToObject error" << std::endl;
DebugBreak();
return 0;
}
#endif
@@ -285,7 +268,6 @@ Bot *Entity::CastToBot()
#ifdef _EQDEBUG
if (!IsBot()) {
std::cout << "CastToBot error" << std::endl;
DebugBreak();
return 0;
}
#endif
@@ -371,7 +353,7 @@ void EntityList::CheckGroupList (const char *fname, const int fline)
{
if (*it == nullptr)
{
LogFile->write(EQEmuLog::Error, "nullptr group, %s:%i", fname, fline);
Log.Out(Logs::General, Logs::Error, "nullptr group, %s:%i", fname, fline);
}
}
}
@@ -515,17 +497,17 @@ void EntityList::MobProcess()
#ifdef _WINDOWS
struct in_addr in;
in.s_addr = mob->CastToClient()->GetIP();
std::cout << "Dropping client: Process=false, ip=" << inet_ntoa(in) << ", port=" << mob->CastToClient()->GetPort() << std::endl;
Log.Out(Logs::General, Logs::Zone_Server, "Dropping client: Process=false, ip=%s port=%u", inet_ntoa(in), mob->CastToClient()->GetPort());
#endif
zone->StartShutdownTimer();
Group *g = GetGroupByMob(mob);
if(g) {
LogFile->write(EQEmuLog::Error, "About to delete a client still in a group.");
Log.Out(Logs::General, Logs::Error, "About to delete a client still in a group.");
g->DelMember(mob);
}
Raid *r = entity_list.GetRaidByClient(mob->CastToClient());
if(r) {
LogFile->write(EQEmuLog::Error, "About to delete a client still in a raid.");
Log.Out(Logs::General, Logs::Error, "About to delete a client still in a raid.");
r->MemberZoned(mob->CastToClient());
}
entity_list.RemoveClient(id);
@@ -557,7 +539,7 @@ void EntityList::AddGroup(Group *group)
uint32 gid = worldserver.NextGroupID();
if (gid == 0) {
LogFile->write(EQEmuLog::Error,
Log.Out(Logs::General, Logs::Error,
"Unable to get new group ID from world server. group is going to be broken.");
return;
}
@@ -586,7 +568,7 @@ void EntityList::AddRaid(Raid *raid)
uint32 gid = worldserver.NextGroupID();
if (gid == 0) {
LogFile->write(EQEmuLog::Error,
Log.Out(Logs::General, Logs::Error,
"Unable to get new group ID from world server. group is going to be broken.");
return;
}
@@ -2508,7 +2490,7 @@ char *EntityList::MakeNameUnique(char *name)
return name;
}
}
LogFile->write(EQEmuLog::Error, "Fatal error in EntityList::MakeNameUnique: Unable to find unique name for '%s'", name);
Log.Out(Logs::General, Logs::Error, "Fatal error in EntityList::MakeNameUnique: Unable to find unique name for '%s'", name);
char tmp[64] = "!";
strn0cpy(&tmp[1], name, sizeof(tmp) - 1);
strcpy(name, tmp);
@@ -3385,7 +3367,7 @@ void EntityList::ReloadAllClientsTaskState(int TaskID)
// If we have been passed a TaskID, only reload the client state if they have
// that Task active.
if ((!TaskID) || (TaskID && client->IsTaskActive(TaskID))) {
_log(TASKS__CLIENTLOAD, "Reloading Task State For Client %s", client->GetName());
Log.Out(Logs::General, Logs::Tasks, "[CLIENTLOAD] Reloading Task State For Client %s", client->GetName());
client->RemoveClientTaskState();
client->LoadClientTaskState();
taskmanager->SendActiveTasksToClient(client);
@@ -3526,35 +3508,6 @@ bool EntityList::LimitCheckName(const char *npc_name)
return true;
}
void EntityList::RadialSetLogging(Mob *around, bool enabled, bool clients,
bool non_clients, float range)
{
float range2 = range * range;
auto it = mob_list.begin();
while (it != mob_list.end()) {
Mob *mob = it->second;
++it;
if (mob->IsClient()) {
if (!clients)
continue;
} else {
if (!non_clients)
continue;
}
if (DistanceSquared(around->GetPosition(), mob->GetPosition()) > range2)
continue;
if (enabled)
mob->EnableLogging();
else
mob->DisableLogging();
}
}
void EntityList::UpdateHoTT(Mob *target)
{
auto it = client_list.begin();