Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix loading WWI scenario #748

Merged
merged 4 commits into from
Nov 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions common/ai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,11 @@ const char *ai_type_name_or_fallback(const char *orig_name)
return orig_name;
}

if (!strcmp("threaded", orig_name)) {
struct ai_type *fb;

fb = ai_type_by_name("classic");

if (fb != NULL) {
// Get pointer to persistent name of the ai_type
return ai_name(fb);
}
auto fb = ai_type_by_name("classic");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

log a warning when doing this.

if (fb != nullptr) {
qWarning(_("Unknown AI type %s, using \"classic\" instead"), orig_name);
// Get pointer to persistent name of the ai_type
return ai_name(fb);
}

return NULL;
Expand Down
2 changes: 1 addition & 1 deletion common/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ static void game_defaults(bool keep_ruleset_value)
game.scenario.have_resources = true;
game.scenario.ruleset_locked = true;
game.scenario.save_random = false;
game.scenario.allow_ai_type_fallback = false;
game.scenario.allow_ai_type_fallback = true;

game.scenario_desc.description[0] = '\0';

Expand Down
56 changes: 28 additions & 28 deletions data/scenarios/europe_1900_WWI.sav
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ random_seed=1586958551
global_advances="1011111111111101101111111101110000111110011111111110011110011011110110011001101111111111"
last_turn_change_time=0
save_players=TRUE
ai_types="classic","tex"
ai_types="classic"
save_known=TRUE

[random]
Expand Down Expand Up @@ -2373,7 +2373,7 @@ shuffled_player_26=26

[player0]
flags="ai"
ai_type="tex"
ai_type="classic"
name="Vittorio-Emanuele III"
username="Unassigned"
unassigned_user=TRUE
Expand Down Expand Up @@ -4459,7 +4459,7 @@ total=263

[player1]
flags="ai"
ai_type="tex"
ai_type="classic"
name="Wilhelm II"
username="Unassigned"
unassigned_user=TRUE
Expand Down Expand Up @@ -6624,7 +6624,7 @@ total=352

[player2]
flags="ai"
ai_type="tex"
ai_type="classic"
name="George V"
username="Unassigned"
unassigned_user=TRUE
Expand Down Expand Up @@ -8791,7 +8791,7 @@ total=372

[player3]
flags="ai"
ai_type="tex"
ai_type="classic"
name="Émile Loubet"
username="Unassigned"
unassigned_user=TRUE
Expand Down Expand Up @@ -10900,7 +10900,7 @@ total=281

[player4]
flags="ai"
ai_type="tex"
ai_type="classic"
name="Nicholas II"
username="Unassigned"
unassigned_user=TRUE
Expand Down Expand Up @@ -13060,7 +13060,7 @@ total=368

[player5]
flags="ai"
ai_type="tex"
ai_type="classic"
name="Mehmed V"
username="Unassigned"
unassigned_user=TRUE
Expand Down Expand Up @@ -15128,7 +15128,7 @@ total=229

[player6]
flags="ai"
ai_type="tex"
ai_type="classic"
name="Franz Joseph I"
username="Unassigned"
unassigned_user=TRUE
Expand Down Expand Up @@ -17203,7 +17203,7 @@ total=240

[player7]
flags="ai"
ai_type="tex"
ai_type="classic"
name="Alfonso XIII"
username="Unassigned"
unassigned_user=TRUE
Expand Down Expand Up @@ -19262,7 +19262,7 @@ total=219

[player8]
flags="ai"
ai_type="tex"
ai_type="classic"
name="George I"
username="Unassigned"
unassigned_user=TRUE
Expand Down Expand Up @@ -21273,7 +21273,7 @@ total=142

[player9]
flags="ai"
ai_type="tex"
ai_type="classic"
name="Oscar II"
username="Unassigned"
unassigned_user=TRUE
Expand Down Expand Up @@ -23309,7 +23309,7 @@ total=170

[player10]
flags="ai"
ai_type="tex"
ai_type="classic"
name="Wilhelmina"
username="Unassigned"
unassigned_user=TRUE
Expand Down Expand Up @@ -25334,7 +25334,7 @@ total=161

[player11]
flags="ai"
ai_type="tex"
ai_type="classic"
name="Walter Hauser"
username="Unassigned"
unassigned_user=TRUE
Expand Down Expand Up @@ -27343,7 +27343,7 @@ total=151

[player12]
flags="ai"
ai_type="tex"
ai_type="classic"
name="Christian IX"
username="Unassigned"
unassigned_user=TRUE
Expand Down Expand Up @@ -29359,7 +29359,7 @@ total=154

[player13]
flags="ai"
ai_type="tex"
ai_type="classic"
name="Muzaffar ad-Din Schah"
username="Unassigned"
unassigned_user=TRUE
Expand Down Expand Up @@ -31383,7 +31383,7 @@ total=163

[player14]
flags="ai"
ai_type="tex"
ai_type="classic"
name="Ferdinand I"
username="Unassigned"
unassigned_user=TRUE
Expand Down Expand Up @@ -33396,7 +33396,7 @@ total=142

[player15]
flags="ai"
ai_type="tex"
ai_type="classic"
name="Karl I."
username="Unassigned"
unassigned_user=TRUE
Expand Down Expand Up @@ -35414,7 +35414,7 @@ total=155

[player16]
flags="ai"
ai_type="tex"
ai_type="classic"
name="Alexander I."
username="Unassigned"
unassigned_user=TRUE
Expand Down Expand Up @@ -37424,7 +37424,7 @@ total=140

[player17]
flags="ai"
ai_type="tex"
ai_type="classic"
name="Abd al-Aziz"
username="Unassigned"
unassigned_user=TRUE
Expand Down Expand Up @@ -39434,7 +39434,7 @@ total=148

[player18]
flags="ai"
ai_type="tex"
ai_type="classic"
name="Carlos I."
username="Unassigned"
unassigned_user=TRUE
Expand Down Expand Up @@ -41452,7 +41452,7 @@ total=163

[player19]
flags="ai"
ai_type="tex"
ai_type="classic"
name="Leopold II"
username="Unassigned"
unassigned_user=TRUE
Expand Down Expand Up @@ -43472,7 +43472,7 @@ total=161

[player20]
flags="ai"
ai_type="tex"
ai_type="classic"
name="William McKinley"
username="Unassigned"
unassigned_user=TRUE
Expand Down Expand Up @@ -45540,7 +45540,7 @@ total=206

[player21]
flags="ai"
ai_type="tex"
ai_type="classic"
name="Adolphe"
username="Unassigned"
unassigned_user=TRUE
Expand Down Expand Up @@ -47537,7 +47537,7 @@ total=133

[player22]
flags="ai"
ai_type="tex"
ai_type="classic"
name="Salvador Casanas i Pages and Emile Loubet"
username="Unassigned"
unassigned_user=TRUE
Expand Down Expand Up @@ -49530,7 +49530,7 @@ total=131

[player23]
flags="ai"
ai_type="tex"
ai_type="classic"
name="Albert I"
username="Unassigned"
unassigned_user=TRUE
Expand Down Expand Up @@ -51526,7 +51526,7 @@ total=131

[player24]
flags="ai"
ai_type="tex"
ai_type="classic"
name="Domenico Fattori and Antonio Righi"
username="Unassigned"
unassigned_user=TRUE
Expand Down Expand Up @@ -53522,7 +53522,7 @@ total=131

[player25]
flags="ai"
ai_type="tex"
ai_type="classic"
name="Nikola I Petrovic-Njegos"
username="Unassigned"
unassigned_user=TRUE
Expand Down Expand Up @@ -55527,7 +55527,7 @@ total=137

[player26]
flags="ai"
ai_type="tex"
ai_type="classic"
name="Johann II"
username="Unassigned"
unassigned_user=TRUE
Expand Down