Changeset - r26967:ae6c19bd8920
[Not reviewed]
master
0 2 0
glx22 - 17 months ago 2023-02-10 16:37:18
glx@openttd.org
Codechange: Use SQInteger for generic numbers in script_companymode
2 files changed with 3 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/script/api/script_companymode.cpp
Show inline comments
 
@@ -4,25 +4,25 @@
 
 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
 
 */
 

	
 
/** @file script_companymode.cpp Implementation of ScriptCompanyMode. */
 

	
 
#include "../../stdafx.h"
 
#include "../../company_base.h"
 
#include "script_companymode.hpp"
 

	
 
#include "../../safeguards.h"
 

	
 
ScriptCompanyMode::ScriptCompanyMode(int company)
 
ScriptCompanyMode::ScriptCompanyMode(SQInteger 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);
 
	ScriptObject::SetCompany((::CompanyID)company);
 
}
 

	
 
ScriptCompanyMode::~ScriptCompanyMode()
 
{
 
	ScriptObject::SetCompany(this->last_company);
 
}
src/script/api/script_companymode.hpp
Show inline comments
 
@@ -31,22 +31,22 @@
 
class ScriptCompanyMode : public ScriptObject {
 
private:
 
	CompanyID last_company; ///< The previous company we were in.
 

	
 
public:
 
	/**
 
	 * Creating instance of this class switches the company used for queries
 
	 *  and commands.
 
	 * @param company The new company to switch to.
 
	 * @note When the instance is destroyed, it restores the company that was
 
	 *   current when the instance was created!
 
	 */
 
	ScriptCompanyMode(int company);
 
	ScriptCompanyMode(SQInteger company);
 

	
 
	/**
 
	 * Destroying this instance reset the company to that what it was
 
	 *   in when the instance was created.
 
	 */
 
	~ScriptCompanyMode();
 
};
 

	
 
#endif /* SCRIPT_COMPANYMODE_HPP */
0 comments (0 inline, 0 general)