Too complicated, Sinister. My solution just adds a second condition to the if statement.
Dragon spawnDragon() {
if (last_chance_Dragon == true)
{
Message("No more spawning!");
return (NO_DRAGON);
}
if ((map_population == 0) && (player_recruits < dragon_spawn_cost))
{
last_chance_Dragon = true;
}
}
Right now it just seems to check if the population is 0, but not if the player's recruits are under 20. (They may not be able to produce enough to get them down to 0)
This actually
interferes with an active player, instead of being a "one last shot" thing that is INTENDED to help resolve stalemates. I got caught in this in my first RTS battle in the campaign, as I started the battle with even odds, and by the time I was in a position to crush the enemy, the population was 0. Even though I still had 600 recruits in the bank and was ready to go, the game wouldn't let me spawn in after using my free spawn.
Since it seems to be a flag, there's no need to worry about the "what if the player sells buildings after getting their free spawn to get them over the limit" condition you were worried about, because they still won't be able to spawn again.