00001 00002 #ifndef USERDATA_H 00003 #define USERDATA_H 00004 00005 #include <plib/ssg.h> 00006 #include <plib/netMessage.h> 00007 00008 #define COUNT_NATIONS 4 00009 // should match this... 00010 typedef enum { 00011 ENGLISH = 0, 00012 SPANISH, 00013 FRENCH, 00014 DUTCH 00015 } _Nations; 00016 00017 00018 class userData : public ssgBase { 00019 public: 00020 userData() ; 00021 userData(char* fn); 00022 userData(userData* other); 00023 userData(netMessage* msg); 00024 00025 virtual ~userData(); 00026 00027 int save(FILE* fd); 00028 int load(FILE* fd); 00029 void print(FILE* fd, char *indent = "", int how_much = 2 ) {}; 00030 char* getTypeName() { return "userData"; } 00031 00032 char* get_nick() { return strdup(nick); } 00033 char* get_first_name() { return strdup(first_name);} 00034 char* get_last_name() { return strdup(last_name);} 00035 bool is_male() { return male;} 00036 char get_player_nation() { return nation;} 00037 00038 int get_player_fame(int nation_index); 00039 int* get_player_fame(); 00040 00041 unsigned long int get_money () { return money;} 00042 unsigned int get_crew_number() { return crew_members;} 00043 00044 netMessage* exportAsNetworkMsg(); 00045 userData* clone(int cf); 00046 00047 protected: 00048 void copy_from (userData* other, int clone_flags); 00049 00050 private: 00051 void _reset_vals(); 00052 char* nick; 00053 char* first_name; 00054 char* last_name; 00055 00056 bool male; 00057 char nation; 00058 int fame[COUNT_NATIONS]; 00059 00060 unsigned long int money; 00061 unsigned int crew_members; 00062 00063 //ShipCore* ship; 00064 int sector[2]; 00065 }; 00066 #endif