[9399] Simplify config options loading code.

This commit is contained in:
VladimirMangos 2010-02-16 22:13:14 +03:00
parent d20e50a8e5
commit d536661cbf
4 changed files with 429 additions and 508 deletions

View file

@ -1645,7 +1645,7 @@ bool Creature::IsOutOfThreatArea(Unit* pVictim) const
return false;
float AttackDist = GetAttackDistance(pVictim);
uint32 ThreatRadius = sWorld.getConfig(CONFIG_UINT32_THREAT_RADIUS);
float ThreatRadius = sWorld.getConfig(CONFIG_FLOAT_THREAT_RADIUS);
//Use AttackDistance in distance check if threat radius is lower. This prevents creature bounce in and out of combat every update tick.
return !pVictim->IsWithinDist3d(CombatStartX, CombatStartY, CombatStartZ,

File diff suppressed because it is too large Load diff

View file

@ -155,7 +155,6 @@ enum eConfigUint32Values
CONFIG_UINT32_CORPSE_DECAY_ELITE,
CONFIG_UINT32_CORPSE_DECAY_RAREELITE,
CONFIG_UINT32_CORPSE_DECAY_WORLDBOSS,
CONFIG_UINT32_THREAT_RADIUS,
CONFIG_UINT32_INSTANT_LOGOUT,
CONFIG_UINT32_BATTLEGROUND_INVITATION_TYPE,
CONFIG_UINT32_BATTLEGROUND_PREMATURE_FINISH_TIMER,
@ -251,6 +250,7 @@ enum eConfigFLoatValues
CONFIG_FLOAT_CREATURE_FAMILY_FLEE_ASSISTANCE_RADIUS,
CONFIG_FLOAT_CREATURE_FAMILY_ASSISTANCE_RADIUS,
CONFIG_FLOAT_GROUP_XP_DISTANCE,
CONFIG_FLOAT_THREAT_RADIUS,
CONFIG_FLOAT_VALUE_COUNT
};
@ -553,6 +553,23 @@ class World
void InitDailyQuestResetTime();
void ResetDailyQuests();
private:
void setConfig(eConfigUint32Values index, char const* fieldname, uint32 defvalue);
void setConfig(eConfigInt32Values index, char const* fieldname, int32 defvalue);
void setConfig(eConfigFLoatValues index, char const* fieldname, float defvalue);
void setConfig(eConfigBoolValues index, char const* fieldname, bool defvalue);
void setConfigPos(eConfigUint32Values index, char const* fieldname, uint32 defvalue);
void setConfigPos(eConfigFLoatValues index, char const* fieldname, float defvalue);
void setConfigMin(eConfigUint32Values index, char const* fieldname, uint32 defvalue, uint32 minvalue);
void setConfigMin(eConfigInt32Values index, char const* fieldname, int32 defvalue, int32 minvalue);
void setConfigMin(eConfigFLoatValues index, char const* fieldname, float defvalue, float minvalue);
void setConfigMinMax(eConfigUint32Values index, char const* fieldname, uint32 defvalue, uint32 minvalue, uint32 maxvalue);
void setConfigMinMax(eConfigInt32Values index, char const* fieldname, int32 defvalue, int32 minvalue, int32 maxvalue);
void setConfigMinMax(eConfigFLoatValues index, char const* fieldname, float defvalue, float minvalue, float maxvalue);
bool configNoReload(bool reload, eConfigUint32Values index, char const* fieldname, uint32 defvalue);
bool configNoReload(bool reload, eConfigInt32Values index, char const* fieldname, int32 defvalue);
bool configNoReload(bool reload, eConfigFLoatValues index, char const* fieldname, float defvalue);
bool configNoReload(bool reload, eConfigBoolValues index, char const* fieldname, bool defvalue);
static volatile bool m_stopEvent;
static uint8 m_ExitCode;
uint32 m_ShutdownTimer;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "9398"
#define REVISION_NR "9399"
#endif // __REVISION_NR_H__