project_files/frontlib/model/team.h
changeset 7482 d70a5b0d1190
parent 7470 0db1780ca938
child 7497 7e1d72fc03c7
equal deleted inserted replaced
7479:c8c552ee3acb 7482:d70a5b0d1190
    22  *
    22  *
    23  * Teams are used in several different contexts in Hedgewars, and some of these require
    23  * Teams are used in several different contexts in Hedgewars, and some of these require
    24  * extra information about teams. For example, the weaponset is important
    24  * extra information about teams. For example, the weaponset is important
    25  * to the engine, but not for ini reading/writing, and with the team statistics it is the
    25  * to the engine, but not for ini reading/writing, and with the team statistics it is the
    26  * other way around. To keep things simple, the data structure can hold all information
    26  * other way around. To keep things simple, the data structure can hold all information
    27  * used in any context. On the downside, tat means we can't use static typing to ensure
    27  * used in any context. On the downside, that means we can't use static typing to ensure
    28  * that team information is "complete" for a particular purpose.
    28  * that team information is "complete" for a particular purpose.
    29  */
    29  */
    30 #ifndef TEAM_H_
    30 #ifndef TEAM_H_
    31 #define TEAM_H_
    31 #define TEAM_H_
    32 
    32 
    37 #include <stdbool.h>
    37 #include <stdbool.h>
    38 #include <stdint.h>
    38 #include <stdint.h>
    39 
    39 
    40 #define TEAM_DEFAULT_HEALTH 100
    40 #define TEAM_DEFAULT_HEALTH 100
    41 
    41 
       
    42 /**
       
    43  * Struct representing a single keybinding.
       
    44  */
    42 typedef struct {
    45 typedef struct {
    43 	char *action;
    46 	char *action;
    44 	char *binding;
    47 	char *binding;
    45 } flib_binding;
    48 } flib_binding;
    46 
    49 
    47 typedef struct {
    50 typedef struct {
    48 	char *name;
    51 	char *name;
    49 	char *hat;
    52 	char *hat;			// e.g. hair_yellow; References a .png file in Data/Graphics/Hats
    50 
    53 
    51 	// Statistics. They are irrelevant for the engine or server,
    54 	// Statistics. They are irrelevant for the engine or server,
    52 	// but provided for ini reading/writing by the frontend.
    55 	// but provided for ini reading/writing by the frontend.
    53 	int rounds;
    56 	int rounds;
    54 	int kills;
    57 	int kills;
    55 	int deaths;
    58 	int deaths;
    56 	int suicides;
    59 	int suicides;
    57 
    60 
    58 	int difficulty;
    61 	int difficulty;		// 0 = human, 1 = most difficult bot ... 5 = least difficult bot (somewhat counterintuitive)
    59 
    62 
    60 	// Transient setting used in game setup
    63 	// Transient setting used in game setup
    61 	int initialHealth;
    64 	int initialHealth;
    62 	flib_weaponset *weaponset;
    65 	flib_weaponset *weaponset;
    63 } flib_hog;
    66 } flib_hog;
    64 
    67 
    65 typedef struct {
    68 typedef struct {
    66 	flib_hog hogs[HEDGEHOGS_PER_TEAM];
    69 	flib_hog hogs[HEDGEHOGS_PER_TEAM];
    67 	char *name;
    70 	char *name;
    68 	char *grave;
    71 	char *grave;		// e.g. "Bone"; References a .png file in Data/Graphics/Graves
    69 	char *fort;
    72 	char *fort;			// e.g. "Castle"; References a series of files in Data/Forts
    70 	char *voicepack;
    73 	char *voicepack;	// e.g. "Classic"; References a directory in Data/Sounds/voices
    71 	char *flag;
    74 	char *flag;			// e.g. "hedgewars"; References a .png file in Data/Graphics/Flags
    72 
    75 
    73 	flib_binding *bindings;
    76 	flib_binding *bindings;
    74 	int bindingCount;
    77 	int bindingCount;
    75 
    78 
    76 	// Statistics. They are irrelevant for the engine or server,
    79 	// Statistics. They are irrelevant for the engine or server,
    79 	int wins;
    82 	int wins;
    80 	int campaignProgress;
    83 	int campaignProgress;
    81 
    84 
    82 	// Transient settings used in game setup
    85 	// Transient settings used in game setup
    83 	int colorIndex;		// Index into a color table
    86 	int colorIndex;		// Index into a color table
    84 	int hogsInGame;
    87 	int hogsInGame;		// The number of hogs that will actually play
    85 	bool remoteDriven;
    88 	bool remoteDriven;	// true for non-local teams in a network game
    86 	char *ownerName;
    89 	char *ownerName;	// Username of the owner of a team in a network game
    87 } flib_team;
    90 } flib_team;
    88 
    91 
    89 /**
    92 /**
    90  * Free all memory associated with the team
    93  * Free all memory associated with the team
    91  */
    94  */