* fixed exception when deleting objects from the ObjMgr.

* fixed(?) some problems with including SDL, which should be excluded
* no more quit at crpt error, please test
This commit is contained in:
False.Genesis 2007-02-26 14:45:25 +00:00
parent 605fbd2df5
commit 1da69e7873
6 changed files with 10 additions and 12 deletions

View File

@ -3,7 +3,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PseuWoW", "src\PseuWoW.vcpr
ProjectSection(ProjectDependencies) = postProject
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2} = {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}
{F548FC51-24A4-45FF-A381-BEBC39F18270} = {F548FC51-24A4-45FF-A381-BEBC39F18270}
{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} = {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}
{262199E8-EEDF-4700-A1D1-E9CC901CF480} = {262199E8-EEDF-4700-A1D1-E9CC901CF480}
EndProjectSection
EndProject

View File

@ -17,8 +17,8 @@ void ObjMgr::Remove(uint64 guid)
for(ObjectList::iterator i = _obj.begin(); i!=_obj.end(); i++)
if((*i)->GetGUID() == guid)
{
_obj.erase(i);
delete *i;
_obj.erase(i);
return;
}

View File

@ -13,7 +13,8 @@ Object::Object()
Object::~Object()
{
DEBUG(logdebug("~Object() id=%u ptr=0x%X valuesptr=0x%X",this->GetTypeId(),this,_uint32values));
ASSERT(_valuescount > 0);
DEBUG(logdebug("~Object() GUID="I64FMT,GetGUID()));
if(_uint32values)
delete [] _uint32values;
}
@ -26,7 +27,7 @@ void Object::_InitValues()
void Object::Create( uint64 guid )
{
//ASSERT(_valuescount > 0);
ASSERT(_valuescount > 0);
if(!_uint32values)
_InitValues();

View File

@ -35,7 +35,6 @@ enum TYPEID
class Object
{
public:
Object();
virtual ~Object();
inline const uint64 GetGUID() const { return GetUInt64Value(0); }
inline const uint32 GetGUIDLow() const { return GetUInt32Value(0); }
@ -75,7 +74,7 @@ public:
void Create(uint64 guid);
protected:
Object();
void _InitValues(void);
uint16 _valuescount;
@ -91,13 +90,14 @@ protected:
class WorldObject : public Object
{
public:
WorldObject();
virtual ~WorldObject ( ) {}
void SetPosition(float x, float y, float z, float o, uint16 _map);
inline float GetX(void) { return _x; }
inline float GetY(void) { return _y; }
inline float GetZ(void) { return _z; }
inline float GetO(void) { return _o; }
protected:
WorldObject();
float _x,_y,_z,_o; // coords, orientation
uint16 _m; // map

View File

@ -82,10 +82,7 @@ void WorldSession::_HandleUpdateObjectOpcode(WorldPacket& recvPacket)
{
case TYPEID_OBJECT: // no data to read
{
Object *obj = new Object();
obj->Create(uguid);
objmgr.Add(obj);
break;
logerror("Recieved wrong UPDATETYPE_CREATE_OBJECT to create Object base type!");
}
case TYPEID_ITEM:
{

View File

@ -72,10 +72,11 @@ void WorldSocket::OnRead()
if(_opcode > 800) // no opcode has yet a number over 800
{
logcritical("CRYPT ERROR: opcode=%u, remain=%u",_opcode,_remaining);
GetSession()->GetInstance()->SetError();
//GetSession()->GetInstance()->SetError(); // please test if this is stable!!!
// if the crypt gets messy its hardly possible to recover it, especially if we dont know
// the lentgh of the following data part
// TODO: invent some way how to recover the crypt (reconnect?)
delete [] buf; // drop the current queue content
return;
}