Codechange: [Script] Use helper function over direct casting CompanyID
In the script's API `COMPANY_INVALID` has a value of -1, whereas the internal game's `INVALID_COMPANY` has a value of 255. Since the script's API also has a `COMPANY_SPECTATOR` with a value of 255, these enumerations cannot be easily reconciled by casting. As such, replace all casts in the script API with either ScriptCompany::FromScriptCompanyID or ScriptCompany::ToScriptCompanyID. Also make clear whether CompanyID is ::CompanyID or ScriptCompany::CompanyID by using either one of those over CompanyID in the script's API.
This commit is contained in:
@@ -70,7 +70,7 @@ public:
|
||||
* Create a new league table element.
|
||||
* @param table Id of the league table this element belongs to.
|
||||
* @param rating Value that elements are ordered by.
|
||||
* @param company Company to show the color blob for or INVALID_COMPANY.
|
||||
* @param company Company to show the color blob for or COMPANY_INVALID.
|
||||
* @param text Text of the element (can be either a raw string, or ScriptText object).
|
||||
* @param score String representation of the score associated with the element (can be either a raw string, or ScriptText object).
|
||||
* @param link_type Type of the referenced object.
|
||||
@@ -87,7 +87,7 @@ public:
|
||||
/**
|
||||
* Update the attributes of a league table element.
|
||||
* @param element Id of the element to update
|
||||
* @param company Company to show the color blob for or INVALID_COMPANY.
|
||||
* @param company Company to show the color blob for or COMPANY_INVALID.
|
||||
* @param text Text of the element (can be either a raw string, or ScriptText object).
|
||||
* @param link_type Type of the referenced object.
|
||||
* @param link_target Id of the referenced object.
|
||||
|
||||
Reference in New Issue
Block a user