From 3097b72ea271b2930b726833a6748a2c8f5b242a Mon Sep 17 00:00:00 2001 From: megamage Date: Sun, 7 Jun 2009 15:24:00 -0500 Subject: *Fix build. Remove files merged from TC1 which are no longer needed. --HG-- branch : trunk --- src/shared/Database/DBCEnums.h | 123 ----- src/shared/Database/DBCFileLoader.cpp | 261 ---------- src/shared/Database/DBCFileLoader.h | 107 ---- src/shared/Database/DBCStore.h | 94 ---- src/shared/Database/DBCStructure.h | 904 ---------------------------------- 5 files changed, 1489 deletions(-) delete mode 100644 src/shared/Database/DBCEnums.h delete mode 100644 src/shared/Database/DBCFileLoader.cpp delete mode 100644 src/shared/Database/DBCFileLoader.h delete mode 100644 src/shared/Database/DBCStore.h delete mode 100644 src/shared/Database/DBCStructure.h (limited to 'src/shared') diff --git a/src/shared/Database/DBCEnums.h b/src/shared/Database/DBCEnums.h deleted file mode 100644 index fbd87aafbe7..00000000000 --- a/src/shared/Database/DBCEnums.h +++ /dev/null @@ -1,123 +0,0 @@ -/* -* Copyright (C) 2005-2008 MaNGOS -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef DBCENUMS_H -#define DBCENUMS_H - -// client supported max level for player/pets/etc. Avoid overflow or client stability affected. -// also see GT_MAX_LEVEL define -#define MAX_LEVEL 100 - -// Server side limitation. Base at used code requirements. -// also see MAX_LEVEL and GT_MAX_LEVEL define -#define STRONG_MAX_LEVEL 255 - -enum AreaTeams -{ - AREATEAM_NONE = 0, - AREATEAM_ALLY = 2, - AREATEAM_HORDE = 4 -}; - -enum AreaFlags -{ - AREA_FLAG_SNOW = 0x00000001, // snow (only Dun Morogh, Naxxramas, Razorfen Downs and Winterspring) - AREA_FLAG_UNK1 = 0x00000002, // unknown, (only Naxxramas and Razorfen Downs) - AREA_FLAG_UNK2 = 0x00000004, // Only used on development map - AREA_FLAG_SLAVE_CAPITAL = 0x00000008, // slave capital city flag? - AREA_FLAG_UNK3 = 0x00000010, // unknown - AREA_FLAG_SLAVE_CAPITAL2 = 0x00000020, // slave capital city flag? - AREA_FLAG_UNK4 = 0x00000040, // many zones have this flag - AREA_FLAG_ARENA = 0x00000080, // arena, both instanced and world arenas - AREA_FLAG_CAPITAL = 0x00000100, // main capital city flag - AREA_FLAG_CITY = 0x00000200, // only for one zone named "City" (where it located?) - AREA_FLAG_OUTLAND = 0x00000400, // outland zones? (only Eye of the Storm not have this flag, but have 0x00004000 flag) - AREA_FLAG_SANCTUARY = 0x00000800, // sanctuary area (PvP disabled) - AREA_FLAG_NEED_FLY = 0x00001000, // only Netherwing Ledge, Socrethar's Seat, Tempest Keep, The Arcatraz, The Botanica, The Mechanar, Sorrow Wing Point, Dragonspine Ridge, Netherwing Mines, Dragonmaw Base Camp, Dragonmaw Skyway - AREA_FLAG_UNUSED1 = 0x00002000, // not used now (no area/zones with this flag set in 2.4.2) - AREA_FLAG_OUTLAND2 = 0x00004000, // outland zones? (only Circle of Blood Arena not have this flag, but have 0x00000400 flag) - AREA_FLAG_PVP = 0x00008000, // pvp objective area? (Death's Door also has this flag although it's no pvp object area) - AREA_FLAG_ARENA_INSTANCE = 0x00010000, // used by instanced arenas only - AREA_FLAG_UNUSED2 = 0x00020000, // not used now (no area/zones with this flag set in 2.4.2) - AREA_FLAG_UNK5 = 0x00040000, // just used for Amani Pass, Hatchet Hills - AREA_FLAG_LOWLEVEL = 0x00100000 // used for some starting areas with area_level <=15 -}; - -enum FactionTemplateFlags -{ - FACTION_TEMPLATE_FLAG_CONTESTED_GUARD = 0x00001000, // faction will attack players that were involved in PvP combats -}; - -enum FactionMasks -{ - FACTION_MASK_PLAYER = 1, // any player - FACTION_MASK_ALLIANCE = 2, // player or creature from alliance team - FACTION_MASK_HORDE = 4, // player or creature from horde team - FACTION_MASK_MONSTER = 8 // aggressive creature from monster team - // if none flags set then non-aggressive creature -}; - -enum MapTypes -{ - MAP_COMMON = 0, - MAP_INSTANCE = 1, - MAP_RAID = 2, - MAP_BATTLEGROUND = 3, - MAP_ARENA = 4 -}; - -enum AbilytyLearnType -{ - ABILITY_LEARNED_ON_GET_PROFESSION_SKILL = 1, - ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL = 2 -}; - -enum ItemEnchantmentType -{ - ITEM_ENCHANTMENT_TYPE_NONE = 0, - ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL = 1, - ITEM_ENCHANTMENT_TYPE_DAMAGE = 2, - ITEM_ENCHANTMENT_TYPE_EQUIP_SPELL = 3, - ITEM_ENCHANTMENT_TYPE_RESISTANCE = 4, - ITEM_ENCHANTMENT_TYPE_STAT = 5, - ITEM_ENCHANTMENT_TYPE_TOTEM = 6 -}; - -enum ItemEnchantmentAuraId -{ - ITEM_ENCHANTMENT_AURAID_POISON = 26, - ITEM_ENCHANTMENT_AURAID_NORMAL = 28, - ITEM_ENCHANTMENT_AURAID_FIRE = 32, - ITEM_ENCHANTMENT_AURAID_FROST = 33, - ITEM_ENCHANTMENT_AURAID_NATURE = 81, - ITEM_ENCHANTMENT_AURAID_SHADOW = 107 -}; - -enum TotemCategoryType -{ - TOTEM_CATEGORY_TYPE_KNIFE = 1, - TOTEM_CATEGORY_TYPE_TOTEM = 2, - TOTEM_CATEGORY_TYPE_ROD = 3, - TOTEM_CATEGORY_TYPE_PICK = 21, - TOTEM_CATEGORY_TYPE_STONE = 22, - TOTEM_CATEGORY_TYPE_HAMMER = 23, - TOTEM_CATEGORY_TYPE_SPANNER = 24 -}; - -#endif - diff --git a/src/shared/Database/DBCFileLoader.cpp b/src/shared/Database/DBCFileLoader.cpp deleted file mode 100644 index 23f602f5c93..00000000000 --- a/src/shared/Database/DBCFileLoader.cpp +++ /dev/null @@ -1,261 +0,0 @@ -/* - * Copyright (C) 2005-2009 MaNGOS - * - * Copyright (C) 2008-2009 Trinity - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include -#include -#include - -#include "DBCFileLoader.h" - -DBCFileLoader::DBCFileLoader() -{ - data = NULL; - fieldsOffset = NULL; -} - -bool DBCFileLoader::Load(const char *filename, const char *fmt) -{ - - uint32 header; - if(data) - { - delete [] data; - data=NULL; - } - - FILE * f=fopen(filename,"rb"); - if(!f)return false; - - if(fread(&header,4,1,f)!=1) // Number of records - return false; - - EndianConvert(header); - if(header!=0x43424457) - return false; //'WDBC' - - if(fread(&recordCount,4,1,f)!=1) // Number of records - return false; - - EndianConvert(recordCount); - - if(fread(&fieldCount,4,1,f)!=1) // Number of fields - return false; - - EndianConvert(fieldCount); - - if(fread(&recordSize,4,1,f)!=1) // Size of a record - return false; - - EndianConvert(recordSize); - - if(fread(&stringSize,4,1,f)!=1) // String size - return false; - - EndianConvert(stringSize); - - fieldsOffset = new uint32[fieldCount]; - fieldsOffset[0] = 0; - for(uint32 i = 1; i < fieldCount; i++) - { - fieldsOffset[i] = fieldsOffset[i - 1]; - if (fmt[i - 1] == 'b' || fmt[i - 1] == 'X') // byte fields - fieldsOffset[i] += 1; - else // 4 byte fields (int32/float/strings) - fieldsOffset[i] += 4; - } - - data = new unsigned char[recordSize*recordCount+stringSize]; - stringTable = data + recordSize*recordCount; - - if(fread(data,recordSize*recordCount+stringSize,1,f)!=1) - return false; - - fclose(f); - return true; -} - -DBCFileLoader::~DBCFileLoader() -{ - if(data) - delete [] data; - if(fieldsOffset) - delete [] fieldsOffset; -} - -DBCFileLoader::Record DBCFileLoader::getRecord(size_t id) -{ - assert(data); - return Record(*this, data + id*recordSize); -} - -uint32 DBCFileLoader::GetFormatRecordSize(const char * format,int32* index_pos) -{ - uint32 recordsize = 0; - int32 i = -1; - for(uint32 x=0; format[x];++x) - switch(format[x]) - { - case FT_FLOAT: - case FT_INT: - recordsize+=4; - break; - case FT_STRING: - recordsize+=sizeof(char*); - break; - case FT_SORT: - i=x; - break; - case FT_IND: - i=x; - recordsize+=4; - break; - case FT_BYTE: - recordsize += 1; - break; - } - - if(index_pos) - *index_pos = i; - - return recordsize; -} - -char* DBCFileLoader::AutoProduceData(const char* format, uint32& records, char**& indexTable) -{ - /* - format STRING, NA, FLOAT,NA,INT <=> - struct{ - char* field0, - float field1, - int field2 - }entry; - - this func will generate entry[rows] data; - */ - - typedef char * ptr; - if(strlen(format)!=fieldCount) - return NULL; - - //get struct size and index pos - int32 i; - uint32 recordsize=GetFormatRecordSize(format,&i); - - if(i>=0) - { - uint32 maxi=0; - //find max index - for(uint32 y=0;ymaxi)maxi=ind; - } - - ++maxi; - records=maxi; - indexTable=new ptr[maxi]; - memset(indexTable,0,maxi*sizeof(ptr)); - } - else - { - records = recordCount; - indexTable = new ptr[recordCount]; - } - - char* dataTable= new char[recordCount*recordsize]; - - uint32 offset=0; - - for(uint32 y =0;y=0) - { - indexTable[getRecord(y).getUInt(i)]=&dataTable[offset]; - } - else - indexTable[y]=&dataTable[offset]; - - for(uint32 x=0;x - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef DBC_FILE_LOADER_H -#define DBC_FILE_LOADER_H -#include "Platform/Define.h" -#include "Utilities/ByteConverter.h" -#include - -enum -{ - FT_NA='x', //not used or unknown, 4 byte size - FT_NA_BYTE='X', //not used or unknown, byte - FT_STRING='s', //char* - FT_FLOAT='f', //float - FT_INT='i', //uint32 - FT_BYTE='b', //uint8 - FT_SORT='d', //sorted by this field, field is not included - FT_IND='n', //the same,but parsed to data - FT_LOGIC='l' //Logical (boolean) -}; - -class DBCFileLoader -{ - public: - DBCFileLoader(); - ~DBCFileLoader(); - - bool Load(const char *filename, const char *fmt); - - class Record - { - public: - float getFloat(size_t field) const - { - assert(field < file.fieldCount); - float val = *reinterpret_cast(offset+file.GetOffset(field)); - EndianConvert(val); - return val; - } - uint32 getUInt(size_t field) const - { - assert(field < file.fieldCount); - uint32 val = *reinterpret_cast(offset+file.GetOffset(field)); - EndianConvert(val); - return val; - } - uint8 getUInt8(size_t field) const - { - assert(field < file.fieldCount); - return *reinterpret_cast(offset+file.GetOffset(field)); - } - - const char *getString(size_t field) const - { - assert(field < file.fieldCount); - size_t stringOffset = getUInt(field); - assert(stringOffset < file.stringSize); - return reinterpret_cast(file.stringTable + stringOffset); - } - - private: - Record(DBCFileLoader &file_, unsigned char *offset_): offset(offset_), file(file_) {} - unsigned char *offset; - DBCFileLoader &file; - - friend class DBCFileLoader; - - }; - - // Get record by id - Record getRecord(size_t id); - /// Get begin iterator over records - - uint32 GetNumRows() const { return recordCount;} - uint32 GetCols() const { return fieldCount; } - uint32 GetOffset(size_t id) const { return (fieldsOffset != NULL && id < fieldCount) ? fieldsOffset[id] : 0; } - bool IsLoaded() {return (data!=NULL);} - char* AutoProduceData(const char* fmt, uint32& count, char**& indexTable); - char* AutoProduceStrings(const char* fmt, char* dataTable); - static uint32 GetFormatRecordSize(const char * format, int32 * index_pos = NULL); - private: - - uint32 recordSize; - uint32 recordCount; - uint32 fieldCount; - uint32 stringSize; - uint32 *fieldsOffset; - unsigned char *data; - unsigned char *stringTable; -}; -#endif diff --git a/src/shared/Database/DBCStore.h b/src/shared/Database/DBCStore.h deleted file mode 100644 index 523d5c5a0b3..00000000000 --- a/src/shared/Database/DBCStore.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (C) 2005-2009 MaNGOS - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef DBCSTORE_H -#define DBCSTORE_H - -#include "DBCFileLoader.h" - -template -class DBCStorage -{ - typedef std::list StringPoolList; - public: - explicit DBCStorage(const char *f) : nCount(0), fieldCount(0), fmt(f), indexTable(NULL), m_dataTable(NULL) { } - ~DBCStorage() { Clear(); } - - T const* LookupEntry(uint32 id) const { return (id>=nCount)?NULL:indexTable[id]; } - uint32 GetNumRows() const { return nCount; } - char const* GetFormat() const { return fmt; } - uint32 GetFieldCount() const { return fieldCount; } - - bool Load(char const* fn) - { - DBCFileLoader dbc; - // Check if load was sucessful, only then continue - if(!dbc.Load(fn, fmt)) - return false; - - fieldCount = dbc.GetCols(); - m_dataTable = (T*)dbc.AutoProduceData(fmt,nCount,(char**&)indexTable); - m_stringPoolList.push_back(dbc.AutoProduceStrings(fmt,(char*)m_dataTable)); - - // error in dbc file at loading if NULL - return indexTable!=NULL; - } - - bool LoadStringsFrom(char const* fn) - { - // DBC must be already loaded using Load - if(!indexTable) - return false; - - DBCFileLoader dbc; - // Check if load was successful, only then continue - if(!dbc.Load(fn, fmt)) - return false; - - m_stringPoolList.push_back(dbc.AutoProduceStrings(fmt,(char*)m_dataTable)); - - return true; - } - - void Clear() - { - if (!indexTable) - return; - - delete[] ((char*)indexTable); - indexTable = NULL; - delete[] ((char*)m_dataTable); - m_dataTable = NULL; - - while(!m_stringPoolList.empty()) - { - delete[] m_stringPoolList.front(); - m_stringPoolList.pop_front(); - } - nCount = 0; - } - - private: - uint32 nCount; - uint32 fieldCount; - char const* fmt; - T** indexTable; - T* m_dataTable; - StringPoolList m_stringPoolList; -}; -#endif diff --git a/src/shared/Database/DBCStructure.h b/src/shared/Database/DBCStructure.h deleted file mode 100644 index 8e8aa8bfba8..00000000000 --- a/src/shared/Database/DBCStructure.h +++ /dev/null @@ -1,904 +0,0 @@ -/* - * Copyright (C) 2005-2008 MaNGOS - * - * Copyright (C) 2008 Trinity - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef DBCSTRUCTURE_H -#define DBCSTRUCTURE_H - -#include "DBCEnums.h" -#include "Platform/Define.h" - -#include -#include -#include - -// Structures using to access raw DBC data and required packing to portability - -// GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push,N), also any gcc version not support it at some platform -#if defined( __GNUC__ ) -#pragma pack(1) -#else -#pragma pack(push,1) -#endif - -struct AreaTableEntry -{ - uint32 ID; // 0 - uint32 mapid; // 1 - uint32 zone; // 2 if 0 then it's zone, else it's zone id of this area - uint32 exploreFlag; // 3, main index - uint32 flags; // 4, unknown value but 312 for all cities - // 5-9 unused - int32 area_level; // 10 - char* area_name[16]; // 11-26 - // 27, string flags, unused - uint32 team; // 28 -}; - -struct AreaTriggerEntry -{ - uint32 id; // 0 - uint32 mapid; // 1 - float x; // 2 - float y; // 3 - float z; // 4 - float radius; // 5 - float box_x; // 6 extent x edge - float box_y; // 7 extent y edge - float box_z; // 8 extent z edge - float box_orientation; // 9 extent rotation by about z axis -}; - -struct AuctionHouseEntry -{ - uint32 houseId; // 0 index - uint32 faction; // 1 id of faction.dbc for player factions associated with city - uint32 depositPercent; // 2 1/3 from real - uint32 cutPercent; // 3 - //char* name[16]; // 4-19 - // 20 string flag, unused -}; - -struct BankBagSlotPricesEntry -{ - uint32 ID; - uint32 price; -}; - -struct BattlemasterListEntry -{ - uint32 id; // 0 - uint32 mapid[3]; // 1-3 mapid - // 4-8 unused - uint32 type; // 9 (3 - BG, 4 - arena) - uint32 minlvl; // 10 - uint32 maxlvl; // 11 - uint32 maxplayersperteam; // 12 - // 13-14 unused - char* name[16]; // 15-30 - // 31 string flag, unused - // 32 unused -}; - -#define MAX_OUTFIT_ITEMS 12 -// #define MAX_OUTFIT_ITEMS 24 // 12->24 in 3.0.x - -struct CharStartOutfitEntry -{ - //uint32 Id; // 0 - uint32 RaceClassGender; // 1 (UNIT_FIELD_BYTES_0 & 0x00FFFFFF) comparable (0 byte = race, 1 byte = class, 2 byte = gender) - int32 ItemId[MAX_OUTFIT_ITEMS]; // 2-13 - //int32 ItemDisplayId[MAX_OUTFIT_ITEMS]; // 14-25 not required at server side - //int32 ItemInventorySlot[MAX_OUTFIT_ITEMS]; // 26-37 not required at server side - //uint32 Unknown1; // 38, unique values (index-like with gaps ordered in other way as ids) - //uint32 Unknown2; // 39 - //uint32 Unknown3; // 40 -}; - -struct CharTitlesEntry -{ - uint32 ID; // 0, title ids, for example in Quest::GetCharTitleId() - //uint32 unk1; // 1 flags? - //char* name[16]; // 2-17, unused - // 18 string flag, unused - //char* name2[16]; // 19-34, unused - // 35 string flag, unused - uint32 bit_index; // 36 used in PLAYER_CHOSEN_TITLE and 1<