mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-10-31 15:20:10 +00:00
(cherry picked from commit 25d1238907
)
This commit is contained in:
parent
5098c77c38
commit
d310a04276
@ -283,14 +283,18 @@
|
||||
{
|
||||
if (!_networking || _network_server) {
|
||||
Company *c = Company::GetIfValid(company);
|
||||
assert(c != nullptr && c->ai_instance != nullptr);
|
||||
assert(c != nullptr);
|
||||
|
||||
Backup<CompanyID> cur_company(_current_company, company, FILE_LINE);
|
||||
c->ai_instance->Save();
|
||||
cur_company.Restore();
|
||||
} else {
|
||||
AIInstance::SaveEmpty();
|
||||
/* When doing emergency saving, an AI can be not fully initialised. */
|
||||
if (c->ai_instance != nullptr) {
|
||||
Backup<CompanyID> cur_company(_current_company, company, FILE_LINE);
|
||||
c->ai_instance->Save();
|
||||
cur_company.Restore();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
AIInstance::SaveEmpty();
|
||||
}
|
||||
|
||||
/* static */ std::string AI::GetConsoleList(bool newest_only)
|
||||
|
Loading…
Reference in New Issue
Block a user