# HG changeset patch # User rubidium # Date 2012-01-21 12:03:55 # Node ID 69567f39810d29ccef17aa678b459626f2fe8319 # Parent b2e758c9533f0387e957250ca2e319fb5c9ec8ec (svn r23827) -Feature [FS#4992]: [NoGo] Allow to chose the goal question window's title from a (small) set of options diff --git a/src/goal.cpp b/src/goal.cpp --- a/src/goal.cpp +++ b/src/goal.cpp @@ -130,14 +130,17 @@ CommandCost CmdGoalQuestion(TileIndex ti { uint16 uniqueid = (GoalType)GB(p1, 0, 16); CompanyID company = (CompanyID)GB(p1, 16, 8); + byte type = GB(p1, 24, 8); if (_current_company != OWNER_DEITY) return CMD_ERROR; if (StrEmpty(text)) return CMD_ERROR; if (company != INVALID_COMPANY && !Company::IsValidID(company)) return CMD_ERROR; if (CountBits(p2) < 1 || CountBits(p2) > 3) return CMD_ERROR; + if (p2 >= (1 << GOAL_QUESTION_BUTTON_COUNT)) return CMD_ERROR; + if (type >= GOAL_QUESTION_TYPE_COUNT) return CMD_ERROR; if (flags & DC_EXEC) { - if (company == _local_company || (company == INVALID_COMPANY && Company::IsValidID(_local_company))) ShowGoalQuestion(uniqueid, p2, text); + if (company == _local_company || (company == INVALID_COMPANY && Company::IsValidID(_local_company))) ShowGoalQuestion(uniqueid, type, p2, text); } return CommandCost(); diff --git a/src/goal_gui.cpp b/src/goal_gui.cpp --- a/src/goal_gui.cpp +++ b/src/goal_gui.cpp @@ -258,13 +258,15 @@ struct GoalQuestionWindow : Window { char *question; int buttons; int button[3]; + byte type; - GoalQuestionWindow(const WindowDesc *desc, WindowNumber window_number, uint32 button_mask, const char *question) : Window() + GoalQuestionWindow(const WindowDesc *desc, WindowNumber window_number, byte type, uint32 button_mask, const char *question) : Window(), type(type) { + assert(type < GOAL_QUESTION_TYPE_COUNT); this->question = strdup(question); /* Figure out which buttons we have to enable */ - int bit; + uint bit; int n = 0; FOR_EACH_SET_BIT(bit, button_mask) { if (bit >= GOAL_QUESTION_BUTTON_COUNT) break; @@ -287,6 +289,10 @@ struct GoalQuestionWindow : Window { virtual void SetStringParameters(int widget) const { switch (widget) { + case WID_GQ_CAPTION: + SetDParam(0, STR_GOAL_QUESTION_CAPTION_QUESTION + this->type); + break; + case WID_GQ_BUTTON_1: SetDParam(0, STR_GOAL_QUESTION_BUTTON_CANCEL + this->button[0]); break; @@ -341,7 +347,7 @@ struct GoalQuestionWindow : Window { static const NWidgetPart _nested_goal_question_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_LIGHT_BLUE), - NWidget(WWT_CAPTION, COLOUR_LIGHT_BLUE), SetDataTip(STR_GOAL_QUESTION_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), + NWidget(WWT_CAPTION, COLOUR_LIGHT_BLUE, WID_GQ_CAPTION), SetDataTip(STR_WHITE_STRING, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), EndContainer(), NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE), NWidget(WWT_EMPTY, INVALID_COLOUR, WID_GQ_QUESTION), SetMinimalSize(300, 0), SetPadding(8, 8, 8, 8), SetFill(1, 0), @@ -371,7 +377,7 @@ static const WindowDesc _goal_question_l ); -void ShowGoalQuestion(uint16 id, uint32 button_mask, const char *question) +void ShowGoalQuestion(uint16 id, byte type, uint32 button_mask, const char *question) { - new GoalQuestionWindow(&_goal_question_list_desc, id, button_mask, question); + new GoalQuestionWindow(&_goal_question_list_desc, id, type, button_mask, question); } diff --git a/src/goal_type.h b/src/goal_type.h --- a/src/goal_type.h +++ b/src/goal_type.h @@ -14,9 +14,8 @@ #include "core/enum_type.hpp" -enum { - GOAL_QUESTION_BUTTON_COUNT = 18, ///< Amount of buttons available. -}; +static const uint32 GOAL_QUESTION_BUTTON_COUNT = 18; ///< Amount of buttons available. +static const byte GOAL_QUESTION_TYPE_COUNT = 4; ///< Amount of question types. /** Types of goal destinations */ enum GoalType { diff --git a/src/gui.h b/src/gui.h --- a/src/gui.h +++ b/src/gui.h @@ -53,7 +53,7 @@ void ShowTownDirectory(); void ShowIndustryDirectory(); void ShowSubsidiesList(); void ShowGoalsList(); -void ShowGoalQuestion(uint16 id, uint32 button_mask, const char *question); +void ShowGoalQuestion(uint16 id, byte type, uint32 button_mask, const char *question); void ShowEstimatedCostOrIncome(Money cost, int x, int y); diff --git a/src/lang/belarusian.txt b/src/lang/belarusian.txt --- a/src/lang/belarusian.txt +++ b/src/lang/belarusian.txt @@ -3015,7 +3015,7 @@ STR_GOALS_COMPANY_TITLE :{BLACK}Задачы кампаніі: STR_GOALS_TOOLTIP_CLICK_ON_SERVICE_TO_CENTER :{BLACK}Пстрыкніце па задачы, каб паказаць прадпрыемства/горад/клетку. Ctrl+пстрычка паказвае ў новым вакне. # Goal question window -STR_GOAL_QUESTION_CAPTION :{WHITE}Пытаньне +STR_GOAL_QUESTION_CAPTION_QUESTION :Пытаньне ### Start of Goal Question button list STR_GOAL_QUESTION_BUTTON_CANCEL :Адмова diff --git a/src/lang/bulgarian.txt b/src/lang/bulgarian.txt --- a/src/lang/bulgarian.txt +++ b/src/lang/bulgarian.txt @@ -2563,7 +2563,7 @@ STR_GOALS_NONE :{ORANGE}- Никакви - STR_GOALS_COMPANY_TITLE :{BLACK}Цели на компанията: # Goal question window -STR_GOAL_QUESTION_CAPTION :{WHITE}Въпрос +STR_GOAL_QUESTION_CAPTION_QUESTION :Въпрос ### Start of Goal Question button list STR_GOAL_QUESTION_BUTTON_CANCEL :Недобре diff --git a/src/lang/catalan.txt b/src/lang/catalan.txt --- a/src/lang/catalan.txt +++ b/src/lang/catalan.txt @@ -2672,7 +2672,7 @@ STR_GOALS_COMPANY_TITLE STR_GOALS_TOOLTIP_CLICK_ON_SERVICE_TO_CENTER :{BLACK}Clica sobre l'objectiu per centrar la vista principal sobre la indústria/poble/cel·la. Ctrl+clic per obrir una nova vista sobre la indústria/poble/cel·la # Goal question window -STR_GOAL_QUESTION_CAPTION :{WHITE}Pregunta +STR_GOAL_QUESTION_CAPTION_QUESTION :Pregunta ### Start of Goal Question button list STR_GOAL_QUESTION_BUTTON_CANCEL :Cancel·la diff --git a/src/lang/croatian.txt b/src/lang/croatian.txt --- a/src/lang/croatian.txt +++ b/src/lang/croatian.txt @@ -2767,7 +2767,7 @@ STR_GOALS_COMPANY_TITLE STR_GOALS_TOOLTIP_CLICK_ON_SERVICE_TO_CENTER :{BLACK}Klikni na cilj za centriranje središnjeg pogleda na industriju/grad/pločicu. Ctrl+Klik otvara novi prozor s pogledom na lokaciju industrije/grada/pločice # Goal question window -STR_GOAL_QUESTION_CAPTION :{WHITE}Pitanje +STR_GOAL_QUESTION_CAPTION_QUESTION :Pitanje ### Start of Goal Question button list STR_GOAL_QUESTION_BUTTON_CANCEL :Poništi diff --git a/src/lang/dutch.txt b/src/lang/dutch.txt --- a/src/lang/dutch.txt +++ b/src/lang/dutch.txt @@ -2678,7 +2678,7 @@ STR_GOALS_COMPANY_TITLE STR_GOALS_TOOLTIP_CLICK_ON_SERVICE_TO_CENTER :{BLACK}Klik op doel om venster te centreren op industrie/stad/tegel. Ctrl+Klik opent een nieuw venster op industrie/stad/tegel locatie # Goal question window -STR_GOAL_QUESTION_CAPTION :{WHITE}Vraag +STR_GOAL_QUESTION_CAPTION_QUESTION :Vraag ### Start of Goal Question button list STR_GOAL_QUESTION_BUTTON_CANCEL :Annuleren diff --git a/src/lang/english.txt b/src/lang/english.txt --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -2678,7 +2678,10 @@ STR_GOALS_COMPANY_TITLE STR_GOALS_TOOLTIP_CLICK_ON_SERVICE_TO_CENTER :{BLACK}Click on goal to centre main view on industry/town/tile. Ctrl+Click opens a new viewport on industry/town/tile location # Goal question window -STR_GOAL_QUESTION_CAPTION :{WHITE}Question +STR_GOAL_QUESTION_CAPTION_QUESTION :Question +STR_GOAL_QUESTION_CAPTION_INFORMATION :Information +STR_GOAL_QUESTION_CAPTION_WARNING :Warning +STR_GOAL_QUESTION_CAPTION_ERROR :Error ### Start of Goal Question button list STR_GOAL_QUESTION_BUTTON_CANCEL :Cancel diff --git a/src/lang/english_AU.txt b/src/lang/english_AU.txt --- a/src/lang/english_AU.txt +++ b/src/lang/english_AU.txt @@ -2678,7 +2678,7 @@ STR_GOALS_COMPANY_TITLE STR_GOALS_TOOLTIP_CLICK_ON_SERVICE_TO_CENTER :{BLACK}Click on goal to centre main view on industry/town/tile. Ctrl+Click opens a new viewport on industry/town/tile location # Goal question window -STR_GOAL_QUESTION_CAPTION :{WHITE}Question +STR_GOAL_QUESTION_CAPTION_QUESTION :Question ### Start of Goal Question button list STR_GOAL_QUESTION_BUTTON_CANCEL :Cancel diff --git a/src/lang/english_US.txt b/src/lang/english_US.txt --- a/src/lang/english_US.txt +++ b/src/lang/english_US.txt @@ -2678,7 +2678,7 @@ STR_GOALS_COMPANY_TITLE STR_GOALS_TOOLTIP_CLICK_ON_SERVICE_TO_CENTER :{BLACK}Click on goal to center main view on industry/town/tile. Ctrl+Click opens a new viewport on industry/town/tile location # Goal question window -STR_GOAL_QUESTION_CAPTION :{WHITE}Question +STR_GOAL_QUESTION_CAPTION_QUESTION :Question ### Start of Goal Question button list STR_GOAL_QUESTION_BUTTON_CANCEL :Cancel diff --git a/src/lang/finnish.txt b/src/lang/finnish.txt --- a/src/lang/finnish.txt +++ b/src/lang/finnish.txt @@ -2678,7 +2678,7 @@ STR_GOALS_COMPANY_TITLE :{BLACK}Yhtiön tavoitteet: STR_GOALS_TOOLTIP_CLICK_ON_SERVICE_TO_CENTER :{BLACK}Klikkaa tavoitetta keskittääksesi päänäkymän teollisuuteen/kaupunkiin/ruutuun. Ctrl+Klik avaa uuden näkymän teollisuuden/kaupungin/ruudun sijaintiin # Goal question window -STR_GOAL_QUESTION_CAPTION :{WHITE}Kysymys +STR_GOAL_QUESTION_CAPTION_QUESTION :Kysymys ### Start of Goal Question button list STR_GOAL_QUESTION_BUTTON_CANCEL :Peruuta diff --git a/src/lang/french.txt b/src/lang/french.txt --- a/src/lang/french.txt +++ b/src/lang/french.txt @@ -2679,7 +2679,7 @@ STR_GOALS_COMPANY_TITLE STR_GOALS_TOOLTIP_CLICK_ON_SERVICE_TO_CENTER :{BLACK}Cliquer sur l'objectif pour centrer la vue principale sur l'industrie, la ville ou la case. Ctrl-clic pour ouvrir une nouvelle vue sur l'industrie, la ville ou la case # Goal question window -STR_GOAL_QUESTION_CAPTION :{WHITE}Question +STR_GOAL_QUESTION_CAPTION_QUESTION :Question ### Start of Goal Question button list STR_GOAL_QUESTION_BUTTON_CANCEL :Annuler diff --git a/src/lang/german.txt b/src/lang/german.txt --- a/src/lang/german.txt +++ b/src/lang/german.txt @@ -2679,7 +2679,7 @@ STR_GOALS_COMPANY_TITLE STR_GOALS_TOOLTIP_CLICK_ON_SERVICE_TO_CENTER :{BLACK}Klick auf Ziel zentriert Hauptansicht auf Industrie/Stadt/Feld. Strg+Klick öffnet eine darauf zentrierte Zusatzansicht # Goal question window -STR_GOAL_QUESTION_CAPTION :{WHITE}Frage +STR_GOAL_QUESTION_CAPTION_QUESTION :Frage ### Start of Goal Question button list STR_GOAL_QUESTION_BUTTON_CANCEL :Abbruch diff --git a/src/lang/hungarian.txt b/src/lang/hungarian.txt --- a/src/lang/hungarian.txt +++ b/src/lang/hungarian.txt @@ -2735,7 +2735,7 @@ STR_GOALS_COMPANY_TITLE :{BLACK}Cég céljai: STR_GOALS_TOOLTIP_CLICK_ON_SERVICE_TO_CENTER :{BLACK}Kattintással a fő nézetet a célra állítja. Ctrl+Kattintással új látképet nyit a gazdasági épület/település/mező helyéről # Goal question window -STR_GOAL_QUESTION_CAPTION :{WHITE}Kérdés +STR_GOAL_QUESTION_CAPTION_QUESTION :Kérdés ### Start of Goal Question button list STR_GOAL_QUESTION_BUTTON_CANCEL :Mégse diff --git a/src/lang/italian.txt b/src/lang/italian.txt --- a/src/lang/italian.txt +++ b/src/lang/italian.txt @@ -2706,7 +2706,7 @@ STR_GOALS_COMPANY_TITLE STR_GOALS_TOOLTIP_CLICK_ON_SERVICE_TO_CENTER :{BLACK}Fare clic su un obiettivo per centrare la visuale principale sull'industria, città o riquadro. CTRL+clic mostra l'industria/città/riquadro in una mini visuale # Goal question window -STR_GOAL_QUESTION_CAPTION :{WHITE}Domanda +STR_GOAL_QUESTION_CAPTION_QUESTION :Domanda ### Start of Goal Question button list STR_GOAL_QUESTION_BUTTON_CANCEL :Annulla diff --git a/src/lang/latvian.txt b/src/lang/latvian.txt --- a/src/lang/latvian.txt +++ b/src/lang/latvian.txt @@ -2671,7 +2671,7 @@ STR_GOALS_COMPANY_TITLE :{BLACK}Uzņēmuma mērķi: STR_GOALS_TOOLTIP_CLICK_ON_SERVICE_TO_CENTER :{BLACK}Klikšķiniet uz mērķa, lai centrētu galveno skatu uz ražotni/pilsētu/flīzi. Ctrl+klikšķis atver jaunu skatu logu uz ražotnes/pilsētas/flīzes vietu. # Goal question window -STR_GOAL_QUESTION_CAPTION :{WHITE}Jautājums +STR_GOAL_QUESTION_CAPTION_QUESTION :Jautājums ### Start of Goal Question button list STR_GOAL_QUESTION_BUTTON_CANCEL :Atcelt diff --git a/src/lang/lithuanian.txt b/src/lang/lithuanian.txt --- a/src/lang/lithuanian.txt +++ b/src/lang/lithuanian.txt @@ -2740,7 +2740,7 @@ STR_GOALS_COMPANY_TITLE STR_GOALS_TOOLTIP_CLICK_ON_SERVICE_TO_CENTER :{BLACK}Paspaudus ant nurodymo bus rodoma gamykla/miestas/vieta. Paspaudus laikant VALD (CTRL) klavišą bus atidarytas naujas langas su gamykla/miestu/vieta # Goal question window -STR_GOAL_QUESTION_CAPTION :{WHITE}Klausimas +STR_GOAL_QUESTION_CAPTION_QUESTION :Klausimas ### Start of Goal Question button list STR_GOAL_QUESTION_BUTTON_CANCEL :Atšaukti diff --git a/src/lang/norwegian_bokmal.txt b/src/lang/norwegian_bokmal.txt --- a/src/lang/norwegian_bokmal.txt +++ b/src/lang/norwegian_bokmal.txt @@ -2680,7 +2680,7 @@ STR_GOALS_COMPANY_TITLE :{BLACK}Firmaets mål: STR_GOALS_TOOLTIP_CLICK_ON_SERVICE_TO_CENTER :{BLACK}klikk på mål for å gå til industri/by/rute . Ctrl+klikk åpner et nytt tilleggsvindu over industriens/byens/rutens beliggenhet # Goal question window -STR_GOAL_QUESTION_CAPTION :{WHITE}Spørsmål +STR_GOAL_QUESTION_CAPTION_QUESTION :Spørsmål ### Start of Goal Question button list STR_GOAL_QUESTION_BUTTON_CANCEL :Avbryt diff --git a/src/lang/norwegian_nynorsk.txt b/src/lang/norwegian_nynorsk.txt --- a/src/lang/norwegian_nynorsk.txt +++ b/src/lang/norwegian_nynorsk.txt @@ -2665,7 +2665,7 @@ STR_GOALS_COMPANY_TITLE :{BLACK}Målet åt firmaet: STR_GOALS_TOOLTIP_CLICK_ON_SERVICE_TO_CENTER :{BLACK}Klikk på mål for å gå til industri/by/rute. Ctrl+klikk åpner eit nytt tilleggsvindauge over industrien/byen/ruta sin lokasjon. # Goal question window -STR_GOAL_QUESTION_CAPTION :{WHITE}Spørsmål +STR_GOAL_QUESTION_CAPTION_QUESTION :Spørsmål ### Start of Goal Question button list STR_GOAL_QUESTION_BUTTON_CANCEL :Avbryt diff --git a/src/lang/polish.txt b/src/lang/polish.txt --- a/src/lang/polish.txt +++ b/src/lang/polish.txt @@ -3058,7 +3058,7 @@ STR_GOALS_COMPANY_TITLE STR_GOALS_TOOLTIP_CLICK_ON_SERVICE_TO_CENTER :{BLACK}Kliknij na celu by wyśrodkować widok na przedsiębiorstwie/mieście/tytule. Ctrl+kliknięcie otwiera nowe okno podglądu lokacji danego przedsiębiorstwa.miasta/tytułu # Goal question window -STR_GOAL_QUESTION_CAPTION :{WHITE}Pytanie +STR_GOAL_QUESTION_CAPTION_QUESTION :Pytanie ### Start of Goal Question button list STR_GOAL_QUESTION_BUTTON_CANCEL :Anuluj diff --git a/src/lang/romanian.txt b/src/lang/romanian.txt --- a/src/lang/romanian.txt +++ b/src/lang/romanian.txt @@ -2678,7 +2678,7 @@ STR_GOALS_COMPANY_TITLE :{BLACK}Ţintele companiei: STR_GOALS_TOOLTIP_CLICK_ON_SERVICE_TO_CENTER :{BLACK}Click pe ţintă pentru a centra ecranul principal pe industrie/oraş/zonă. Ctrl+Click deschide o fereastră nouă de vizualizare a industriei/oraşului/zonei # Goal question window -STR_GOAL_QUESTION_CAPTION :{WHITE}Întrebare +STR_GOAL_QUESTION_CAPTION_QUESTION :Întrebare ### Start of Goal Question button list STR_GOAL_QUESTION_BUTTON_CANCEL :Anulează diff --git a/src/lang/russian.txt b/src/lang/russian.txt --- a/src/lang/russian.txt +++ b/src/lang/russian.txt @@ -2862,7 +2862,7 @@ STR_GOALS_COMPANY_TITLE :{BLACK}Задачи компании: STR_GOALS_TOOLTIP_CLICK_ON_SERVICE_TO_CENTER :{BLACK}Щёлкните по задаче, чтобы показать предприятие/город/клетку. Ctrl+щелчок показывает в новом окне. # Goal question window -STR_GOAL_QUESTION_CAPTION :{WHITE}Вопрос +STR_GOAL_QUESTION_CAPTION_QUESTION :Вопрос ### Start of Goal Question button list STR_GOAL_QUESTION_BUTTON_CANCEL :Отменить diff --git a/src/lang/serbian.txt b/src/lang/serbian.txt --- a/src/lang/serbian.txt +++ b/src/lang/serbian.txt @@ -2873,7 +2873,7 @@ STR_GOALS_COMPANY_TITLE :{BLACK}Ciljevi preduzeća: STR_GOALS_TOOLTIP_CLICK_ON_SERVICE_TO_CENTER :{BLACK}Klikom na cilj premešta se glavni pogled na fabriku/naselje/pločicu. Ctrl+Kilk otvara novi pogled na lokaciju fabrike/naselja/pločice # Goal question window -STR_GOAL_QUESTION_CAPTION :{WHITE}Pitanje +STR_GOAL_QUESTION_CAPTION_QUESTION :Pitanje ### Start of Goal Question button list STR_GOAL_QUESTION_BUTTON_CANCEL :Otkaži diff --git a/src/lang/simplified_chinese.txt b/src/lang/simplified_chinese.txt --- a/src/lang/simplified_chinese.txt +++ b/src/lang/simplified_chinese.txt @@ -2657,7 +2657,7 @@ STR_GOALS_COMPANY_TITLE :{BLACK}公司目标: STR_GOALS_TOOLTIP_CLICK_ON_SERVICE_TO_CENTER :{BLACK}点击使得视图移动到该工业/城镇/地块. Ctrl+左键 在该处创建一个视点. # Goal question window -STR_GOAL_QUESTION_CAPTION :{WHITE}帮助索引 +STR_GOAL_QUESTION_CAPTION_QUESTION :帮助索引 ### Start of Goal Question button list STR_GOAL_QUESTION_BUTTON_CANCEL :取消 diff --git a/src/lang/slovenian.txt b/src/lang/slovenian.txt --- a/src/lang/slovenian.txt +++ b/src/lang/slovenian.txt @@ -2831,7 +2831,7 @@ STR_GOALS_COMPANY_TITLE STR_GOALS_TOOLTIP_CLICK_ON_SERVICE_TO_CENTER :{BLACK}Klikni na cilj za pogled na industrijo/mesto/ploščo. Ctrl+Klik odpre novo okno na industrijo/mesto/ploščo # Goal question window -STR_GOAL_QUESTION_CAPTION :{WHITE}Vprašanje +STR_GOAL_QUESTION_CAPTION_QUESTION :Vprašanje ### Start of Goal Question button list STR_GOAL_QUESTION_BUTTON_CANCEL :Prekliči diff --git a/src/lang/spanish.txt b/src/lang/spanish.txt --- a/src/lang/spanish.txt +++ b/src/lang/spanish.txt @@ -2679,7 +2679,7 @@ STR_GOALS_COMPANY_TITLE :{BLACK}Metas de la compañía: STR_GOALS_TOOLTIP_CLICK_ON_SERVICE_TO_CENTER :{BLACK}Click en una meta para centrar la vista principal en la casilla, industria o pueblo. Ctrl+Click abre una nueva vista en esa localización # Goal question window -STR_GOAL_QUESTION_CAPTION :{WHITE}Pregunta +STR_GOAL_QUESTION_CAPTION_QUESTION :Pregunta ### Start of Goal Question button list STR_GOAL_QUESTION_BUTTON_CANCEL :Cancelar diff --git a/src/lang/turkish.txt b/src/lang/turkish.txt --- a/src/lang/turkish.txt +++ b/src/lang/turkish.txt @@ -2666,7 +2666,7 @@ STR_GOALS_COMPANY_TITLE :{BLACK}Şirket hedefleri: STR_GOALS_TOOLTIP_CLICK_ON_SERVICE_TO_CENTER :{BLACK}Ana görünümü istenen fabrika/kasaba/kareye getirmek için hedefe tıklayın. Ctrl+Tıklama fabrika/kasaba/kare konumunda yeni bir pencerede görünüm açar # Goal question window -STR_GOAL_QUESTION_CAPTION :{WHITE}Soru +STR_GOAL_QUESTION_CAPTION_QUESTION :Soru ### Start of Goal Question button list STR_GOAL_QUESTION_BUTTON_CANCEL :İptal diff --git a/src/lang/ukrainian.txt b/src/lang/ukrainian.txt --- a/src/lang/ukrainian.txt +++ b/src/lang/ukrainian.txt @@ -2794,7 +2794,7 @@ STR_GOALS_COMPANY_TITLE :{BLACK}Цілі компанії: STR_GOALS_TOOLTIP_CLICK_ON_SERVICE_TO_CENTER :{BLACK}Клік мишкою на цілі (меті) відобразить по центру промисловість/місто/клітинку у головному вікні. Ctrl+клік відкриє міні-вікно # Goal question window -STR_GOAL_QUESTION_CAPTION :{WHITE}Питання +STR_GOAL_QUESTION_CAPTION_QUESTION :Питання ### Start of Goal Question button list STR_GOAL_QUESTION_BUTTON_CANCEL :Відмінити diff --git a/src/lang/unfinished/persian.txt b/src/lang/unfinished/persian.txt --- a/src/lang/unfinished/persian.txt +++ b/src/lang/unfinished/persian.txt @@ -2670,7 +2670,7 @@ STR_GOALS_COMPANY_TITLE :{BLACK}اهداف شرکت: STR_GOALS_TOOLTIP_CLICK_ON_SERVICE_TO_CENTER :{BLACK}روی هدف کلیک کنید تا نمای اصلی را به مرکز صنایع/شهر/قطعه ببرد. Ctrl+Click یک نمای جدید از محل صنایع/شهر قطعه باز می کند # Goal question window -STR_GOAL_QUESTION_CAPTION :{WHITE}سوال +STR_GOAL_QUESTION_CAPTION_QUESTION :سوال ### Start of Goal Question button list STR_GOAL_QUESTION_BUTTON_CANCEL :لغو diff --git a/src/lang/welsh.txt b/src/lang/welsh.txt --- a/src/lang/welsh.txt +++ b/src/lang/welsh.txt @@ -2678,7 +2678,7 @@ STR_GOALS_COMPANY_TITLE STR_GOALS_TOOLTIP_CLICK_ON_SERVICE_TO_CENTER :{BLACK}Cliciwch ar nod i ganoli'r brif olygfa ar y diwydiant/tref/teil Mae Ctrl+Clic yn agor ffenestr golwg newydd ar leoliad y diwydiant/tref/teil # Goal question window -STR_GOAL_QUESTION_CAPTION :{WHITE}Cwestiwn +STR_GOAL_QUESTION_CAPTION_QUESTION :Cwestiwn ### Start of Goal Question button list STR_GOAL_QUESTION_BUTTON_CANCEL :Canslo diff --git a/src/script/api/game/game_goal.hpp.sq b/src/script/api/game/game_goal.hpp.sq --- a/src/script/api/game/game_goal.hpp.sq +++ b/src/script/api/game/game_goal.hpp.sq @@ -27,6 +27,10 @@ void SQGSGoal_Register(Squirrel *engine) 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::QT_QUESTION, "QT_QUESTION"); + SQGSGoal.DefSQConst(engine, ScriptGoal::QT_INFORMATION, "QT_INFORMATION"); + SQGSGoal.DefSQConst(engine, ScriptGoal::QT_WARNING, "QT_WARNING"); + SQGSGoal.DefSQConst(engine, ScriptGoal::QT_ERROR, "QT_ERROR"); SQGSGoal.DefSQConst(engine, ScriptGoal::BUTTON_CANCEL, "BUTTON_CANCEL"); SQGSGoal.DefSQConst(engine, ScriptGoal::BUTTON_OK, "BUTTON_OK"); SQGSGoal.DefSQConst(engine, ScriptGoal::BUTTON_NO, "BUTTON_NO"); @@ -49,7 +53,7 @@ void SQGSGoal_Register(Squirrel *engine) 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::Question, "Question", 6, ".ii.ii"); SQGSGoal.DefSQStaticMethod(engine, &ScriptGoal::CloseQuestion, "CloseQuestion", 2, ".i"); SQGSGoal.PostRegister(engine); diff --git a/src/script/api/script_goal.cpp b/src/script/api/script_goal.cpp --- a/src/script/api/script_goal.cpp +++ b/src/script/api/script_goal.cpp @@ -51,7 +51,7 @@ return ScriptObject::DoCommand(0, goal_id, 0, CMD_REMOVE_GOAL); } -/* static */ bool ScriptGoal::Question(uint16 uniqueid, ScriptCompany::CompanyID company, Text *question, int buttons) +/* static */ bool ScriptGoal::Question(uint16 uniqueid, ScriptCompany::CompanyID company, Text *question, QuestionType type, int buttons) { CCountedPtr counter(question); @@ -60,11 +60,13 @@ EnforcePrecondition(false, !StrEmpty(question->GetEncodedText())); EnforcePrecondition(false, company == ScriptCompany::COMPANY_INVALID || ScriptCompany::ResolveCompanyID(company) != ScriptCompany::COMPANY_INVALID); EnforcePrecondition(false, CountBits(buttons) >= 1 && CountBits(buttons) <= 3); + EnforcePrecondition(false, buttons < (1 << ::GOAL_QUESTION_BUTTON_COUNT)); + EnforcePrecondition(false, type < ::GOAL_QUESTION_TYPE_COUNT); uint8 c = company; if (company == ScriptCompany::COMPANY_INVALID) c = INVALID_COMPANY; - return ScriptObject::DoCommand(0, uniqueid | (c << 16), buttons, CMD_GOAL_QUESTION, question->GetEncodedText()); + return ScriptObject::DoCommand(0, uniqueid | (c << 16) | (type << 24), buttons, CMD_GOAL_QUESTION, question->GetEncodedText()); } /* static */ bool ScriptGoal::CloseQuestion(uint16 uniqueid) diff --git a/src/script/api/script_goal.hpp b/src/script/api/script_goal.hpp --- a/src/script/api/script_goal.hpp +++ b/src/script/api/script_goal.hpp @@ -41,6 +41,17 @@ public: GT_COMPANY = ::GT_COMPANY, ///< Destination is a company. }; + /** + * Types of queries we could do to the user. + * Basically the title of the question window. + */ + enum QuestionType { + 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. + }; + enum QuestionButton { /* Note: these values represent part of the string list starting with STR_GOAL_QUESTION_BUTTON_CANCEL */ BUTTON_CANCEL = (1 << 0), ///< Cancel button. @@ -97,6 +108,7 @@ public: * @param uniqueid Your unique id to distinguish results of multiple questions in the returning event. * @param company The company to ask the question, or ScriptCompany::COMPANY_INVALID for all. * @param question The question to ask (can be either a raw string, or a ScriptText object). + * @param type The type of question that is being asked. * @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. @@ -106,7 +118,7 @@ public: * @note Replies to the question are given by you via the event ScriptEvent_GoalQuestionAnswer. * @note There is no guarantee you ever get a reply on your question. */ - static bool Question(uint16 uniqueid, ScriptCompany::CompanyID company, Text *question, int buttons); + static bool Question(uint16 uniqueid, ScriptCompany::CompanyID company, Text *question, QuestionType type, int buttons); /** * Close the question on all clients. diff --git a/src/script/api/template/template_goal.hpp.sq b/src/script/api/template/template_goal.hpp.sq --- a/src/script/api/template/template_goal.hpp.sq +++ b/src/script/api/template/template_goal.hpp.sq @@ -17,6 +17,8 @@ namespace SQConvert { template <> inline int Return(HSQUIRRELVM vm, ScriptGoal::GoalID res) { sq_pushinteger(vm, (int32)res); return 1; } template <> inline ScriptGoal::GoalType GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptGoal::GoalType)tmp; } template <> inline int Return(HSQUIRRELVM vm, ScriptGoal::GoalType res) { sq_pushinteger(vm, (int32)res); return 1; } + template <> inline ScriptGoal::QuestionType GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptGoal::QuestionType)tmp; } + template <> inline int Return(HSQUIRRELVM vm, ScriptGoal::QuestionType res) { sq_pushinteger(vm, (int32)res); return 1; } template <> inline ScriptGoal::QuestionButton GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptGoal::QuestionButton)tmp; } template <> inline int Return(HSQUIRRELVM vm, ScriptGoal::QuestionButton res) { sq_pushinteger(vm, (int32)res); return 1; } diff --git a/src/widgets/goal_widget.h b/src/widgets/goal_widget.h --- a/src/widgets/goal_widget.h +++ b/src/widgets/goal_widget.h @@ -21,6 +21,7 @@ enum GoalListWidgets { /** Widgets of the #GoalQuestionWindow class. */ enum GoalQuestionWidgets { + WID_GQ_CAPTION, ///< Caption of the window. WID_GQ_QUESTION, ///< Question text. WID_GQ_BUTTONS, ///< Buttons selection (between 1, 2 or 3). WID_GQ_BUTTON_1, ///< First button.