project_files/frontlib/model/team.h
changeset 7224 5143861c83bd
parent 7179 f84805e6df03
child 7227 1c859f572d72
equal deleted inserted replaced
7221:8d04e85ca204 7224:5143861c83bd
    10 #define TEAM_DEFAULT_HOGNAME "Hog"
    10 #define TEAM_DEFAULT_HOGNAME "Hog"
    11 #define TEAM_DEFAULT_HAT "NoHat"
    11 #define TEAM_DEFAULT_HAT "NoHat"
    12 #define TEAM_DEFAULT_DIFFICULTY 0
    12 #define TEAM_DEFAULT_DIFFICULTY 0
    13 #define TEAM_DEFAULT_HEALTH 100
    13 #define TEAM_DEFAULT_HEALTH 100
    14 
    14 
       
    15 // TODO default bindings?
       
    16 
       
    17 typedef struct {
       
    18 	char *action;
       
    19 	char *binding;
       
    20 } flib_binding;
       
    21 
    15 typedef struct {
    22 typedef struct {
    16 	char *name;
    23 	char *name;
    17 	char *hat;
    24 	char *hat;
    18 
    25 
    19 	// Statistics. They are irrelevant for the engine or server,
    26 	// Statistics. They are irrelevant for the engine or server,
    20 	// but provided for ini reading/writing by the frontend.
    27 	// but provided for ini reading/writing by the frontend.
    21 	int rounds;
    28 	int rounds;
       
    29 	int kills;
    22 	int deaths;
    30 	int deaths;
    23 	int kills;
       
    24 	int suicides;
    31 	int suicides;
    25 
    32 
    26 	// These settings are sometimes used on a per-team basis.
       
    27 	int difficulty;
    33 	int difficulty;
       
    34 
       
    35 	// Transient setting used in game setup
    28 	int initialHealth;
    36 	int initialHealth;
    29 } flib_hog;
    37 } flib_hog;
    30 
    38 
    31 typedef struct {
    39 typedef struct {
    32 	flib_hog hogs[HEDGEHOGS_PER_TEAM];
    40 	flib_hog hogs[HEDGEHOGS_PER_TEAM];
    34 	char *grave;
    42 	char *grave;
    35 	char *fort;
    43 	char *fort;
    36 	char *voicepack;
    44 	char *voicepack;
    37 	char *flag;
    45 	char *flag;
    38 
    46 
    39 	// TODO binds
    47 	flib_binding *bindings;
       
    48 	int bindingCount;
       
    49 
       
    50 	// Statistics. They are irrelevant for the engine or server,
       
    51 	// but provided for ini reading/writing by the frontend.
       
    52 	int rounds;
       
    53 	int wins;
       
    54 	int campaignProgress;
    40 
    55 
    41 	// Transient settings used in game setup
    56 	// Transient settings used in game setup
    42 	uint32_t color;
    57 	uint32_t color;
    43 	int hogsInGame;
    58 	int hogsInGame;
    44 	bool remoteDriven;
    59 	bool remoteDriven;
    45 	char *hash;
    60 	char *hash; // TODO calculate
    46 
    61 
    47 	// This setting is sometimes used on a per-game basis.
       
    48 	flib_weaponset *weaponset;
    62 	flib_weaponset *weaponset;
    49 } flib_team;
    63 } flib_team;
    50 
    64 
       
    65 /**
       
    66  * Returns a new team, or NULL on error. name must not be NULL.
       
    67  *
       
    68  * The new team is pre-filled with default settings (see hwconsts.h)
       
    69  */
       
    70 flib_team *flib_team_create(const char *name);
       
    71 
       
    72 /**
       
    73  * Loads a team, returns NULL on error.
       
    74  */
       
    75 flib_team *flib_team_from_ini(const char *filename);
       
    76 
       
    77 /**
       
    78  * Write the team to an ini file. Attempts to retain extra ini settings
       
    79  * that were already present. Note that not all fields of a team struct
       
    80  * are stored in the ini, some are only used intermittently to store
       
    81  * information about a team in the context of a game.
       
    82  */
       
    83 int flib_team_to_ini(const char *filename, const flib_team *team);
       
    84 void flib_team_destroy(flib_team *team);
       
    85 
    51 #endif /* TEAM_H_ */
    86 #endif /* TEAM_H_ */