Planeshift

pscharacterlist.h

Go to the documentation of this file.
00001 /*
00002  * pscharacterlist.h
00003  *
00004  * Copyright (C) 2001 Atomic Blue ([email protected], http://www.atomicblue.org)
00005  *
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation (version 2 of the License)
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00017  *
00018  */
00019 
00020 #ifndef __PSCHARACTERLIST_H__
00021 #define __PSCHARACTERLIST_H__
00022 
00023 //=============================================================================
00024 // Crystal Space Includes
00025 //=============================================================================
00026 
00027 //=============================================================================
00028 // Project Includes
00029 //=============================================================================
00030 #include "../icachedobject.h"
00031 
00032 //=============================================================================
00033 // Local Includes
00034 //=============================================================================
00035 
00036 
00037 #define MAX_CHARACTERS_IN_LIST 10
00038 
00039 class psCharacterList : public iCachedObject
00040 {
00041 public:
00042     psCharacterList();
00043     ~psCharacterList();
00044 
00045     const char* GetCharacterName(int index);
00046     const char* GetCharacterFullName(int index);
00047     void SetCharacterName(int index,const char* v);
00048     void SetCharacterFullName(int index,const char* v,const char* w);
00049 
00050     unsigned int GetCharacterID(int index);
00051     void SetCharacterID(int index,unsigned int v);
00052 
00053     bool GetEntryValid(int index);
00054     void SetEntryValid(int index,bool v);
00055 
00056     int GetListLength();
00059     int GetValidCount()
00060     {
00061         return validSize;
00062     }
00063 
00066     void SetValidCount(int size)
00067     {
00068         validSize = size;
00069     }
00070 
00071     // iCachedObject Functions below
00072     virtual void ProcessCacheTimeout() {};  
00073     virtual void* RecoverObject()
00074     {
00075         return this;    
00076     }
00077     virtual void DeleteSelf()
00078     {
00079         delete this;    
00080     }
00081 
00082 private:
00083 
00084     struct psCharacterListEntry
00085     {
00086         bool valid;
00087         unsigned int character_id;
00088         char character_name[28];
00089         char character_fullname[56];
00090     };
00091 
00092     psCharacterListEntry characterentry[MAX_CHARACTERS_IN_LIST];
00093     int validSize;
00094 };
00095 
00096 
00097 #endif
00098 
00099