Random Commander From File

Loads a player with a randomly selected commander from a specified file.

 * This function reads a file ('User/commander/commander.txt') that contains a list of potential commander IDs or names.
 * It selects one randomly to be used as the player's commander. If the file doesn't exist, or no valid commanders are found, a default commander ID (670972) is used.
* Can read the commander name and a multiverseID
* Lines that start with '#' are ignored
This commit is contained in:
Eduardo MG
2024-08-21 22:33:31 -06:00
parent ec2ef1856b
commit 8793f05cea
3 changed files with 183 additions and 2 deletions

View File

@@ -18,6 +18,7 @@ typedef enum
GAME_TYPE_RANDOM3,
GAME_TYPE_RANDOM5,
GAME_TYPE_RANDOMCOMMANDER,
GAME_TYPE_RANDOMCOMMANDERFROMFILE,
GAME_TYPE_HORDE,
GAME_TYPE_SET_LIMITED,
GAME_TYPE_STORY,

View File

@@ -45,6 +45,7 @@ protected:
Player * loadPlayerRandomThree(GameObserver* observer, int isAI);
Player * loadPlayerRandomFive(GameObserver* observer, int isAI);
Player * loadPlayerRandomCommander(GameObserver* observer, int isAI);
Player * loadPlayerRandomCommanderFromFile(GameObserver* observer, int isAI);
Player * loadPlayerHorde(GameObserver* observer, int isAI);
Player * loadRandomSetLimited(GameObserver* observer, int isAI);
Player * initPlayer(GameObserver *observer, int playerId);