summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/goal.cpp5
-rw-r--r--src/goal_gui.cpp16
-rw-r--r--src/goal_type.h5
-rw-r--r--src/gui.h2
-rw-r--r--src/lang/belarusian.txt2
-rw-r--r--src/lang/bulgarian.txt2
-rw-r--r--src/lang/catalan.txt2
-rw-r--r--src/lang/croatian.txt2
-rw-r--r--src/lang/dutch.txt2
-rw-r--r--src/lang/english.txt5
-rw-r--r--src/lang/english_AU.txt2
-rw-r--r--src/lang/english_US.txt2
-rw-r--r--src/lang/finnish.txt2
-rw-r--r--src/lang/french.txt2
-rw-r--r--src/lang/german.txt2
-rw-r--r--src/lang/hungarian.txt2
-rw-r--r--src/lang/italian.txt2
-rw-r--r--src/lang/latvian.txt2
-rw-r--r--src/lang/lithuanian.txt2
-rw-r--r--src/lang/norwegian_bokmal.txt2
-rw-r--r--src/lang/norwegian_nynorsk.txt2
-rw-r--r--src/lang/polish.txt2
-rw-r--r--src/lang/romanian.txt2
-rw-r--r--src/lang/russian.txt2
-rw-r--r--src/lang/serbian.txt2
-rw-r--r--src/lang/simplified_chinese.txt2
-rw-r--r--src/lang/slovenian.txt2
-rw-r--r--src/lang/spanish.txt2
-rw-r--r--src/lang/turkish.txt2
-rw-r--r--src/lang/ukrainian.txt2
-rw-r--r--src/lang/unfinished/persian.txt2
-rw-r--r--src/lang/welsh.txt2
-rw-r--r--src/script/api/game/game_goal.hpp.sq6
-rw-r--r--src/script/api/script_goal.cpp6
-rw-r--r--src/script/api/script_goal.hpp14
-rw-r--r--src/script/api/template/template_goal.hpp.sq2
-rw-r--r--src/widgets/goal_widget.h1
37 files changed, 74 insertions, 42 deletions
diff --git a/src/goal.cpp b/src/goal.cpp
index 5659af20f..cc28bce73 100644
--- a/src/goal.cpp
+++ b/src/goal.cpp
@@ -130,14 +130,17 @@ CommandCost CmdGoalQuestion(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
{
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
index abfb5a452..70dd6d5df 100644
--- 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_list_desc(
);
-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
index 223cf2c79..75b4c13f6 100644
--- 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
index c57c9a19a..e7cc5d5fd 100644
--- 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
index 262d9f715..a1cca97c3 100644
--- 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
index de135b796..163c34cb9 100644
--- 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
index fda585244..80f10e4da 100644
--- a/src/lang/catalan.txt
+++ b/src/lang/catalan.txt
@@ -2672,7 +2672,7 @@ STR_GOALS_COMPANY_TITLE :{BLACK}Objectiu
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
index 0750b26da..32b9bb8f6 100644
--- a/src/lang/croatian.txt
+++ b/src/lang/croatian.txt
@@ -2767,7 +2767,7 @@ STR_GOALS_COMPANY_TITLE :{BLACK}Ciljevi
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
index 3146ff1d0..539848e98 100644
--- a/src/lang/dutch.txt
+++ b/src/lang/dutch.txt
@@ -2678,7 +2678,7 @@ STR_GOALS_COMPANY_TITLE :{BLACK}Bedrijfs
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
index 86d6fea50..8b39d91b4 100644
--- a/src/lang/english.txt
+++ b/src/lang/english.txt
@@ -2678,7 +2678,10 @@ STR_GOALS_COMPANY_TITLE :{BLACK}Company
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
index 9688c905c..2e39b366b 100644
--- a/src/lang/english_AU.txt
+++ b/src/lang/english_AU.txt
@@ -2678,7 +2678,7 @@ STR_GOALS_COMPANY_TITLE :{BLACK}Company
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
index 589332692..88f256eeb 100644
--- a/src/lang/english_US.txt
+++ b/src/lang/english_US.txt
@@ -2678,7 +2678,7 @@ STR_GOALS_COMPANY_TITLE :{BLACK}Company
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
index 0b7b3eb83..82a09d611 100644
--- a/src/lang/finnish.txt
+++ b/src/lang/finnish.txt
@@ -2678,7 +2678,7 @@ STR_GOALS_COMPANY_TITLE :{BLACK}Yhtiön
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
index 058a2798f..35099121b 100644
--- a/src/lang/french.txt
+++ b/src/lang/french.txt
@@ -2679,7 +2679,7 @@ STR_GOALS_COMPANY_TITLE :{BLACK}Objectif
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
index cb7f003c9..3fe4f41e8 100644
--- a/src/lang/german.txt
+++ b/src/lang/german.txt
@@ -2679,7 +2679,7 @@ STR_GOALS_COMPANY_TITLE :{BLACK}Firmensp
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
index 1796fe197..0e5e1d414 100644
--- a/src/lang/hungarian.txt
+++ b/src/lang/hungarian.txt
@@ -2735,7 +2735,7 @@ STR_GOALS_COMPANY_TITLE :{BLACK}Cég cé
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
index 222156851..162a99a12 100644
--- a/src/lang/italian.txt
+++ b/src/lang/italian.txt
@@ -2706,7 +2706,7 @@ STR_GOALS_COMPANY_TITLE :{BLACK}Obiettiv
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
index 1edc0bcfb..95680fd2e 100644
--- a/src/lang/latvian.txt
+++ b/src/lang/latvian.txt
@@ -2671,7 +2671,7 @@ STR_GOALS_COMPANY_TITLE :{BLACK}Uzņēmu
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
index 9bd3fcad2..803c8fd9b 100644
--- a/src/lang/lithuanian.txt
+++ b/src/lang/lithuanian.txt
@@ -2740,7 +2740,7 @@ STR_GOALS_COMPANY_TITLE :{BLACK}Kompanij
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
index dc8971acd..2636d185d 100644
--- a/src/lang/norwegian_bokmal.txt
+++ b/src/lang/norwegian_bokmal.txt
@@ -2680,7 +2680,7 @@ STR_GOALS_COMPANY_TITLE :{BLACK}Firmaets
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
index 1328f6e82..15971ddc9 100644
--- a/src/lang/norwegian_nynorsk.txt
+++ b/src/lang/norwegian_nynorsk.txt
@@ -2665,7 +2665,7 @@ STR_GOALS_COMPANY_TITLE :{BLACK}Målet
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
index d27eee909..239b89019 100644
--- a/src/lang/polish.txt
+++ b/src/lang/polish.txt
@@ -3058,7 +3058,7 @@ STR_GOALS_COMPANY_TITLE :{BLACK}Cele fir
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
index e997cc8ea..72f6b4b04 100644
--- a/src/lang/romanian.txt
+++ b/src/lang/romanian.txt
@@ -2678,7 +2678,7 @@ STR_GOALS_COMPANY_TITLE :{BLACK}Ţintele
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
index 3238b2bfd..1d9fb75d4 100644
--- 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
index 6cb36cfb7..0d5799fc6 100644
--- a/src/lang/serbian.txt
+++ b/src/lang/serbian.txt
@@ -2873,7 +2873,7 @@ STR_GOALS_COMPANY_TITLE :{BLACK}Ciljevi
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
index ce4e0ca84..03d8c58f4 100644
--- 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
index 499088b23..be5daf16d 100644
--- a/src/lang/slovenian.txt
+++ b/src/lang/slovenian.txt
@@ -2831,7 +2831,7 @@ STR_GOALS_COMPANY_TITLE :{BLACK}Cilji po
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
index 23f98eca6..eaef93d13 100644
--- a/src/lang/spanish.txt
+++ b/src/lang/spanish.txt
@@ -2679,7 +2679,7 @@ STR_GOALS_COMPANY_TITLE :{BLACK}Metas de
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
index e135a5e1c..95c8336b3 100644
--- a/src/lang/turkish.txt
+++ b/src/lang/turkish.txt
@@ -2666,7 +2666,7 @@ STR_GOALS_COMPANY_TITLE :{BLACK}Şirket
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
index f8d8949b8..06dfebb53 100644
--- 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
index a242bf8b1..7fcf3e9d2 100644
--- 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
index 18559ffb0..6fb8e77f3 100644
--- a/src/lang/welsh.txt
+++ b/src/lang/welsh.txt
@@ -2678,7 +2678,7 @@ STR_GOALS_COMPANY_TITLE :{BLACK}Nodau cw
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
index 22ed685b6..765cc779e 100644
--- 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
index 88369cf04..8e9dcbff8 100644
--- 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<Text> 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
index 781b9bc07..5ad89666d 100644
--- 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
index 881f05b7e..6aa3014ee 100644
--- 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<ScriptGoal::GoalID>(HSQUIRRELVM vm, ScriptGoal::GoalID res) { sq_pushinteger(vm, (int32)res); return 1; }
template <> inline ScriptGoal::GoalType GetParam(ForceType<ScriptGoal::GoalType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptGoal::GoalType)tmp; }
template <> inline int Return<ScriptGoal::GoalType>(HSQUIRRELVM vm, ScriptGoal::GoalType res) { sq_pushinteger(vm, (int32)res); return 1; }
+ template <> inline ScriptGoal::QuestionType GetParam(ForceType<ScriptGoal::QuestionType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptGoal::QuestionType)tmp; }
+ template <> inline int Return<ScriptGoal::QuestionType>(HSQUIRRELVM vm, ScriptGoal::QuestionType res) { sq_pushinteger(vm, (int32)res); return 1; }
template <> inline ScriptGoal::QuestionButton GetParam(ForceType<ScriptGoal::QuestionButton>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptGoal::QuestionButton)tmp; }
template <> inline int Return<ScriptGoal::QuestionButton>(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
index 20422b1cd..2db6021c3 100644
--- 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.