Skip to content

Commit

Permalink
Fallback all unknown AI types to "classic"
Browse files Browse the repository at this point in the history
"classic" is the only AI available in fc21 anyway. It's better to load the
game slightly wrong than to fail to load it because of an unsupported AI type.
See #746.
  • Loading branch information
lmoureaux committed Nov 28, 2021
1 parent 0928bed commit 4f35a8b
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions common/ai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,10 @@ 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");
if (fb != nullptr) {
// Get pointer to persistent name of the ai_type
return ai_name(fb);
}

return NULL;
Expand Down

0 comments on commit 4f35a8b

Please sign in to comment.