[Fix] Fixed new player inheriting last loaded players faction standings.
This commit is contained in:
parent
313e3a7488
commit
da3cb1dff7
@ -43,6 +43,7 @@ typedef struct Faction_ {
|
|||||||
int* allies; /**< Allies by ID of the faction. */
|
int* allies; /**< Allies by ID of the faction. */
|
||||||
int nallies; /**< Number of allies. */
|
int nallies; /**< Number of allies. */
|
||||||
|
|
||||||
|
int player_def; /**< Default player standing. */
|
||||||
int player; /**< Standing with player - from -100 to 100. */
|
int player; /**< Standing with player - from -100 to 100. */
|
||||||
} Faction;
|
} Faction;
|
||||||
|
|
||||||
@ -438,7 +439,7 @@ static Faction* faction_parse(xmlNodePtr parent) {
|
|||||||
do {
|
do {
|
||||||
/* Can be 0 or negative, so we have to take that into account. */
|
/* Can be 0 or negative, so we have to take that into account. */
|
||||||
if(xml_isNode(node, "player")) {
|
if(xml_isNode(node, "player")) {
|
||||||
tmp->player = xml_getInt(node);
|
tmp->player_def = xml_getInt(node);
|
||||||
player = 1;
|
player = 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -497,6 +498,17 @@ static void faction_parseSocial(xmlNodePtr parent) {
|
|||||||
} while(xml_nextNode(node));
|
} while(xml_nextNode(node));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn void factions_reset(void)
|
||||||
|
*
|
||||||
|
* @brief Reset the players standing with the factions to default.
|
||||||
|
*/
|
||||||
|
void factions_reset(void) {
|
||||||
|
int i;
|
||||||
|
for(i = 0; i < faction_nstack; i++)
|
||||||
|
faction_stack[i].player = faction_stack[i].player_def;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @fn int factions_load(void)
|
* @fn int factions_load(void)
|
||||||
*
|
*
|
||||||
|
@ -24,4 +24,5 @@ int areAllies(int a, int b);
|
|||||||
/* Load/Free. */
|
/* Load/Free. */
|
||||||
int factions_load(void);
|
int factions_load(void);
|
||||||
void factions_free(void);
|
void factions_free(void);
|
||||||
|
void factions_reset(void);
|
||||||
|
|
||||||
|
@ -1305,7 +1305,9 @@ void takeoff(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @fn
|
* @fn void land_cleanup(void)
|
||||||
|
*
|
||||||
|
* @brief Cleans up some land-related variables.
|
||||||
*/
|
*/
|
||||||
void land_cleanup(void) {
|
void land_cleanup(void) {
|
||||||
/* Clean up default stuff. */
|
/* Clean up default stuff. */
|
||||||
|
@ -243,6 +243,7 @@ void player_new(void) {
|
|||||||
space_clearKnown();
|
space_clearKnown();
|
||||||
land_cleanup();
|
land_cleanup();
|
||||||
diff_clear();
|
diff_clear();
|
||||||
|
factions_reset();
|
||||||
|
|
||||||
player_name = dialogue_input("Player Name", 3, 20,
|
player_name = dialogue_input("Player Name", 3, 20,
|
||||||
"Please tell me your name:");
|
"Please tell me your name:");
|
||||||
|
Loading…
Reference in New Issue
Block a user