mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-02-11 16:54:42 +00:00
Fix #6966: Only allow switching to a valid company.
This commit is contained in:
parent
d8f6c80696
commit
4a255e879a
@ -10,6 +10,7 @@
|
||||
/** @file script_companymode.cpp Implementation of ScriptCompanyMode. */
|
||||
|
||||
#include "../../stdafx.h"
|
||||
#include "../../company_base.h"
|
||||
#include "script_companymode.hpp"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
@ -17,6 +18,7 @@
|
||||
ScriptCompanyMode::ScriptCompanyMode(int company)
|
||||
{
|
||||
if (company < OWNER_BEGIN || company >= MAX_COMPANIES) company = INVALID_COMPANY;
|
||||
if (!::Company::IsValidID(company)) company = INVALID_COMPANY;
|
||||
|
||||
this->last_company = ScriptObject::GetCompany();
|
||||
ScriptObject::SetCompany((CompanyID)company);
|
||||
|
Loading…
Reference in New Issue
Block a user