123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- #include "Maths.h" // Needed for coords.
- #include "Game.h"
- #ifndef _CHARACTER_HEADER_
- #define _CHARACTER_HEADER_
- static const int max_alertness = 8;
- static const int max_fatigue = 8;
- static const int max_health = 8;
- // Map attribute names to attribute fields.
- #define ALERT 'A'
- #define ALERTNESS 'a'
- #define FATIGUE 'F'
- #define EXHAUSTED 'E'
- #define HEALTH 'H'
- #define ISPC 'p'
- #define WIN 'w'
- #define REP 'R'
- #define ID 'I'
- #define POS_X 'X'
- #define POS_Y 'Y'
- #define BAD_KEY -1
- typedef struct { char* str; int val; } attr;
- static attr Attrs[] = {
- { "id", ID },
- { "ispc", ISPC },
- { "x", POS_X },
- { "y", POS_Y },
- { "rep", REP },
- { "alert", ALERT },
- { "alertness", ALERTNESS },
- { "fatigue", FATIGUE },
- { "exhausted", EXHAUSTED },
- { "win", WIN },
- { "health", HEALTH }
- };
- int AttrHash( char* a );
- static int nattrs = sizeof(Attrs)/sizeof(attr);
- typedef struct character {
- game context;
- coords pos;
- char rep;
- int id;
- int ispc;
- int alert;
- int alertness;
- int fatigue;
- int exhausted;
- int win;
- int health;
- } character;
- //typedef character* chr;
- chr CreateCharacter(struct Game* g);
- void PurgeCharacter( chr c ); // Release all memory used within character.
- void ResetCharacter( chr c ); // Reset all character attributes to defaults.
- void CopyCharacter( chr sink, chr source );
- void SetStat( chr c, char* stat, int newval );
- int GetStat( chr c, char* stat );
- void init_pc( chr c );
- void init_npc( chr c );
- void FilePrint( chr c );
- void CursesPrint( chr c );
- #endif
|