Planeshift
Public Member Functions

psSkillCache Class Reference

The psSkillCache class implements the skill cache both on the server and on the client. More...

#include <skillcache.h>

List of all members.

Public Member Functions

void addItem (int skillId, psSkillCacheItem *item)
 Adds the skill to the cache using the skillId value as the key.
void apply (psSkillCache *list)
 Updates the cache.
void clear ()
 Clears the skill cache and deletes all the psSkillCacheItem objects in it.
unsigned short count () const
 Returns the number of modified items in the cache.
psSkillCacheItemgetItemBySkillId (uint id)
 Searches for the skill item with the given ID value and returns a pointer to it or NULL if not found.
unsigned int getProgressionPoints () const
bool hasRemoved ()
 Returns true if least one item has been removed from the cache.
bool isModified ()
 Returns true if the cache or at least one of the items in the cache is modified.
bool isNew () const
psSkillCacheIter iterBegin ()
 psSkillCache ()
void read (MsgEntry *)
 Reads new values for the cache and for items in it from the message entry.
void setModified (bool modified)
 Sets the modified state for the cache and all the items in the cache.
void setNew (bool value)
void setProgressionPoints (unsigned int points)
void setRemoved (bool removed)
 Sets the removed state for the cache.
unsigned short size () const
 Calculates the number of bytes needed for the message entry.
csString ToString () const
 Convert cache to string.
void write (MsgEntry *)
 Writes the cache and all the modified items to the message entry.
 ~psSkillCache ()

Detailed Description

The psSkillCache class implements the skill cache both on the server and on the client.

Definition at line 158 of file skillcache.h.


Constructor & Destructor Documentation

psSkillCache::psSkillCache ( )
psSkillCache::~psSkillCache ( )

Member Function Documentation

void psSkillCache::addItem ( int  skillId,
psSkillCacheItem item 
)

Adds the skill to the cache using the skillId value as the key.

The skill item shall be allocated in the heap because the skill cache will take ownership of the item and delete when necessary.

void psSkillCache::apply ( psSkillCache list)

Updates the cache.

The received list can contain new skills, updates to the existing skills or skills that should be removed from the cache.

void psSkillCache::clear ( )

Clears the skill cache and deletes all the psSkillCacheItem objects in it.

unsigned short psSkillCache::count ( ) const

Returns the number of modified items in the cache.

psSkillCacheItem* psSkillCache::getItemBySkillId ( uint  id)

Searches for the skill item with the given ID value and returns a pointer to it or NULL if not found.

The returned skill item is owned by the cache.

unsigned int psSkillCache::getProgressionPoints ( ) const [inline]

Definition at line 218 of file skillcache.h.

bool psSkillCache::hasRemoved ( )

Returns true if least one item has been removed from the cache.

bool psSkillCache::isModified ( )

Returns true if the cache or at least one of the items in the cache is modified.

bool psSkillCache::isNew ( ) const [inline]

Definition at line 221 of file skillcache.h.

psSkillCacheIter psSkillCache::iterBegin ( ) [inline]

Definition at line 188 of file skillcache.h.

void psSkillCache::read ( MsgEntry )

Reads new values for the cache and for items in it from the message entry.

void psSkillCache::setModified ( bool  modified)

Sets the modified state for the cache and all the items in the cache.

void psSkillCache::setNew ( bool  value) [inline]

Definition at line 220 of file skillcache.h.

void psSkillCache::setProgressionPoints ( unsigned int  points)
void psSkillCache::setRemoved ( bool  removed)

Sets the removed state for the cache.

unsigned short psSkillCache::size ( ) const

Calculates the number of bytes needed for the message entry.

csString psSkillCache::ToString ( ) const

Convert cache to string.

void psSkillCache::write ( MsgEntry )

Writes the cache and all the modified items to the message entry.

Make sure that no items in the cache are modified between size() and write() function calls.


The documentation for this class was generated from the following file: