project_files/frontlib/model/team.h
changeset 7271 5608ac657362
parent 7269 5b0aeef8ba2a
child 7275 15f722e0b96f
equal deleted inserted replaced
7269:5b0aeef8ba2a 7271:5608ac657362
    42 	int initialHealth;
    42 	int initialHealth;
    43 	flib_weaponset *weaponset;
    43 	flib_weaponset *weaponset;
    44 } flib_hog;
    44 } flib_hog;
    45 
    45 
    46 typedef struct {
    46 typedef struct {
       
    47 	int _referenceCount;
    47 	flib_hog hogs[HEDGEHOGS_PER_TEAM];
    48 	flib_hog hogs[HEDGEHOGS_PER_TEAM];
    48 	char *name;
    49 	char *name;
    49 	char *grave;
    50 	char *grave;
    50 	char *fort;
    51 	char *fort;
    51 	char *voicepack;
    52 	char *voicepack;
    62 
    63 
    63 	// Transient settings used in game setup
    64 	// Transient settings used in game setup
    64 	uint32_t color;
    65 	uint32_t color;
    65 	int hogsInGame;
    66 	int hogsInGame;
    66 	bool remoteDriven;
    67 	bool remoteDriven;
    67 	char *hash; // TODO calculate at the appropriate time... i.e. before trying to send the config to the engine
    68 	char *ownerName;
    68 } flib_team;
    69 } flib_team;
    69 
    70 
    70 /**
    71 /**
    71  * Returns a new team, or NULL on error. name must not be NULL.
    72  * Returns a new team, or NULL on error. name must not be NULL.
    72  *
    73  *
    94 /**
    95 /**
    95  * Set the same weaponset for every hog in the team
    96  * Set the same weaponset for every hog in the team
    96  */
    97  */
    97 void flib_team_set_weaponset(flib_team *team, flib_weaponset *set);
    98 void flib_team_set_weaponset(flib_team *team, flib_weaponset *set);
    98 
    99 
    99 void flib_team_destroy(flib_team *team);
   100 /**
       
   101  * Increase the reference count of the object. Call this if you store a pointer to it somewhere.
       
   102  * Returns the parameter.
       
   103  */
       
   104 flib_team *flib_team_retain(flib_team *team);
       
   105 
       
   106 /**
       
   107  * Decrease the reference count of the object and free it if this was the last reference.
       
   108  */
       
   109 void flib_team_release(flib_team *team);
       
   110 
       
   111 /**
       
   112  * Create a deep copy of a team. Returns NULL on failure.
       
   113  * The referenced weaponsets are not copied, so the new
       
   114  * team references the same weaponsets.
       
   115  */
       
   116 flib_team *flib_team_copy(flib_team *team);
   100 
   117 
   101 #endif /* TEAM_H_ */
   118 #endif /* TEAM_H_ */