mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-09 15:41:15 +00:00
Fix: scripts are not aware of nullptr, they only know null
This commit is contained in:
parent
f9a473bef7
commit
2fd99467ea
@ -50,7 +50,7 @@ public:
|
||||
* @param station_id The basestation to set the name of.
|
||||
* @param name The new name of the station (can be either a raw string, or a ScriptText object).
|
||||
* @pre IsValidBaseStation(station_id).
|
||||
* @pre name != nullptr && len(name) != 0.
|
||||
* @pre name != null && len(name) != 0.
|
||||
* @game @pre Valid ScriptCompanyMode active in scope.
|
||||
* @exception ScriptError::ERR_NAME_IS_NOT_UNIQUE
|
||||
* @return True if the name was changed.
|
||||
|
@ -137,7 +137,7 @@ public:
|
||||
/**
|
||||
* Set the name of your company.
|
||||
* @param name The new name of the company (can be either a raw string, or a ScriptText object).
|
||||
* @pre name != nullptr && len(name) != 0.
|
||||
* @pre name != null && len(name) != 0.
|
||||
* @exception ScriptError::ERR_NAME_IS_NOT_UNIQUE
|
||||
* @return True if the name was changed.
|
||||
*/
|
||||
@ -154,7 +154,7 @@ public:
|
||||
/**
|
||||
* Set the name of your president.
|
||||
* @param name The new name of the president (can be either a raw string, or a ScriptText object).
|
||||
* @pre name != nullptr && len(name) != 0.
|
||||
* @pre name != null && len(name) != 0.
|
||||
* @exception ScriptError::ERR_NAME_IS_NOT_UNIQUE
|
||||
* @return True if the name was changed.
|
||||
*/
|
||||
|
@ -97,7 +97,7 @@ public:
|
||||
* @param destination The destination of the \a type type.
|
||||
* @return The new GoalID, or GOAL_INVALID if it failed.
|
||||
* @pre No ScriptCompanyMode may be in scope.
|
||||
* @pre goal != nullptr && len(goal) != 0.
|
||||
* @pre goal != null && len(goal) != 0.
|
||||
* @pre company == COMPANY_INVALID || ResolveCompanyID(company) != COMPANY_INVALID.
|
||||
* @pre if type is GT_STORY_PAGE, the company of the goal and the company of the story page need to match:
|
||||
* \li Global goals can only reference global story pages.
|
||||
@ -120,7 +120,7 @@ public:
|
||||
* @param goal The new goal text (can be either a raw string, or a ScriptText object).
|
||||
* @return True if the action succeeded.
|
||||
* @pre No ScriptCompanyMode may be in scope.
|
||||
* @pre goal != nullptr && len(goal) != 0.
|
||||
* @pre goal != null && len(goal) != 0.
|
||||
* @pre IsValidGoal(goal_id).
|
||||
*/
|
||||
static bool SetText(GoalID goal_id, Text *goal);
|
||||
@ -131,7 +131,7 @@ public:
|
||||
* the progress string short.
|
||||
* @param goal_id The goal to update.
|
||||
* @param progress The new progress text for the goal (can be either a raw string,
|
||||
* or a ScriptText object). To clear the progress string you can pass nullptr or an
|
||||
* or a ScriptText object). To clear the progress string you can pass null or an
|
||||
* empty string.
|
||||
* @return True if the action succeeded.
|
||||
* @pre No ScriptCompanyMode may be in scope.
|
||||
@ -167,7 +167,7 @@ public:
|
||||
* @param buttons Any combinations (at least 1, up to 3) of buttons defined in QuestionButton. Like BUTTON_YES + BUTTON_NO.
|
||||
* @return True if the action succeeded.
|
||||
* @pre No ScriptCompanyMode may be in scope.
|
||||
* @pre question != nullptr && len(question) != 0.
|
||||
* @pre question != null && len(question) != 0.
|
||||
* @pre company == COMPANY_INVALID || ResolveCompanyID(company) != COMPANY_INVALID.
|
||||
* @pre CountBits(buttons) >= 1 && CountBits(buttons) <= 3.
|
||||
* @note Replies to the question are given by you via the event ScriptEvent_GoalQuestionAnswer.
|
||||
@ -185,7 +185,7 @@ public:
|
||||
* @return True if the action succeeded.
|
||||
* @pre No ScriptCompanyMode may be in scope.
|
||||
* @pre ScriptGame::IsMultiplayer()
|
||||
* @pre question != nullptr && len(question) != 0.
|
||||
* @pre question != null && len(question) != 0.
|
||||
* @pre ResolveClientID(client) != CLIENT_INVALID.
|
||||
* @pre CountBits(buttons) >= 1 && CountBits(buttons) <= 3.
|
||||
* @note Replies to the question are given by you via the event ScriptEvent_GoalQuestionAnswer.
|
||||
|
@ -69,7 +69,7 @@ public:
|
||||
* @param group_id The group to set the name for.
|
||||
* @param name The name for the group (can be either a raw string, or a ScriptText object).
|
||||
* @pre IsValidGroup(group_id).
|
||||
* @pre name != nullptr && len(name) != 0
|
||||
* @pre name != null && len(name) != 0
|
||||
* @exception ScriptError::ERR_NAME_IS_NOT_UNIQUE
|
||||
* @return True if and only if the name was changed.
|
||||
*/
|
||||
|
@ -72,7 +72,7 @@ public:
|
||||
* @param footer The optional footer text for the table (null is allowed).
|
||||
* @return The new LeagueTableID, or LEAGUE_TABLE_INVALID if it failed.
|
||||
* @pre No ScriptCompanyMode may be in scope.
|
||||
* @pre title != nullptr && len(title) != 0.
|
||||
* @pre title != null && len(title) != 0.
|
||||
*/
|
||||
static LeagueTableID New(Text *title, Text *header, Text *footer);
|
||||
|
||||
@ -88,8 +88,8 @@ public:
|
||||
* @return The new LeagueTableElementID, or LEAGUE_TABLE_ELEMENT_INVALID if it failed.
|
||||
* @pre No ScriptCompanyMode may be in scope.
|
||||
* @pre IsValidLeagueTable(table).
|
||||
* @pre text != nullptr && len(text) != 0.
|
||||
* @pre score != nullptr && len(score) != 0.
|
||||
* @pre text != null && len(text) != 0.
|
||||
* @pre score != null && len(score) != 0.
|
||||
* @pre IsValidLink(Link(link_type, link_target)).
|
||||
*/
|
||||
static LeagueTableElementID NewElement(LeagueTableID table, int64 rating, ScriptCompany::CompanyID company, Text *text, Text *score, LinkType link_type, LinkTargetID link_target);
|
||||
@ -104,7 +104,7 @@ public:
|
||||
* @return True if the action succeeded.
|
||||
* @pre No ScriptCompanyMode may be in scope.
|
||||
* @pre IsValidLeagueTableElement(element).
|
||||
* @pre text != nullptr && len(text) != 0.
|
||||
* @pre text != null && len(text) != 0.
|
||||
* @pre IsValidLink(Link(link_type, link_target)).
|
||||
*/
|
||||
static bool UpdateElementData(LeagueTableElementID element, ScriptCompany::CompanyID company, Text *text, LinkType link_type, LinkTargetID link_target);
|
||||
@ -117,7 +117,7 @@ public:
|
||||
* @return True if the action succeeded.
|
||||
* @pre No ScriptCompanyMode may be in scope.
|
||||
* @pre IsValidLeagueTableElement(element).
|
||||
* @pre score != nullptr && len(score) != 0.
|
||||
* @pre score != null && len(score) != 0.
|
||||
*/
|
||||
static bool UpdateElementScore(LeagueTableElementID element, int64 rating, Text *score);
|
||||
|
||||
|
@ -196,7 +196,7 @@ public:
|
||||
/**
|
||||
* Remove everything that is in the given list from this list (same item index that is).
|
||||
* @param list the list of items to remove.
|
||||
* @pre list != nullptr
|
||||
* @pre list != null
|
||||
*/
|
||||
void RemoveList(ScriptList *list);
|
||||
|
||||
@ -240,7 +240,7 @@ public:
|
||||
/**
|
||||
* Keeps everything that is in the given list from this list (same item index that is).
|
||||
* @param list the list of items to keep.
|
||||
* @pre list != nullptr
|
||||
* @pre list != null
|
||||
*/
|
||||
void KeepList(ScriptList *list);
|
||||
|
||||
|
@ -48,7 +48,7 @@ public:
|
||||
* Get the name of a loaded NewGRF.
|
||||
* @param grfid The NewGRF to query.
|
||||
* @pre ScriptNewGRF::IsLoaded(grfid).
|
||||
* @return The name of the NewGRF or nullptr if no name is defined.
|
||||
* @return The name of the NewGRF or null if no name is defined.
|
||||
*/
|
||||
static char *GetName(uint32 grfid);
|
||||
};
|
||||
|
@ -59,7 +59,7 @@ public:
|
||||
* - For #NR_TOWN this parameter should be a valid townID (ScriptTown::IsValidTown).
|
||||
* @return True if the action succeeded.
|
||||
* @pre type must be #NT_ECONOMY, #NT_SUBSIDIES, or #NT_GENERAL.
|
||||
* @pre text != nullptr.
|
||||
* @pre text != null.
|
||||
* @pre company == COMPANY_INVALID || ResolveCompanyID(company) != COMPANY_INVALID.
|
||||
* @pre The \a reference condition must be fulfilled.
|
||||
*/
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
* @param sign_id The sign to set the name for.
|
||||
* @param name The name for the sign (can be either a raw string, or a ScriptText object).
|
||||
* @pre IsValidSign(sign_id).
|
||||
* @pre name != nullptr && len(name) != 0.
|
||||
* @pre name != null && len(name) != 0.
|
||||
* @exception ScriptError::ERR_NAME_IS_NOT_UNIQUE
|
||||
* @return True if and only if the name was changed.
|
||||
*/
|
||||
@ -79,7 +79,7 @@ public:
|
||||
* @param location The place to build the sign.
|
||||
* @param name The text to place on the sign (can be either a raw string, or a ScriptText object).
|
||||
* @pre ScriptMap::IsValidTile(location).
|
||||
* @pre name != nullptr && len(name) != 0.
|
||||
* @pre name != null && len(name) != 0.
|
||||
* @exception ScriptSign::ERR_SIGN_TOO_MANY_SIGNS
|
||||
* @return The SignID of the build sign (use IsValidSign() to check for validity).
|
||||
* In test-mode it returns 0 if successful, or any other value to indicate
|
||||
|
@ -202,7 +202,7 @@ public:
|
||||
* @return The new StoryPageElementID, or STORY_PAGE_ELEMENT_INVALID if it failed.
|
||||
* @pre No ScriptCompanyMode may be in scope.
|
||||
* @pre IsValidStoryPage(story_page).
|
||||
* @pre (type != SPET_TEXT && type != SPET_LOCATION) || (text != nullptr && len(text) != 0).
|
||||
* @pre (type != SPET_TEXT && type != SPET_LOCATION) || (text != null && len(text) != 0).
|
||||
* @pre type != SPET_LOCATION || ScriptMap::IsValidTile(reference).
|
||||
* @pre type != SPET_GOAL || ScriptGoal::IsValidGoal(reference).
|
||||
* @pre if type is SPET_GOAL and story_page is a global page, then referenced goal must be global.
|
||||
@ -217,7 +217,7 @@ public:
|
||||
* @return True if the action succeeded.
|
||||
* @pre No ScriptCompanyMode may be in scope.
|
||||
* @pre IsValidStoryPage(story_page).
|
||||
* @pre (type != SPET_TEXT && type != SPET_LOCATION) || (text != nullptr && len(text) != 0).
|
||||
* @pre (type != SPET_TEXT && type != SPET_LOCATION) || (text != null && len(text) != 0).
|
||||
* @pre type != SPET_LOCATION || ScriptMap::IsValidTile(reference).
|
||||
* @pre type != SPET_GOAL || ScriptGoal::IsValidGoal(reference).
|
||||
* @pre if type is SPET_GOAL and story_page is a global page, then referenced goal must be global.
|
||||
|
@ -400,7 +400,7 @@ public:
|
||||
* @param size The town size of the new town.
|
||||
* @param city True if the new town should be a city.
|
||||
* @param layout The town layout of the new town.
|
||||
* @param name The name of the new town. Pass nullptr to use a random town name.
|
||||
* @param name The name of the new town. Pass null to use a random town name.
|
||||
* @game @pre no company mode in scope || ScriptSettings.GetValue("economy.found_town") != 0.
|
||||
* @ai @pre ScriptSettings.GetValue("economy.found_town") != 0.
|
||||
* @game @pre no company mode in scope || size != TOWN_SIZE_LARGE.
|
||||
|
@ -113,7 +113,7 @@ public:
|
||||
* @param vehicle_id The vehicle to set the name for.
|
||||
* @param name The name for the vehicle (can be either a raw string, or a ScriptText object).
|
||||
* @pre IsValidVehicle(vehicle_id).
|
||||
* @pre name != nullptr && len(name) != 0.
|
||||
* @pre name != null && len(name) != 0.
|
||||
* @game @pre Valid ScriptCompanyMode active in scope.
|
||||
* @exception ScriptError::ERR_NAME_IS_NOT_UNIQUE
|
||||
* @return True if and only if the name was changed.
|
||||
|
Loading…
Reference in New Issue
Block a user