GSGoal Class Reference

Class that handles some goal related functions. More...


Public Types

enum  GoalID { GOAL_INVALID }
 The goal IDs. More...
enum  GoalType {
  GT_NONE,
  GT_TILE,
  GT_INDUSTRY,
  GT_TOWN,
  GT_COMPANY
}
 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
}

Static Public Member Functions

static bool IsValidGoal (GoalID goal_id)
 Check whether this is a valid goalID.
static GoalID New (GSCompany::CompanyID company, Text *goal, GoalType type, uint32 destination)
 Create a new goal.
static bool Remove (GoalID goal_id)
 Remove a goal from the list.
static bool Question (uint16 uniqueid, GSCompany::CompanyID company, Text *question, QuestionType type, int buttons)
 Ask a question.
static bool CloseQuestion (uint16 uniqueid)
 Close the question on all clients.


Detailed Description

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.


Member Enumeration Documentation

The goal IDs.

Enumerator:
GOAL_INVALID  An invalid goal id.

Goal types that can be given to a goal.

Enumerator:
GT_NONE  Destination is not linked.
GT_TILE  Destination is a tile.
GT_INDUSTRY  Destination is an industry.
GT_TOWN  Destination is a town.
GT_COMPANY  Destination is a company.

Types of queries we could do to the user.

Basically the title of the question window.

Enumerator:
QT_QUESTION  Asking a simple question; title: Question.
QT_INFORMATION  Showing an informational message; title: Information.
QT_WARNING  Showing a warning; title: Warning.
QT_ERROR  Showing an error; title: Error.

Enumerator:
BUTTON_CANCEL  Cancel button.
BUTTON_OK  OK button.
BUTTON_NO  No button.
BUTTON_YES  Yes button.
BUTTON_DECLINE  Decline button.
BUTTON_ACCEPT  Accept button.
BUTTON_IGNORE  Ignore button.
BUTTON_RETRY  Retry button.
BUTTON_PREVIOUS  Previous button.
BUTTON_NEXT  Next button.
BUTTON_STOP  Stop button.
BUTTON_START  Start button.
BUTTON_GO  Go button.
BUTTON_CONTINUE  Continue button.
BUTTON_RESTART  Restart button.
BUTTON_POSTPONE  Postpone button.
BUTTON_SURRENDER  Surrender button.
BUTTON_CLOSE  Close button.


Member Function Documentation

static bool GSGoal::IsValidGoal ( GoalID  goal_id  )  [static]

Check whether this is a valid goalID.

Parameters:
goal_id The GoalID to check.
Returns:
True if and only if this goal is valid.

static GoalID GSGoal::New ( GSCompany::CompanyID  company,
Text *  goal,
GoalType  type,
uint32  destination 
) [static]

Create a new goal.

Parameters:
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.
Returns:
The new GoalID, or GOAL_INVALID if it failed.
Precondition:
No GSCompanyMode may be in scope.

goal != NULL && len(goal) != 0.

company == COMPANY_INVALID || ResolveCompanyID(company) != COMPANY_INVALID.

static bool GSGoal::Remove ( GoalID  goal_id  )  [static]

Remove a goal from the list.

Parameters:
goal_id The goal to remove.
Returns:
True if the action succeeded.
Precondition:
No GSCompanyMode may be in scope.

IsValidGoal(goal_id).

static bool GSGoal::Question ( uint16  uniqueid,
GSCompany::CompanyID  company,
Text *  question,
QuestionType  type,
int  buttons 
) [static]

Ask a question.

Parameters:
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.
Returns:
True if the action succeeded.
Precondition:
No GSCompanyMode may be in scope.

question != NULL && len(question) != 0.

company == COMPANY_INVALID || ResolveCompanyID(company) != COMPANY_INVALID.

CountBits(buttons) >= 1 && CountBits(buttons) <= 3.

Note:
Replies to the question are given by you via the event GSEvent_GoalQuestionAnswer.

There is no guarantee you ever get a reply on your question.

static bool GSGoal::CloseQuestion ( uint16  uniqueid  )  [static]

Close the question on all clients.

Parameters:
uniqueid The uniqueid of the question you want to close.
Returns:
True if the action succeeded.
Precondition:
No GSCompanyMode may be in scope.
Note:
If you send a question to a single company, and get a reply for them, the question is already closed on all clients. Only use this function if you want to timeout a question, or if you send the question to all companies, but you are only interested in the reply of the first.


Generated on Sun Mar 31 21:37:41 2013 for OpenTTD Game API by  doxygen 1.5.6