[10414] Constantify some functions in InstanceSave.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
VladimirMangos 2010-08-28 01:41:53 +04:00
parent 1ccf1ccd86
commit 6d5559544b
3 changed files with 14 additions and 14 deletions

View file

@ -86,7 +86,7 @@ void InstanceSave::SaveToDB()
CharacterDatabase.PExecute("INSERT INTO instance VALUES ('%u', '%u', '"UI64FMTD"', '%u', '%s')", m_instanceid, GetMapId(), (uint64)GetResetTimeForDB(), GetDifficulty(), data.c_str()); CharacterDatabase.PExecute("INSERT INTO instance VALUES ('%u', '%u', '"UI64FMTD"', '%u', '%s')", m_instanceid, GetMapId(), (uint64)GetResetTimeForDB(), GetDifficulty(), data.c_str());
} }
time_t InstanceSave::GetResetTimeForDB() time_t InstanceSave::GetResetTimeForDB() const
{ {
// only save the reset time for normal instances // only save the reset time for normal instances
const MapEntry *entry = sMapStore.LookupEntry(GetMapId()); const MapEntry *entry = sMapStore.LookupEntry(GetMapId());
@ -97,12 +97,12 @@ time_t InstanceSave::GetResetTimeForDB()
} }
// to cache or not to cache, that is the question // to cache or not to cache, that is the question
InstanceTemplate const* InstanceSave::GetTemplate() InstanceTemplate const* InstanceSave::GetTemplate() const
{ {
return ObjectMgr::GetInstanceTemplate(m_mapid); return ObjectMgr::GetInstanceTemplate(m_mapid);
} }
MapEntry const* InstanceSave::GetMapEntry() MapEntry const* InstanceSave::GetMapEntry() const
{ {
return sMapStore.LookupEntry(m_mapid); return sMapStore.LookupEntry(m_mapid);
} }

View file

@ -54,14 +54,14 @@ class InstanceSave
or when the instance is reset */ or when the instance is reset */
~InstanceSave(); ~InstanceSave();
uint8 GetPlayerCount() { return m_playerList.size(); } uint8 GetPlayerCount() const { return m_playerList.size(); }
uint8 GetGroupCount() { return m_groupList.size(); } uint8 GetGroupCount() const { return m_groupList.size(); }
/* A map corresponding to the InstanceId/MapId does not always exist. /* A map corresponding to the InstanceId/MapId does not always exist.
InstanceSave objects may be created on player logon but the maps are InstanceSave objects may be created on player logon but the maps are
created and loaded only when a player actually enters the instance. */ created and loaded only when a player actually enters the instance. */
uint32 GetInstanceId() { return m_instanceid; } uint32 GetInstanceId() const { return m_instanceid; }
uint32 GetMapId() { return m_mapid; } uint32 GetMapId() const { return m_mapid; }
/* Saved when the instance is generated for the first time */ /* Saved when the instance is generated for the first time */
void SaveToDB(); void SaveToDB();
@ -70,12 +70,12 @@ class InstanceSave
/* for normal instances this corresponds to max(creature respawn time) + X hours /* for normal instances this corresponds to max(creature respawn time) + X hours
for raid/heroic instances this caches the global respawn time for the map */ for raid/heroic instances this caches the global respawn time for the map */
time_t GetResetTime() { return m_resetTime; } time_t GetResetTime() const { return m_resetTime; }
void SetResetTime(time_t resetTime) { m_resetTime = resetTime; } void SetResetTime(time_t resetTime) { m_resetTime = resetTime; }
time_t GetResetTimeForDB(); time_t GetResetTimeForDB() const;
InstanceTemplate const* GetTemplate(); InstanceTemplate const* GetTemplate() const;
MapEntry const* GetMapEntry(); MapEntry const* GetMapEntry() const;
/* online players bound to the instance (perm/solo) /* online players bound to the instance (perm/solo)
does not include the members of the group unless they have permanent saves */ does not include the members of the group unless they have permanent saves */
@ -88,12 +88,12 @@ class InstanceSave
/* instances cannot be reset (except at the global reset time) /* instances cannot be reset (except at the global reset time)
if there are players permanently bound to it if there are players permanently bound to it
this is cached for the case when those players are offline */ this is cached for the case when those players are offline */
bool CanReset() { return m_canReset; } bool CanReset() const { return m_canReset; }
void SetCanReset(bool canReset) { m_canReset = canReset; } void SetCanReset(bool canReset) { m_canReset = canReset; }
/* currently it is possible to omit this information from this structure /* currently it is possible to omit this information from this structure
but that would depend on a lot of things that can easily change in future */ but that would depend on a lot of things that can easily change in future */
Difficulty GetDifficulty() { return m_difficulty; } Difficulty GetDifficulty() const { return m_difficulty; }
void SetUsedByMapState(bool state) void SetUsedByMapState(bool state)
{ {

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "10413" #define REVISION_NR "10414"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__