Planeshift
pscharacterlist.h
Go to the documentation of this file.
1 /*
2  * pscharacterlist.h
3  *
4  * Copyright (C) 2001 Atomic Blue (info@planeshift.it, http://www.atomicblue.org)
5  *
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation (version 2 of the License)
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17  *
18  */
19 
20 #ifndef __PSCHARACTERLIST_H__
21 #define __PSCHARACTERLIST_H__
22 
23 //=============================================================================
24 // Crystal Space Includes
25 //=============================================================================
26 
27 //=============================================================================
28 // Project Includes
29 //=============================================================================
30 #include "../icachedobject.h"
31 
32 //=============================================================================
33 // Local Includes
34 //=============================================================================
35 
36 
37 #define MAX_CHARACTERS_IN_LIST 10
38 
44 {
45 public:
48 
49  const char* GetCharacterName(int index);
50  const char* GetCharacterFullName(int index);
51  void SetCharacterName(int index,const char* v);
52  void SetCharacterFullName(int index,const char* v,const char* w);
53 
54  unsigned int GetCharacterID(int index);
55  void SetCharacterID(int index,unsigned int v);
56 
57  bool GetEntryValid(int index);
58  void SetEntryValid(int index,bool v);
59 
60  int GetListLength();
64  {
65  return validSize;
66  }
67 
70  void SetValidCount(int size)
71  {
72  validSize = size;
73  }
74 
75  // iCachedObject Functions below
76  virtual void ProcessCacheTimeout() {};
77  virtual void* RecoverObject()
78  {
79  return this;
80  }
81  virtual void DeleteSelf()
82  {
83  delete this;
84  }
85 
86 private:
87 
88  struct psCharacterListEntry
89  {
90  bool valid;
91  unsigned int character_id;
92  char character_name[28];
93  char character_fullname[56];
94  };
95 
96  psCharacterListEntry characterentry[MAX_CHARACTERS_IN_LIST];
97  int validSize;
98 };
99 
100 
101 #endif
102 
103 
void SetCharacterFullName(int index, const char *v, const char *w)
virtual void ProcessCacheTimeout()
This function is called by the generic cache if the specified ticks go by and the cache object is not...
virtual void * RecoverObject()
required for iCachedObject but not used here
#define MAX_CHARACTERS_IN_LIST
bool GetEntryValid(int index)
void SetCharacterID(int index, unsigned int v)
unsigned int GetCharacterID(int index)
const char * GetCharacterFullName(int index)
int GetValidCount()
Get the number of valid characters in list.
void SetEntryValid(int index, bool v)
Holds a list of characters associated to one account.
void SetValidCount(int size)
Set the number of valid characters in this list.
const char * GetCharacterName(int index)
virtual void DeleteSelf()
void SetCharacterName(int index, const char *v)