[Change] Cleaned up XML loading somewhat.
This commit is contained in:
parent
4f6c5fb93f
commit
10ea68c5c3
@ -221,6 +221,10 @@ static int mission_meetReq(int mission, int faction, char* planet, char* sysname
|
|||||||
!mission_meetCond(misn))
|
!mission_meetCond(misn))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
if((misn->avail.done != NULL) && /* Mission does not meet previous mission requirements. */
|
||||||
|
(player_missionAlreadyDone(mission_getID(misn->avail.done))==0))
|
||||||
|
return 0;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -424,22 +428,22 @@ static MissionData* mission_parse(const xmlNodePtr parent) {
|
|||||||
else if(xml_isNode(node, "avail")) { /* Mission availability. */
|
else if(xml_isNode(node, "avail")) { /* Mission availability. */
|
||||||
cur = node->children;
|
cur = node->children;
|
||||||
do {
|
do {
|
||||||
if(xml_isNode(cur, "location"))
|
if(xml_isNode(cur, "location")) {
|
||||||
tmp->avail.loc = mission_location(xml_get(cur));
|
tmp->avail.loc = mission_location(xml_get(cur));
|
||||||
else if(xml_isNode(cur, "chance"))
|
continue;
|
||||||
tmp->avail.chance = xml_getInt(cur);
|
}
|
||||||
else if(xml_isNode(cur, "planet"))
|
xmlr_int(cur, "chance", tmp->avail.chance);
|
||||||
tmp->avail.planet = strdup(xml_get(cur));
|
xmlr_strd(cur, "planet", tmp->avail.planet);
|
||||||
else if(xml_isNode(cur, "system"))
|
xmlr_strd(cur, "system", tmp->avail.system);
|
||||||
tmp->avail.system = strdup(xml_get(cur));
|
if(xml_isNode(cur, "faction")) {
|
||||||
else if(xml_isNode(cur, "faction")) {
|
|
||||||
tmp->avail.factions = realloc(tmp->avail.factions,
|
tmp->avail.factions = realloc(tmp->avail.factions,
|
||||||
sizeof(int) * ++tmp->avail.nfactions);
|
sizeof(int) * ++tmp->avail.nfactions);
|
||||||
tmp->avail.factions[tmp->avail.nfactions-1] =
|
tmp->avail.factions[tmp->avail.nfactions-1] =
|
||||||
faction_get(xml_get(cur));
|
faction_get(xml_get(cur));
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
else if(xml_isNode(cur, "cond"))
|
xmlr_strd(cur, "cond", tmp->avail.cond);
|
||||||
tmp->avail.cond = strdup(xml_get(cur));
|
xmlr_strd(cur, "done", tmp->avail.done);
|
||||||
} while(xml_nextNode(cur));
|
} while(xml_nextNode(cur));
|
||||||
}
|
}
|
||||||
} while(xml_nextNode(node));
|
} while(xml_nextNode(node));
|
||||||
|
@ -34,6 +34,7 @@ typedef struct MissionData_ {
|
|||||||
int nfactions;
|
int nfactions;
|
||||||
|
|
||||||
char* cond; /* Conditional that must be met. */
|
char* cond; /* Conditional that must be met. */
|
||||||
|
char* done; /* Previous mission that must have been done. */
|
||||||
} avail;
|
} avail;
|
||||||
|
|
||||||
unsigned int flags; /* Flags to store binary properties. */
|
unsigned int flags; /* Flags to store binary properties. */
|
||||||
|
Loading…
Reference in New Issue
Block a user