Core/DBLayer: Correct few more wrong read types (No. 1)

DB/World: Some consistency in the ints "length" field (not really a length)

From A to D world tables verified; missing all the others

int(11) -> int32
unsigned int(10) -> uint32
mediumint(8) -> int32
unsigned mediumint(8) -> uint32
smallint(6) -> int16
unsigned smallint(5) -> uint16
tinyint(4) -> int8
unsigned tinyint(3) -> uint8
This commit is contained in:
Nay
2012-03-27 00:43:56 +01:00
parent 8f365de4b2
commit a92820b51c
11 changed files with 95 additions and 46 deletions
@@ -56,10 +56,10 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Texts()
StringTextData temp;
int32 i = fields[0].GetInt32();
temp.SoundId = fields[1].GetInt32();
temp.Type = fields[2].GetInt32();
temp.Language = fields[3].GetInt32();
temp.Emote = fields[4].GetInt32();
temp.SoundId = fields[1].GetUInt32();
temp.Type = fields[2].GetUInt8();
temp.Language = fields[3].GetUInt8();
temp.Emote = fields[4].GetUInt16();
// range negative
if (i > MIN_CREATURE_AI_TEXT_STRING_ID || i <= MAX_CREATURE_AI_TEXT_STRING_ID)
@@ -187,7 +187,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
temp.creature_id = fields[1].GetUInt32();
uint32 creature_id = temp.creature_id;
uint32 e_type = fields[2].GetUInt32();
uint32 e_type = fields[2].GetUInt8();
//Report any errors in event
if (e_type >= EVENT_T_END)
{
@@ -196,13 +196,13 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
}
temp.event_type = EventAI_Type(e_type);
temp.event_inverse_phase_mask = fields[3].GetUInt32();
temp.event_chance = fields[4].GetUInt8();
temp.event_flags = fields[5].GetUInt8();
temp.raw.param1 = fields[6].GetUInt32();
temp.raw.param2 = fields[7].GetUInt32();
temp.raw.param3 = fields[8].GetUInt32();
temp.raw.param4 = fields[9].GetUInt32();
temp.event_inverse_phase_mask = fields[3].GetInt32();
temp.event_chance = fields[4].GetUInt32();
temp.event_flags = fields[5].GetUInt32();
temp.raw.param1 = fields[6].GetInt32();
temp.raw.param2 = fields[7].GetInt32();
temp.raw.param3 = fields[8].GetInt32();
temp.raw.param4 = fields[9].GetInt32();
//Creature does not exist in database
if (!sObjectMgr->GetCreatureTemplate(temp.creature_id))
@@ -399,7 +399,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
for (uint32 j = 0; j < MAX_ACTIONS; j++)
{
uint16 action_type = fields[10+(j*4)].GetUInt16();
uint16 action_type = fields[10+(j*4)].GetUInt8();
if (action_type >= ACTION_T_END)
{
sLog->outErrorDb("CreatureEventAI: Event %u Action %u has incorrect action type (%u), replace by ACTION_T_NONE.", i, j+1, action_type);
@@ -410,9 +410,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
CreatureEventAI_Action& action = temp.action[j];
action.type = EventAI_ActionType(action_type);
action.raw.param1 = fields[11+(j*4)].GetUInt32();
action.raw.param2 = fields[12+(j*4)].GetUInt32();
action.raw.param3 = fields[13+(j*4)].GetUInt32();
action.raw.param1 = fields[11+(j*4)].GetInt32();
action.raw.param2 = fields[12+(j*4)].GetInt32();
action.raw.param3 = fields[13+(j*4)].GetInt32();
//Report any errors in actions
switch (action.type)
@@ -2282,7 +2282,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
continue;
}
uint32 dataType = fields[1].GetUInt32();
uint32 dataType = fields[1].GetUInt8();
const char* scriptName = fields[4].GetCString();
uint32 scriptId = 0;
if (strcmp(scriptName, "")) // not empty
@@ -708,10 +708,10 @@ void BattlegroundMgr::CreateInitialBattlegrounds()
CreateBattlegroundData data;
data.bgTypeId = BattlegroundTypeId(bgTypeID_);
data.IsArena = (bl->type == TYPE_ARENA);
data.MinPlayersPerTeam = fields[1].GetUInt32();
data.MaxPlayersPerTeam = fields[2].GetUInt32();
data.LevelMin = fields[3].GetUInt32();
data.LevelMax = fields[4].GetUInt32();
data.MinPlayersPerTeam = fields[1].GetUInt16();
data.MaxPlayersPerTeam = fields[2].GetUInt16();
data.LevelMin = fields[3].GetUInt8();
data.LevelMax = fields[4].GetUInt8();
//check values from DB
if (data.MaxPlayersPerTeam == 0 || data.MinPlayersPerTeam == 0 || data.MinPlayersPerTeam > data.MaxPlayersPerTeam)
{
+2 -2
View File
@@ -719,8 +719,8 @@ void ConditionMgr::LoadConditions(bool isReload)
Condition* cond = new Condition();
int32 iSourceTypeOrReferenceId = fields[0].GetInt32();
cond->SourceGroup = fields[1].GetUInt32();
cond->SourceEntry = fields[2].GetInt32();
cond->SourceId = fields[3].GetUInt32();
cond->SourceEntry = fields[2].GetUInt32();
cond->SourceId = fields[3].GetInt32();
cond->ElseGroup = fields[4].GetUInt32();
int32 iConditionTypeOrReference = fields[5].GetInt32();
cond->ConditionTarget = fields[6].GetUInt8();
@@ -101,7 +101,7 @@ void FormationMgr::LoadCreatureFormations()
group_member = new FormationInfo();
group_member->leaderGUID = fields[0].GetUInt32();
uint32 memberGUID = fields[1].GetUInt32();
group_member->groupAI = fields[4].GetUInt8();
group_member->groupAI = fields[4].GetUInt32();
//If creature is group leader we may skip loading of dist/angle
if (group_member->leaderGUID != memberGUID)
{
@@ -144,14 +144,14 @@ void MapManager::LoadTransportNPCs()
do
{
Field* fields = result->Fetch();
uint32 guid = fields[0].GetUInt32();
uint32 entry = fields[1].GetUInt32();
uint32 transportEntry = fields[2].GetUInt32();
uint32 guid = fields[0].GetInt32();
uint32 entry = fields[1].GetInt32();
uint32 transportEntry = fields[2].GetInt32();
float tX = fields[3].GetFloat();
float tY = fields[4].GetFloat();
float tZ = fields[5].GetFloat();
float tO = fields[6].GetFloat();
uint32 anim = fields[7].GetUInt32();
uint32 anim = fields[7].GetInt32();
for (MapManager::TransportSet::iterator itr = m_Transports.begin(); itr != m_Transports.end(); ++itr)
{
+12 -12
View File
@@ -422,7 +422,7 @@ void ObjectMgr::LoadCreatureTemplates()
creatureTemplate.GossipMenuId = fields[13].GetUInt32();
creatureTemplate.minlevel = fields[14].GetUInt8();
creatureTemplate.maxlevel = fields[15].GetUInt8();
creatureTemplate.expansion = uint32(fields[16].GetUInt16());
creatureTemplate.expansion = uint32(fields[16].GetInt16());
creatureTemplate.faction_A = uint32(fields[17].GetUInt16());
creatureTemplate.faction_H = uint32(fields[18].GetUInt16());
creatureTemplate.npcflag = fields[19].GetUInt32();
@@ -455,7 +455,7 @@ void ObjectMgr::LoadCreatureTemplates()
creatureTemplate.SkinLootId = fields[46].GetUInt32();
for (uint8 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
creatureTemplate.resistance[i] = fields[47 + i -1].GetInt32();
creatureTemplate.resistance[i] = fields[47 + i -1].GetInt16();
for (uint8 i = 0; i < CREATURE_MAX_SPELLS; ++i)
creatureTemplate.spells[i] = fields[53 + i].GetUInt32();
@@ -5975,7 +5975,7 @@ void ObjectMgr::LoadAreaTriggerTeleports()
AreaTrigger at;
at.target_mapId = fields[1].GetUInt32();
at.target_mapId = fields[1].GetUInt16();
at.target_X = fields[2].GetFloat();
at.target_Y = fields[3].GetFloat();
at.target_Z = fields[4].GetFloat();
@@ -6837,13 +6837,13 @@ void ObjectMgr::LoadReputationOnKill()
uint32 creature_id = fields[0].GetUInt32();
ReputationOnKillEntry repOnKill;
repOnKill.RepFaction1 = fields[1].GetUInt32();
repOnKill.RepFaction2 = fields[2].GetUInt32();
repOnKill.RepFaction1 = fields[1].GetInt16();
repOnKill.RepFaction2 = fields[2].GetInt16();
repOnKill.IsTeamAward1 = fields[3].GetBool();
repOnKill.ReputationMaxCap1 = fields[4].GetUInt32();
repOnKill.ReputationMaxCap1 = fields[4].GetUInt8();
repOnKill.RepValue1 = fields[5].GetInt32();
repOnKill.IsTeamAward2 = fields[6].GetBool();
repOnKill.ReputationMaxCap2 = fields[7].GetUInt32();
repOnKill.ReputationMaxCap2 = fields[7].GetUInt8();
repOnKill.RepValue2 = fields[8].GetInt32();
repOnKill.TeamDependent = fields[9].GetUInt8();
@@ -8692,16 +8692,16 @@ void ObjectMgr::LoadCreatureClassLevelStats()
{
Field* fields = result->Fetch();
uint8 Level = fields[0].GetUInt8();
uint8 Class = fields[1].GetUInt8();
uint8 Level = fields[0].GetInt8();
uint8 Class = fields[1].GetInt8();
CreatureBaseStats stats;
for (uint8 i = 0; i < MAX_CREATURE_BASE_HP; ++i)
stats.BaseHealth[i] = fields[i + 2].GetUInt16();
stats.BaseHealth[i] = fields[i + 2].GetInt16();
stats.BaseMana = fields[5].GetUInt16();
stats.BaseArmor = fields[6].GetUInt16();
stats.BaseMana = fields[5].GetInt16();
stats.BaseArmor = fields[6].GetInt16();
if (!Class || ((1 << (Class - 1)) & CLASSMASK_ALL_CREATURES) == 0)
sLog->outErrorDb("Creature base stats for level %u has invalid class %u", Level, Class);
+1 -1
View File
@@ -116,7 +116,7 @@ uint32 LootStore::LoadLootTable()
uint16 lootmode = fields[3].GetUInt16();
uint8 group = fields[4].GetUInt8();
int32 mincountOrRef = fields[5].GetInt32();
int32 maxcount = fields[6].GetInt32();
int32 maxcount = fields[6].GetUInt8();
if (maxcount > std::numeric_limits<uint8>::max())
{
+4 -4
View File
@@ -109,11 +109,11 @@ void SystemMgr::LoadScriptTextsCustom()
Field* pFields = result->Fetch();
StringTextData temp;
int32 iId = pFields[0].GetInt32();
int32 iId = pFields[0].GetInt32();
temp.uiSoundId = pFields[1].GetUInt32();
temp.uiType = pFields[2].GetUInt32();
temp.uiLanguage = pFields[3].GetUInt32();
temp.uiEmote = pFields[4].GetUInt32();
temp.uiType = pFields[2].GetUInt8();
temp.uiLanguage = pFields[3].GetUInt8();
temp.uiEmote = pFields[4].GetUInt16();
if (iId >= 0)
{