#include <string.h>
#include <tpia_depot.h>
Go to the source code of this file.
Functions | |
tpia_depot * | tpia_depot_create (statusMessageReporting *smr, const char *projectileName) |
int | tpia_depot_initialize (statusMessageReporting *smr, tpia_depot *depot, const char *projectileName) |
tpia_depot * | tpia_depot_free (tpia_depot *depot, int freeMap) |
int | tpia_depot_release (tpia_depot *depot, int freeMap) |
int | tpia_depot_setMap (statusMessageReporting *, tpia_depot *depot, tpia_map *map) |
int | tpia_depot_setMapFromFilename (statusMessageReporting *smr, tpia_depot *depot, const char *basePath, const char *mapFileName) |
tpia_map * | tpia_depot_releaseMap (tpia_depot *depot) |
int | tpia_depot_freeMap (tpia_depot *depot) |
tpia_targetEntry * | tpia_depot_getFirstTargetEntry (tpia_depot *depot) |
tpia_targetEntry * | tpia_depot_getNextTargetEntry (tpia_targetEntry *targetEntry) |
tpia_target * | tpia_depot_addTarget (statusMessageReporting *smr, tpia_depot *depot, const char *evaluation, const char *targetName) |
tpia_target * | tpia_depot_addTargetFromMap (statusMessageReporting *smr, tpia_depot *depot, tpia_map *map, const char *evaluation, const char *targetName) |
tpia_target* tpia_depot_addTarget | ( | statusMessageReporting * | smr, | |
tpia_depot * | depot, | |||
const char * | evaluation, | |||
const char * | targetName | |||
) |
Definition at line 153 of file tpia_depot.cc.
References tpia_depot_addTargetFromMap().
00153 { 00154 00155 return( tpia_depot_addTargetFromMap( smr, depot, depot->map, evaluation, targetName ) ); 00156 }
tpia_target* tpia_depot_addTargetFromMap | ( | statusMessageReporting * | smr, | |
tpia_depot * | depot, | |||
tpia_map * | map, | |||
const char * | evaluation, | |||
const char * | targetName | |||
) |
Definition at line 160 of file tpia_depot.cc.
References smr_setMessageError(), tpia_depot_getFirstTargetEntry(), tpia_depot_getNextTargetEntry(), and tpia_target_createReadFromMap().
Referenced by tpia_depot_addTarget().
00160 { 00161 00162 tpia_targetEntry *targetEntry; 00163 tpia_target *target; 00164 00165 for( targetEntry = tpia_depot_getFirstTargetEntry( depot ); targetEntry != NULL; targetEntry = tpia_depot_getNextTargetEntry( targetEntry ) ) { 00166 if( !strcmp( targetEntry->target->targetID->name, targetName ) ) { 00167 smr_setMessageError( smr, NULL, __FILE__, __LINE__, 1, "depot already contains target = %s ", targetName ); 00168 return( NULL ); 00169 } 00170 } 00171 target = tpia_target_createReadFromMap( smr, map, evaluation, depot->projectileName, targetName ); 00172 return( target ); 00173 }
tpia_depot* tpia_depot_create | ( | statusMessageReporting * | smr, | |
const char * | projectileName | |||
) |
Definition at line 47 of file tpia_depot.cc.
References tpia_depot_free(), and tpia_depot_initialize().
00047 { 00048 00049 tpia_depot *depot; 00050 00051 //if( ( depot = xData_malloc2( smr, sizeof( tpia_depot ), 0, "map" ) ) == NULL ) return( NULL ); 00052 if( ( depot = (tpia_depot*) xData_malloc2( smr, sizeof( tpia_depot ), 0, "map" ) ) == NULL ) return( NULL ); 00053 if( tpia_depot_initialize( smr, depot, projectileName ) ) depot = tpia_depot_free( depot, 0 ); 00054 return( depot ); 00055 }
tpia_depot* tpia_depot_free | ( | tpia_depot * | depot, | |
int | freeMap | |||
) |
Definition at line 74 of file tpia_depot.cc.
References tpia_depot_release(), and xData_free().
Referenced by tpia_depot_create().
00074 { 00075 00076 tpia_depot_release( depot, freeMap ); 00077 xData_free( NULL, depot ); 00078 return( NULL ); 00079 }
int tpia_depot_freeMap | ( | tpia_depot * | depot | ) |
Definition at line 129 of file tpia_depot.cc.
References tpia_depot_releaseMap(), and tpia_map_free().
00129 { 00130 00131 tpia_map *map = tpia_depot_releaseMap( depot ); 00132 00133 if( map != NULL ) tpia_map_free( NULL, map ); 00134 return( 0 ); 00135 }
tpia_targetEntry* tpia_depot_getFirstTargetEntry | ( | tpia_depot * | depot | ) |
tpia_targetEntry* tpia_depot_getNextTargetEntry | ( | tpia_targetEntry * | targetEntry | ) |
int tpia_depot_initialize | ( | statusMessageReporting * | smr, | |
tpia_depot * | depot, | |||
const char * | projectileName | |||
) |
Definition at line 59 of file tpia_depot.cc.
Referenced by tpia_depot_create().
00059 { 00060 00061 memset( depot, 0, sizeof( tpia_depot ) ); 00062 depot->status = 0; 00063 depot->projectileName = NULL; 00064 depot->numberOfTargets = 0; 00065 depot->targets = NULL; 00066 depot->map = NULL; 00067 //if( ( depot->projectileName = xData_malloc2( smr, strlen( projectileName ) + 1, 0, "projectile" ) ) == NULL ) return( 1 ); 00068 if( ( depot->projectileName = (char*) xData_malloc2( smr, strlen( projectileName ) + 1, 0, "projectile" ) ) == NULL ) return( 1 ); 00069 return( 0 ); 00070 }
int tpia_depot_release | ( | tpia_depot * | depot, | |
int | freeMap | |||
) |
Definition at line 83 of file tpia_depot.cc.
References tpia_map_free(), tpia_target_free(), and xData_free().
Referenced by tpia_depot_free().
00083 { 00084 00085 tpia_targetEntry *next, *targetEntry; 00086 00087 if( depot->projectileName != NULL ) xData_free( NULL, depot->projectileName ); 00088 for( targetEntry = depot->targets; targetEntry != NULL; targetEntry = next ) { 00089 next = targetEntry->next; 00090 tpia_target_free( NULL, targetEntry->target ); 00091 xData_free( NULL, targetEntry ); 00092 } 00093 depot->numberOfTargets = 0; 00094 depot->targets = NULL; 00095 //if( freeMap && ( depot->map != NULL ) ) depot->map = tpia_map_free( NULL, depot->map ); 00096 if( freeMap && ( depot->map != NULL ) ) depot->map = (tpia_map*) tpia_map_free( NULL, depot->map ); 00097 return( depot->status = 0 ); 00098 }
tpia_map* tpia_depot_releaseMap | ( | tpia_depot * | depot | ) |
Definition at line 119 of file tpia_depot.cc.
Referenced by tpia_depot_freeMap().
00119 { 00120 00121 tpia_map *map = depot->map; 00122 00123 depot->map = NULL; 00124 return( map ); 00125 }
int tpia_depot_setMap | ( | statusMessageReporting * | , | |
tpia_depot * | depot, | |||
tpia_map * | map | |||
) |
int tpia_depot_setMapFromFilename | ( | statusMessageReporting * | smr, | |
tpia_depot * | depot, | |||
const char * | basePath, | |||
const char * | mapFileName | |||
) |
Definition at line 111 of file tpia_depot.cc.
References tpia_map_readFile().
00111 { 00112 00113 if( ( depot->map = tpia_map_readFile( smr, basePath, mapFileName ) ) == NULL ) return( 1 ); 00114 return( 0 ); 00115 }