diff options
author | truebrain <truebrain@openttd.org> | 2012-01-03 16:36:24 +0000 |
---|---|---|
committer | truebrain <truebrain@openttd.org> | 2012-01-03 16:36:24 +0000 |
commit | 34d90da509a27c4abe35c11d7f034b1e386cd968 (patch) | |
tree | 552a11c264ee5b26ad849818f50f45bf9927735c /src/script/api/game | |
parent | 18ac3f2bd89aa11fefa64bdada287a72937ab8d5 (diff) | |
download | openttd-34d90da509a27c4abe35c11d7f034b1e386cd968.tar.xz |
(svn r23731) -Add: add GSGoal::Question(), to ask a question to a(ll) company(ies). It can contain random text, and at most 3 buttons from a collection of 17
Diffstat (limited to 'src/script/api/game')
-rw-r--r-- | src/script/api/game/game_event.hpp.sq | 1 | ||||
-rw-r--r-- | src/script/api/game/game_event_types.hpp.sq | 17 | ||||
-rw-r--r-- | src/script/api/game/game_goal.hpp.sq | 40 |
3 files changed, 48 insertions, 10 deletions
diff --git a/src/script/api/game/game_event.hpp.sq b/src/script/api/game/game_event.hpp.sq index 1ac964518..396295530 100644 --- a/src/script/api/game/game_event.hpp.sq +++ b/src/script/api/game/game_event.hpp.sq @@ -47,6 +47,7 @@ void SQGSEvent_Register(Squirrel *engine) SQGSEvent.DefSQConst(engine, ScriptEvent::ET_AIRCRAFT_DEST_TOO_FAR, "ET_AIRCRAFT_DEST_TOO_FAR"); SQGSEvent.DefSQConst(engine, ScriptEvent::ET_ADMIN_PORT, "ET_ADMIN_PORT"); SQGSEvent.DefSQConst(engine, ScriptEvent::ET_WINDOW_WIDGET_CLICK, "ET_WINDOW_WIDGET_CLICK"); + SQGSEvent.DefSQConst(engine, ScriptEvent::ET_GOAL_QUESTION_ANSWER, "ET_GOAL_QUESTION_ANSWER"); SQGSEvent.DefSQMethod(engine, &ScriptEvent::GetEventType, "GetEventType", 1, "x"); diff --git a/src/script/api/game/game_event_types.hpp.sq b/src/script/api/game/game_event_types.hpp.sq index 25734cdaf..727e90bb1 100644 --- a/src/script/api/game/game_event_types.hpp.sq +++ b/src/script/api/game/game_event_types.hpp.sq @@ -249,3 +249,20 @@ void SQGSEventWindowWidgetClick_Register(Squirrel *engine) SQGSEventWindowWidgetClick.PostRegister(engine); } + + +template <> const char *GetClassName<ScriptEventGoalQuestionAnswer, ST_GS>() { return "GSEventGoalQuestionAnswer"; } + +void SQGSEventGoalQuestionAnswer_Register(Squirrel *engine) +{ + DefSQClass<ScriptEventGoalQuestionAnswer, ST_GS> SQGSEventGoalQuestionAnswer("GSEventGoalQuestionAnswer"); + SQGSEventGoalQuestionAnswer.PreRegister(engine, "GSEvent"); + + SQGSEventGoalQuestionAnswer.DefSQStaticMethod(engine, &ScriptEventGoalQuestionAnswer::Convert, "Convert", 2, ".x"); + + SQGSEventGoalQuestionAnswer.DefSQMethod(engine, &ScriptEventGoalQuestionAnswer::GetUniqueID, "GetUniqueID", 1, "x"); + SQGSEventGoalQuestionAnswer.DefSQMethod(engine, &ScriptEventGoalQuestionAnswer::GetCompany, "GetCompany", 1, "x"); + SQGSEventGoalQuestionAnswer.DefSQMethod(engine, &ScriptEventGoalQuestionAnswer::GetButton, "GetButton", 1, "x"); + + SQGSEventGoalQuestionAnswer.PostRegister(engine); +} diff --git a/src/script/api/game/game_goal.hpp.sq b/src/script/api/game/game_goal.hpp.sq index 54b1c6aeb..22ed685b6 100644 --- a/src/script/api/game/game_goal.hpp.sq +++ b/src/script/api/game/game_goal.hpp.sq @@ -21,16 +21,36 @@ void SQGSGoal_Register(Squirrel *engine) SQGSGoal.PreRegister(engine); SQGSGoal.AddConstructor<void (ScriptGoal::*)(), 1>(engine, "x"); - SQGSGoal.DefSQConst(engine, ScriptGoal::GOAL_INVALID, "GOAL_INVALID"); - SQGSGoal.DefSQConst(engine, ScriptGoal::GT_NONE, "GT_NONE"); - SQGSGoal.DefSQConst(engine, ScriptGoal::GT_TILE, "GT_TILE"); - SQGSGoal.DefSQConst(engine, ScriptGoal::GT_INDUSTRY, "GT_INDUSTRY"); - SQGSGoal.DefSQConst(engine, ScriptGoal::GT_TOWN, "GT_TOWN"); - SQGSGoal.DefSQConst(engine, ScriptGoal::GT_COMPANY, "GT_COMPANY"); - - SQGSGoal.DefSQStaticMethod(engine, &ScriptGoal::IsValidGoal, "IsValidGoal", 2, ".i"); - SQGSGoal.DefSQStaticMethod(engine, &ScriptGoal::New, "New", 5, ".i.ii"); - SQGSGoal.DefSQStaticMethod(engine, &ScriptGoal::Remove, "Remove", 2, ".i"); + SQGSGoal.DefSQConst(engine, ScriptGoal::GOAL_INVALID, "GOAL_INVALID"); + SQGSGoal.DefSQConst(engine, ScriptGoal::GT_NONE, "GT_NONE"); + SQGSGoal.DefSQConst(engine, ScriptGoal::GT_TILE, "GT_TILE"); + SQGSGoal.DefSQConst(engine, ScriptGoal::GT_INDUSTRY, "GT_INDUSTRY"); + SQGSGoal.DefSQConst(engine, ScriptGoal::GT_TOWN, "GT_TOWN"); + SQGSGoal.DefSQConst(engine, ScriptGoal::GT_COMPANY, "GT_COMPANY"); + SQGSGoal.DefSQConst(engine, ScriptGoal::BUTTON_CANCEL, "BUTTON_CANCEL"); + SQGSGoal.DefSQConst(engine, ScriptGoal::BUTTON_OK, "BUTTON_OK"); + SQGSGoal.DefSQConst(engine, ScriptGoal::BUTTON_NO, "BUTTON_NO"); + SQGSGoal.DefSQConst(engine, ScriptGoal::BUTTON_YES, "BUTTON_YES"); + SQGSGoal.DefSQConst(engine, ScriptGoal::BUTTON_DECLINE, "BUTTON_DECLINE"); + SQGSGoal.DefSQConst(engine, ScriptGoal::BUTTON_ACCEPT, "BUTTON_ACCEPT"); + SQGSGoal.DefSQConst(engine, ScriptGoal::BUTTON_IGNORE, "BUTTON_IGNORE"); + SQGSGoal.DefSQConst(engine, ScriptGoal::BUTTON_RETRY, "BUTTON_RETRY"); + SQGSGoal.DefSQConst(engine, ScriptGoal::BUTTON_PREVIOUS, "BUTTON_PREVIOUS"); + SQGSGoal.DefSQConst(engine, ScriptGoal::BUTTON_NEXT, "BUTTON_NEXT"); + SQGSGoal.DefSQConst(engine, ScriptGoal::BUTTON_STOP, "BUTTON_STOP"); + SQGSGoal.DefSQConst(engine, ScriptGoal::BUTTON_START, "BUTTON_START"); + SQGSGoal.DefSQConst(engine, ScriptGoal::BUTTON_GO, "BUTTON_GO"); + SQGSGoal.DefSQConst(engine, ScriptGoal::BUTTON_CONTINUE, "BUTTON_CONTINUE"); + SQGSGoal.DefSQConst(engine, ScriptGoal::BUTTON_RESTART, "BUTTON_RESTART"); + SQGSGoal.DefSQConst(engine, ScriptGoal::BUTTON_POSTPONE, "BUTTON_POSTPONE"); + SQGSGoal.DefSQConst(engine, ScriptGoal::BUTTON_SURRENDER, "BUTTON_SURRENDER"); + SQGSGoal.DefSQConst(engine, ScriptGoal::BUTTON_CLOSE, "BUTTON_CLOSE"); + + SQGSGoal.DefSQStaticMethod(engine, &ScriptGoal::IsValidGoal, "IsValidGoal", 2, ".i"); + SQGSGoal.DefSQStaticMethod(engine, &ScriptGoal::New, "New", 5, ".i.ii"); + SQGSGoal.DefSQStaticMethod(engine, &ScriptGoal::Remove, "Remove", 2, ".i"); + SQGSGoal.DefSQStaticMethod(engine, &ScriptGoal::Question, "Question", 5, ".ii.i"); + SQGSGoal.DefSQStaticMethod(engine, &ScriptGoal::CloseQuestion, "CloseQuestion", 2, ".i"); SQGSGoal.PostRegister(engine); } |