project_files/frontlib/model/team.c
changeset 7230 240620f46dd7
parent 7227 1c859f572d72
child 7271 5608ac657362
equal deleted inserted replaced
7227:1c859f572d72 7230:240620f46dd7
   192 void flib_team_destroy(flib_team *team) {
   192 void flib_team_destroy(flib_team *team) {
   193 	if(team) {
   193 	if(team) {
   194 		for(int i=0; i<HEDGEHOGS_PER_TEAM; i++) {
   194 		for(int i=0; i<HEDGEHOGS_PER_TEAM; i++) {
   195 			free(team->hogs[i].name);
   195 			free(team->hogs[i].name);
   196 			free(team->hogs[i].hat);
   196 			free(team->hogs[i].hat);
       
   197 			flib_weaponset_release(team->hogs[i].weaponset);
   197 		}
   198 		}
   198 		free(team->name);
   199 		free(team->name);
   199 		free(team->grave);
   200 		free(team->grave);
   200 		free(team->fort);
   201 		free(team->fort);
   201 		free(team->voicepack);
   202 		free(team->voicepack);
   206 				free(team->bindings[i].binding);
   207 				free(team->bindings[i].binding);
   207 			}
   208 			}
   208 		}
   209 		}
   209 		free(team->bindings);
   210 		free(team->bindings);
   210 		free(team->hash);
   211 		free(team->hash);
   211 		flib_weaponset_destroy(team->weaponset);
       
   212 		free(team);
   212 		free(team);
   213 	}
   213 	}
   214 }
   214 }
       
   215 
       
   216 void flib_team_set_weaponset(flib_team *team, flib_weaponset *set) {
       
   217 	if(team) {
       
   218 		for(int i=0; i<HEDGEHOGS_PER_TEAM; i++) {
       
   219 			flib_weaponset_release(team->hogs[i].weaponset);
       
   220 			team->hogs[i].weaponset = flib_weaponset_retain(set);
       
   221 		}
       
   222 	}
       
   223 }