Skip to content

Instantly share code, notes, and snippets.

@SilverIce
Created September 25, 2011 23:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SilverIce/1241312 to your computer and use it in GitHub Desktop.
Save SilverIce/1241312 to your computer and use it in GitHub Desktop.
@@ -1466,11 +1466,11 @@ void ObjectMgr::LoadGameObjects()
{
sLog.outErrorDb("Gameobject (GUID: %u Entry %u GoType: %u) have invalid displayId (%u), not loaded.", guid, entry, gInfo->type, gInfo->displayId);
continue;
}
- GameObjectData& data = mGameObjectDataMap[guid];
+ GameObjectData data;
data.id = entry;
data.mapid = fields[ 2].GetUInt32();
data.posX = fields[ 3].GetFloat();
data.posY = fields[ 4].GetFloat();
@@ -1479,10 +1479,17 @@ void ObjectMgr::LoadGameObjects()
data.rotation.x = fields[ 7].GetFloat();
data.rotation.y = fields[ 8].GetFloat();
data.rotation.z = fields[ 9].GetFloat();
data.rotation.w = fields[10].GetFloat();
data.spawntimesecs = fields[11].GetInt32();
+ data.animprogress = fields[12].GetUInt32();
+ data.go_state = (GOState)fields[13].GetUInt32();
+ data.spawnMask = fields[14].GetUInt8();
+ data.phaseMask = fields[15].GetUInt16();
+ int16 gameEvent = fields[16].GetInt16();
+ int16 GuidPoolId = fields[17].GetInt16();
+ int16 EntryPoolId = fields[18].GetInt16();
MapEntry const* mapEntry = sMapStore.LookupEntry(data.mapid);
if(!mapEntry)
{
sLog.outErrorDb("Table `gameobject` have gameobject (GUID: %u Entry: %u) that spawned at nonexistent map (Id: %u), skip", guid, data.id, data.mapid);
@@ -1495,25 +1502,15 @@ void ObjectMgr::LoadGameObjects()
if (data.spawntimesecs == 0 && gInfo->IsDespawnAtAction())
{
sLog.outErrorDb("Table `gameobject` have gameobject (GUID: %u Entry: %u) with `spawntimesecs` (0) value, but gameobejct marked as despawnable at action.", guid, data.id);
}
- data.animprogress = fields[12].GetUInt32();
-
- uint32 go_state = fields[13].GetUInt32();
- if (go_state >= MAX_GO_STATE)
+ if (data.go_state >= MAX_GO_STATE)
{
sLog.outErrorDb("Table `gameobject` have gameobject (GUID: %u Entry: %u) with invalid `state` (%u) value, skip", guid, data.id, go_state);
continue;
}
- data.go_state = GOState(go_state);
-
- data.spawnMask = fields[14].GetUInt8();
- data.phaseMask = fields[15].GetUInt16();
- int16 gameEvent = fields[16].GetInt16();
- int16 GuidPoolId = fields[17].GetInt16();
- int16 EntryPoolId = fields[18].GetInt16();
if (data.rotation.x < -1.0f || data.rotation.x > 1.0f)
{
sLog.outErrorDb("Table `gameobject` have gameobject (GUID: %u Entry: %u) with invalid rotation.x (%f) value, skip", guid, data.id, data.rotation.x);
continue;
@@ -1547,10 +1544,12 @@ void ObjectMgr::LoadGameObjects()
{
sLog.outErrorDb("Table `gameobject` have gameobject (GUID: %u Entry: %u) with `phaseMask`=0 (not visible for anyone), set to 1.", guid, data.id);
data.phaseMask = 1;
}
+ mGameObjectDataMap[guid] = data;
+
if (gameEvent==0 && GuidPoolId==0 && EntryPoolId==0)// if not this is to be managed by GameEvent System or Pool system
AddGameobjectToGrid(guid, &data);
++count;
} while (result->NextRow());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment