Skip to content

Commit

Permalink
[10414] Constantify some functions in InstanceSave.
Browse files Browse the repository at this point in the history
Signed-off-by: VladimirMangos <vladimir@getmangos.com>
  • Loading branch information
VladimirMangos committed Aug 27, 2010
1 parent 9eb3b0c commit 577a5e0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions src/game/InstanceSaveMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

time_t InstanceSave::GetResetTimeForDB()
time_t InstanceSave::GetResetTimeForDB() const
{
// only save the reset time for normal instances
const MapEntry *entry = sMapStore.LookupEntry(GetMapId());
Expand All @@ -97,12 +97,12 @@ time_t InstanceSave::GetResetTimeForDB()
}

// to cache or not to cache, that is the question
InstanceTemplate const* InstanceSave::GetTemplate()
InstanceTemplate const* InstanceSave::GetTemplate() const
{
return ObjectMgr::GetInstanceTemplate(m_mapid);
}

MapEntry const* InstanceSave::GetMapEntry()
MapEntry const* InstanceSave::GetMapEntry() const
{
return sMapStore.LookupEntry(m_mapid);
}
Expand Down
20 changes: 10 additions & 10 deletions src/game/InstanceSaveMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ class InstanceSave
or when the instance is reset */
~InstanceSave();

uint8 GetPlayerCount() { return m_playerList.size(); }
uint8 GetGroupCount() { return m_groupList.size(); }
uint8 GetPlayerCount() const { return m_playerList.size(); }
uint8 GetGroupCount() const { return m_groupList.size(); }

/* A map corresponding to the InstanceId/MapId does not always exist.
InstanceSave objects may be created on player logon but the maps are
created and loaded only when a player actually enters the instance. */
uint32 GetInstanceId() { return m_instanceid; }
uint32 GetMapId() { return m_mapid; }
uint32 GetInstanceId() const { return m_instanceid; }
uint32 GetMapId() const { return m_mapid; }

/* Saved when the instance is generated for the first time */
void SaveToDB();
Expand All @@ -70,12 +70,12 @@ class InstanceSave

/* 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 */
time_t GetResetTime() { return m_resetTime; }
time_t GetResetTime() const { return m_resetTime; }
void SetResetTime(time_t resetTime) { m_resetTime = resetTime; }
time_t GetResetTimeForDB();
time_t GetResetTimeForDB() const;

InstanceTemplate const* GetTemplate();
MapEntry const* GetMapEntry();
InstanceTemplate const* GetTemplate() const;
MapEntry const* GetMapEntry() const;

/* online players bound to the instance (perm/solo)
does not include the members of the group unless they have permanent saves */
Expand All @@ -88,12 +88,12 @@ class InstanceSave
/* instances cannot be reset (except at the global reset time)
if there are players permanently bound to it
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; }

/* 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 */
Difficulty GetDifficulty() { return m_difficulty; }
Difficulty GetDifficulty() const { return m_difficulty; }

void SetUsedByMapState(bool state)
{
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "10413"
#define REVISION_NR "10414"
#endif // __REVISION_NR_H__

0 comments on commit 577a5e0

Please sign in to comment.