OregonCore  revision 3611e8a-git
Your Favourite TBC server
World.cpp File Reference
#include "Common.h"
#include "Database/DatabaseEnv.h"
#include "Config/Config.h"
#include "SystemConfig.h"
#include "Log.h"
#include "Console.h"
#include "Opcodes.h"
#include "WorldSession.h"
#include "WorldPacket.h"
#include "Weather.h"
#include "Player.h"
#include "SkillExtraItems.h"
#include "SkillDiscovery.h"
#include "World.h"
#include "AccountMgr.h"
#include "AuctionHouseMgr.h"
#include "ObjectMgr.h"
#include "SpellMgr.h"
#include "Chat.h"
#include "DBCStores.h"
#include "LootMgr.h"
#include "ItemEnchantmentMgr.h"
#include "MapManager.h"
#include "CreatureAIRegistry.h"
#include "BattlegroundMgr.h"
#include "OutdoorPvPMgr.h"
#include "TemporarySummon.h"
#include "AuctionHouseBot.h"
#include "WaypointMovementGenerator.h"
#include "VMapFactory.h"
#include "MoveMap.h"
#include "GameEventMgr.h"
#include "PoolMgr.h"
#include "Database/DatabaseImpl.h"
#include "GridNotifiersImpl.h"
#include "CellImpl.h"
#include "InstanceSaveMgr.h"
#include "SmartAI.h"
#include "TicketMgr.h"
#include "Util.h"
#include "Language.h"
#include "CreatureGroups.h"
#include "Transports.h"
#include "CreatureEventAIMgr.h"
#include "CreatureTextMgr.h"
#include "ScriptMgr.h"
#include "WardenDataStorage.h"
#include "DisableMgr.h"
#include "ConditionMgr.h"
#include "VMapManager2.h"
#include "M2Stores.h"
#include <ace/Dirent.h>

Go to the source code of this file.

Functions

 INSTANTIATE_SINGLETON_1 (World)
 
void LoadGameObjectModelList ()
 

Function Documentation

INSTANTIATE_SINGLETON_1 ( World  )
void LoadGameObjectModelList ( )

Definition at line 46 of file GameObjectModel.cpp.

References ERROR_LOG, VMAP::GAMEOBJECT_MODELS, GameobjectModelData::GameobjectModelData(), getMSTime(), getMSTimeDiff(), model_list, sLog, and sWorld.

Referenced by World::LoadSQLUpdates(), and World::SetInitialWorldSettings().

47 {
48  uint32 oldMSTime = getMSTime();
49  FILE* model_list_file = fopen((sWorld.GetDataPath() + "vmaps/" + VMAP::GAMEOBJECT_MODELS).c_str(), "rb");
50  if (!model_list_file)
51  {
52  ERROR_LOG("Unable to open '%s' file.", VMAP::GAMEOBJECT_MODELS);
53  return;
54  }
55 
56  uint32 name_length, displayId;
57  char buff[500];
58  while (true)
59  {
60  Vector3 v1, v2;
61  if (fread(&displayId, sizeof(uint32), 1, model_list_file) != 1)
62  if (feof(model_list_file)) // EOF flag is only set after failed reading attempt
63  break;
64 
65  if (fread(&name_length, sizeof(uint32), 1, model_list_file) != 1
66  || name_length >= sizeof(buff)
67  || fread(&buff, sizeof(char), name_length, model_list_file) != name_length
68  || fread(&v1, sizeof(Vector3), 1, model_list_file) != 1
69  || fread(&v2, sizeof(Vector3), 1, model_list_file) != 1)
70  {
71  ERROR_LOG("File '%s' seems to be corrupted!", VMAP::GAMEOBJECT_MODELS);
72  break;
73  }
74 
75  model_list.insert
76  (
77  ModelList::value_type( displayId, GameobjectModelData(std::string(buff,name_length),AABox(v1,v2)) )
78  );
79  }
80 
81  fclose(model_list_file);
82  sLog.outString(">> Loaded %u GameObject models in %u ms", uint32(model_list.size()), getMSTimeDiff(oldMSTime, getMSTime()));
83  sLog.outString();
84 }
uint32 getMSTimeDiff(uint32 oldMSTime, uint32 newMSTime)
Definition: Timer.h:78
uint32 getMSTime()
Definition: Timer.h:32
#define sLog
Log class singleton.
Definition: Log.h:187
ModelList model_list
#define ERROR_LOG(...)
const char GAMEOBJECT_MODELS[]
#define sWorld
Definition: World.h:860
ACE_UINT32 uint32
Definition: Define.h:71