21#define XML_START_ID "Start"
26typedef struct ndata_start_s {
64 node = doc->xmlChildrenNode;
66 WARN( _(
"Malformed '%s' file: missing root element '%s'" ),
71 node = node->xmlChildrenNode;
73 WARN( _(
"Malformed '%s' file: does not contain elements" ),
78 xml_onlyNodes( node );
82 if ( xml_isNode( node,
84 xmlNodePtr cur = node->children;
88 xmlr_uint( cur,
"credits",
start_data.credits );
89 xmlr_strd( cur,
"mission",
start_data.mission );
91 xmlr_strd( cur,
"chapter",
start_data.chapter );
94 if ( xml_isNode( cur,
"ship" ) ) {
95 xmlr_attr_strd( cur,
"name",
start_data.shipname );
96 xmlr_attr_strd( cur,
"acquired",
start_data.acquired );
98 }
else if ( xml_isNode( cur,
"system" ) ) {
99 xmlNodePtr tmp = cur->children;
101 xml_onlyNodes( tmp );
107 WARN( _(
"'%s' has unknown system node '%s'." ),
108 START_DATA_PATH, tmp->name );
109 }
while ( xml_nextNode( tmp ) );
112 WARN( _(
"'%s' has unknown player node '%s'." ), START_DATA_PATH,
114 }
while ( xml_nextNode( cur ) );
118 if ( xml_isNode( node,
"date" ) ) {
119 int cycles, periods, seconds;
120 xmlr_attr_int( node,
"scu", cycles );
121 xmlr_attr_int( node,
"stp", periods );
122 xmlr_attr_int( node,
"stu", seconds );
130 xmlr_strd( node,
"spob_lua_default",
start_data.spob_lua_default );
131 xmlr_strd( node,
"dtype_default",
start_data.dtype_default );
132 xmlr_strd( node,
"local_map_default",
start_data.local_map_default );
134 WARN( _(
"'%s' has unknown node '%s'." ), START_DATA_PATH, node->name );
135 }
while ( xml_nextNode( node ) );
141#define MELEMENT( o, s ) \
143 WARN( _( "Module start data missing/invalid '%s' element" ), \
146 MELEMENT(
start_data.credits == 0,
"credits" );
149 MELEMENT(
start_data.acquired == NULL,
"acquired" );
150 MELEMENT(
start_data.system == NULL,
"player system" );
151 MELEMENT(
start_data.chapter == NULL,
"chapter" );
152 MELEMENT( !date_set,
"date" );
Header file with generic functions and naev-specifics.
ntime_t ntime_create(int scu, int stp, int stu)
Creates a time structure.
xmlDocPtr xml_parsePhysFS(const char *filename)
Analogous to xmlParseMemory/xmlParseFile.
static ndata_start_t start_data
const char * start_acquired(void)
Gets the module's starting ship was acquired.
const char * start_event(void)
Gets the starting event of the player.
void start_cleanup(void)
Cleans up after the module start data.
const char * start_local_map_default(void)
Gets the default local map.
int start_load(void)
Loads the module start data.
const char * start_mission(void)
Gets the starting mission of the player.
void start_position(double *x, double *y)
Gets the starting position of the player.
const char * start_chapter(void)
Gets the player's starting chapter.
const char * start_name(void)
Gets the module name.
const char * start_dtype_default(void)
Gets the default damage type.
const char * start_ship(void)
Gets the module player starting ship.
ntime_t start_date(void)
Gets the starting date.
const char * start_spob_lua_default(void)
Gets the default spob Lua file.
const char * start_shipname(void)
Gets the module's starting ship's name.
const char * start_gui(void)
Gets the module's starting ship was acquired.
const char * start_system(void)
Gets the starting system name.
unsigned int start_credits(void)
Gets the player's starting credits.
The start data structure.