OpenTTD GameScript API
20240906-master-gd5ff6b4156
|
Class that handles some goal related functions. More...
Public Types | |
enum | GoalID : int { GOAL_INVALID } |
The goal IDs. More... | |
enum | GoalType : int { GT_NONE, GT_TILE, GT_INDUSTRY, GT_TOWN, GT_COMPANY, GT_STORY_PAGE = ::GT_STORY_PAGE } |
Goal types that can be given to a goal. More... | |
enum | QuestionType { QT_QUESTION, QT_INFORMATION, QT_WARNING, QT_ERROR } |
Types of queries we could do to the user. More... | |
enum | QuestionButton { BUTTON_CANCEL, BUTTON_OK, BUTTON_NO, BUTTON_YES, BUTTON_DECLINE, BUTTON_ACCEPT, BUTTON_IGNORE, BUTTON_RETRY, BUTTON_PREVIOUS, BUTTON_NEXT, BUTTON_STOP, BUTTON_START, BUTTON_GO, BUTTON_CONTINUE, BUTTON_RESTART, BUTTON_POSTPONE, BUTTON_SURRENDER, BUTTON_CLOSE } |
Types of buttons that can be in the question window. More... | |
Static Public Member Functions | |
static bool | IsValidGoal (GoalID goal_id) |
Check whether this is a valid goalID. More... | |
static bool | IsValidGoalDestination (GSCompany::CompanyID company, GoalType type, int destination) |
Check whether this is a valid goal destination. More... | |
static GoalID | New (GSCompany::CompanyID company, Text *goal, GoalType type, int destination) |
Create a new goal. More... | |
static bool | Remove (GoalID goal_id) |
Remove a goal from the list. More... | |
static bool | SetDestination (GoalID goal_id, GoalType type, int destination) |
Update goal destination of a goal. More... | |
static bool | SetText (GoalID goal_id, Text *goal) |
Update goal text of a goal. More... | |
static bool | SetProgress (GoalID goal_id, Text *progress) |
Update the progress text of a goal. More... | |
static bool | SetCompleted (GoalID goal_id, bool complete) |
Update completed status of goal. More... | |
static bool | IsCompleted (GoalID goal_id) |
Checks if a given goal have been marked as completed. More... | |
static bool | Question (int uniqueid, GSCompany::CompanyID company, Text *question, QuestionType type, int buttons) |
Ask a question of all players in a company. More... | |
static bool | QuestionClient (int uniqueid, GSClient::ClientID client, Text *question, QuestionType type, int buttons) |
Ask client a question. More... | |
static bool | CloseQuestion (int uniqueid) |
Close the question on all clients. More... | |
Class that handles some goal related functions.
Goals are saved and loaded. Upon bankruptcy or company takeover, all company specific goals are removed for that company. You can also remove individual goals using Remove.
enum GSGoal::GoalID : int |
enum GSGoal::GoalType : int |
Types of buttons that can be in the question window.
enum GSGoal::QuestionType |
Types of queries we could do to the user.
Basically the title of the question window.
|
static |
Close the question on all clients.
uniqueid | The uniqueid of the question you want to close. |
|
static |
Checks if a given goal have been marked as completed.
goal_id | The goal to check complete status. |
|
static |
Check whether this is a valid goalID.
goal_id | The GoalID to check. |
|
static |
Check whether this is a valid goal destination.
company | The relevant company if a story page is the destination. |
type | The type of the goal. |
destination | The destination of the type type. |
|
static |
Create a new goal.
company | The company to create the goal for, or GSCompany::COMPANY_INVALID for all. |
goal | The goal to add to the GUI (can be either a raw string, or a GSText object). |
type | The type of the goal. |
destination | The destination of the type type. |
|
static |
Ask a question of all players in a company.
uniqueid | Your unique id to distinguish results of multiple questions in the returning event. |
company | The company to ask the question, or GSCompany::COMPANY_INVALID for all. |
question | The question to ask (can be either a raw string, or a GSText object). |
type | The type of question that is being asked. |
buttons | Any combinations (at least 1, up to 3) of buttons defined in QuestionButton. Like BUTTON_YES + BUTTON_NO. |
|
static |
Ask client a question.
uniqueid | Your unique id to distinguish results of multiple questions in the returning event. |
client | The client to ask the question. |
question | The question to ask (can be either a raw string, or a GSText object). |
type | The type of question that is being asked. |
buttons | Any combinations (at least 1, up to 3) of buttons defined in QuestionButton. Like BUTTON_YES + BUTTON_NO. |
|
static |
Remove a goal from the list.
goal_id | The goal to remove. |
|
static |
Update completed status of goal.
goal_id | The goal to update. |
complete | The new goal completed status. |
Update goal destination of a goal.
goal_id | The goal to update. |
type | The type of the goal. |
destination | The destination of the type type. |
|
static |
Update the progress text of a goal.
The progress text is a text that is shown adjacent to the goal but in a separate column. Try to keep the progress string short.
goal_id | The goal to update. |
progress | The new progress text for the goal (can be either a raw string, or a GSText object). To clear the progress string you can pass null or an empty string. |
|
static |
Update goal text of a goal.
goal_id | The goal to update. |
goal | The new goal text (can be either a raw string, or a GSText object). |