32 #include "table/strings.h"
45 static const NWidgetPart _nested_land_info_widgets[] = {
58 _nested_land_info_widgets,
lengthof(_nested_land_info_widgets)
68 static const uint LAND_INFO_LINE_BUFF_SIZE = 512;
71 char landinfo_data[LAND_INFO_LINE_END][LAND_INFO_LINE_BUFF_SIZE];
80 if (
StrEmpty(this->landinfo_data[i]))
break;
88 SetDParamStr(0, this->landinfo_data[LAND_INFO_MULTICENTER_LINE]);
99 if (
StrEmpty(this->landinfo_data[i]))
break;
102 size->width =
max(size->width, width);
105 if (i == 0) size->height += 4;
110 size->width =
max(size->width,
min(300u, width));
111 SetDParamStr(0, this->landinfo_data[LAND_INFO_MULTICENTER_LINE]);
121 # define LANDINFOD_LEVEL 0
123 # define LANDINFOD_LEVEL 1
125 DEBUG(misc, LANDINFOD_LEVEL,
"TILE: %#x (%i,%i)", tile,
TileX(tile),
TileY(tile));
126 DEBUG(misc, LANDINFOD_LEVEL,
"type = %#x",
_m[tile].type);
127 DEBUG(misc, LANDINFOD_LEVEL,
"height = %#x",
_m[tile].
height);
128 DEBUG(misc, LANDINFOD_LEVEL,
"m1 = %#x",
_m[tile].m1);
129 DEBUG(misc, LANDINFOD_LEVEL,
"m2 = %#x",
_m[tile].m2);
130 DEBUG(misc, LANDINFOD_LEVEL,
"m3 = %#x",
_m[tile].m3);
131 DEBUG(misc, LANDINFOD_LEVEL,
"m4 = %#x",
_m[tile].m4);
132 DEBUG(misc, LANDINFOD_LEVEL,
"m5 = %#x",
_m[tile].m5);
133 DEBUG(misc, LANDINFOD_LEVEL,
"m6 = %#x",
_me[tile].m6);
134 DEBUG(misc, LANDINFOD_LEVEL,
"m7 = %#x",
_me[tile].m7);
135 #undef LANDINFOD_LEVEL
151 td.
owner_type[0] = STR_LAND_AREA_INFORMATION_OWNER;
172 AddAcceptedCargo(tile, acceptance, NULL);
173 GetTileDesc(tile, &td);
179 GetString(this->landinfo_data[line_nr], td.
str,
lastof(this->landinfo_data[line_nr]));
183 for (uint i = 0; i < 4; i++) {
186 SetDParam(0, STR_LAND_AREA_INFORMATION_OWNER_N_A);
188 GetString(this->landinfo_data[line_nr], td.
owner_type[i],
lastof(this->landinfo_data[line_nr]));
193 StringID str = STR_LAND_AREA_INFORMATION_COST_TO_CLEAR_N_A;
197 c->
money = INT64_MAX;
200 c->
money = old_money;
205 str = STR_LAND_AREA_INFORMATION_REVENUE_WHEN_CLEARED;
207 str = STR_LAND_AREA_INFORMATION_COST_TO_CLEAR;
212 GetString(this->landinfo_data[line_nr], str,
lastof(this->landinfo_data[line_nr]));
222 GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_LANDINFO_COORDS,
lastof(this->landinfo_data[line_nr]));
226 SetDParam(0, STR_LAND_AREA_INFORMATION_LOCAL_AUTHORITY_NONE);
231 GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_LOCAL_AUTHORITY,
lastof(this->landinfo_data[line_nr]));
237 GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_BUILD_DATE,
lastof(this->landinfo_data[line_nr]));
244 GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_STATION_CLASS,
lastof(this->landinfo_data[line_nr]));
251 GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_STATION_TYPE,
lastof(this->landinfo_data[line_nr]));
258 GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_AIRPORT_CLASS,
lastof(this->landinfo_data[line_nr]));
265 GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_AIRPORT_NAME,
lastof(this->landinfo_data[line_nr]));
272 GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_AIRPORTTILE_NAME,
lastof(this->landinfo_data[line_nr]));
279 GetString(this->landinfo_data[line_nr], STR_LANG_AREA_INFORMATION_RAIL_TYPE,
lastof(this->landinfo_data[line_nr]));
286 GetString(this->landinfo_data[line_nr], STR_LANG_AREA_INFORMATION_RAIL_SPEED_LIMIT,
lastof(this->landinfo_data[line_nr]));
293 GetString(this->landinfo_data[line_nr], STR_LANG_AREA_INFORMATION_ROAD_SPEED_LIMIT,
lastof(this->landinfo_data[line_nr]));
298 if (td.
grf != NULL) {
300 GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_NEWGRF_NAME,
lastof(this->landinfo_data[line_nr]));
307 this->landinfo_data[line_nr][0] =
'\0';
310 char *strp = GetString(this->landinfo_data[
LAND_INFO_MULTICENTER_LINE], STR_LAND_AREA_INFORMATION_CARGO_ACCEPTED,
lastof(this->landinfo_data[LAND_INFO_MULTICENTER_LINE]));
314 if (acceptance[i] > 0) {
323 if (acceptance[i] < 8) {
326 strp = GetString(strp, STR_LAND_AREA_INFORMATION_CARGO_EIGHTS,
lastof(this->landinfo_data[LAND_INFO_MULTICENTER_LINE]));
328 strp = GetString(strp,
CargoSpec::Get(i)->name,
lastof(this->landinfo_data[LAND_INFO_MULTICENTER_LINE]));
352 if (!gui_scope)
return;
372 static const NWidgetPart _nested_about_widgets[] = {
392 _nested_about_widgets,
lengthof(_nested_about_widgets)
395 static const char *
const _credits[] = {
396 "Original design by Chris Sawyer",
397 "Original graphics by Simon Foster",
399 "The OpenTTD team (in alphabetical order):",
400 " Albert Hofkamp (Alberth) - GUI expert (since 0.7)",
401 " Matthijs Kooijman (blathijs) - Pathfinder-guru, Debian port (since 0.3)",
402 " Ulf Hermann (fonsinchen) - Cargo Distribution (since 1.3)",
403 " Christoph Elsenhans (frosch) - General coding (since 0.6)",
404 " Lo\xC3\xAF""c Guilloux (glx) - General / Windows Expert (since 0.4.5)",
405 " Michael Lutz (michi_cc) - Path based signals (since 0.7)",
406 " Owen Rudge (orudge) - Forum host, OS/2 port (since 0.1)",
407 " Peter Nelson (peter1138) - Spiritual descendant from NewGRF gods (since 0.4.5)",
408 " Ingo von Borstel (planetmaker) - General, Support (since 1.1)",
409 " Remko Bijker (Rubidium) - Lead coder and way more (since 0.4.5)",
410 " Jos\xC3\xA9 Soler (Terkhen) - General coding (since 1.0)",
411 " Leif Linse (Zuu) - AI/Game Script (since 1.2)",
413 "Inactive Developers:",
414 " Jean-Fran\xC3\xA7ois Claeys (Belugas) - GUI, NewGRF and more (0.4.5 - 1.0)",
415 " Bjarni Corfitzen (Bjarni) - MacOSX port, coder and vehicles (0.3 - 0.7)",
416 " Victor Fischer (Celestar) - Programming everywhere you need him to (0.3 - 0.6)",
417 " Jaroslav Mazanec (KUDr) - YAPG (Yet Another Pathfinder God) ;) (0.4.5 - 0.6)",
418 " Jonathan Coome (Maedhros) - High priest of the NewGRF Temple (0.5 - 0.6)",
419 " Attila B\xC3\xA1n (MiHaMiX) - Developer WebTranslator 1 and 2 (0.3 - 0.5)",
420 " Zden\xC4\x9Bk Sojka (SmatZ) - Bug finder and fixer (0.6 - 1.3)",
421 " Christoph Mallon (Tron) - Programmer, code correctness police (0.3 - 0.5)",
422 " Patric Stout (TrueBrain) - NoAI, NoGo, Network (0.3 - 1.2), sys op (active)",
423 " Thijs Marinussen (Yexo) - AI Framework, General (0.6 - 1.3)",
425 "Retired Developers:",
426 " Tam\xC3\xA1s Farag\xC3\xB3 (Darkvater) - Ex-Lead coder (0.3 - 0.5)",
427 " Dominik Scherer (dominik81) - Lead programmer, GUI expert (0.3 - 0.3)",
428 " Emil Djupfeld (egladil) - MacOSX (0.4.5 - 0.6)",
429 " Simon Sasburg (HackyKid) - Many bugfixes (0.4 - 0.4.5)",
430 " Ludvig Strigeus (ludde) - Original author of OpenTTD, main coder (0.1 - 0.3)",
431 " Cian Duffy (MYOB) - BeOS port / manual writing (0.1 - 0.3)",
432 " Petr Baudi\xC5\xA1 (pasky) - Many patches, NewGRF support (0.3 - 0.3)",
433 " Benedikt Br\xC3\xBCggemeier (skidd13) - Bug fixer and code reworker (0.6 - 0.7)",
434 " Serge Paquet (vurlix) - 2nd contributor after ludde (0.1 - 0.3)",
436 "Special thanks go out to:",
437 " Josef Drexler - For his great work on TTDPatch",
438 " Marcin Grzegorczyk - Track foundations and for describing TTD internals",
439 " Stefan Mei\xC3\x9Fner (sign_de) - For his work on the console",
440 " Mike Ragsdale - OpenTTD installer",
441 " Christian Rosentreter (tokai) - MorphOS / AmigaOS port",
442 " Richard Kempton (richK) - additional airports, initial TGP implementation",
444 " Alberto Demichelis - Squirrel scripting language \xC2\xA9 2003-2008",
445 " L. Peter Deutsch - MD5 implementation \xC2\xA9 1999, 2000, 2002",
446 " Michael Blunck - Pre-signals and semaphores \xC2\xA9 2003",
447 " George - Canal/Lock graphics \xC2\xA9 2003-2004",
448 " Andrew Parkhouse (andythenorth) - River graphics",
449 " David Dallaston (Pikka) - Tram tracks",
450 " All Translators - Who made OpenTTD a truly international game",
451 " Bug Reporters - Without whom OpenTTD would still be full of bugs!",
454 "And last but not least:",
455 " Chris Sawyer - For an amazing game!"
487 for (uint i = 0; i <
lengthof(_credits); i++) {
500 for (uint i = 0; i <
lengthof(_credits); i++) {
501 if (y >= r.top + 7 && y < r.bottom - this->
line_height) {
522 void ShowAboutWindow()
536 StringID msg = STR_MESSAGE_ESTIMATED_COST;
540 msg = STR_MESSAGE_ESTIMATED_INCOME;
556 StringID msg = STR_INCOME_FLOAT_COST;
560 msg = STR_INCOME_FLOAT_INCOME;
585 msg = STR_FEEDER_INCOME;
605 assert(
string != STR_NULL);
608 return AddTextEffect(
string, pt.x, pt.y, 0,
TE_STATIC);
618 assert(
string != STR_NULL);
621 UpdateTextEffect(te_id,
string);
630 if (*te_id == INVALID_TE_ID)
return;
632 RemoveTextEffect(*te_id);
633 *te_id = INVALID_TE_ID;
636 static const NWidgetPart _nested_tooltips_widgets[] = {
644 _nested_tooltips_widgets,
lengthof(_nested_tooltips_widgets)
659 assert_compile(
sizeof(this->params[0]) ==
sizeof(params[0]));
660 assert(paramcount <=
lengthof(this->params));
661 memcpy(this->params, params,
sizeof(this->params[0]) * paramcount);
683 pt.y =
Clamp(_cursor.
pos.y + _cursor.
total_size.y + _cursor.total_offs.y + 5, scr_top, scr_bot);
684 if (pt.y + sm_height > scr_bot) pt.y =
min(_cursor.
pos.y + _cursor.total_offs.y - 5, scr_bot) - sm_height;
685 pt.x = sm_width >= _screen.width ? 0 :
Clamp(_cursor.
pos.x - (sm_width >> 1), 0, _screen.width - sm_width);
709 for (uint arg = 0; arg < this->
paramcount; arg++) {
745 if (str == STR_NULL)
return;
747 new TooltipsWindow(parent, str, paramcount, params, close_tooltip);
750 void QueryString::HandleEditBox(
Window *w,
int wid)
760 void QueryString::DrawEditBox(
const Window *w,
int wid)
const
770 int clearbtn_left = wi->
pos_x + (rtl ? 0 : wi->
current_x - clearbtn_width);
771 int clearbtn_right = wi->
pos_x + (rtl ? clearbtn_width : wi->
current_x) - 1;
772 int left = wi->
pos_x + (rtl ? clearbtn_width : 0);
794 const Textbuf *tb = &this->text;
795 int delta =
min(0, (right - left) - tb->
pixels - 10);
804 if (focussed && tb->
caret) {
828 int left = wi->
pos_x + (rtl ? clearbtn_width : 0);
832 const Textbuf *tb = &this->text;
833 int delta =
min(0, (right - left) - tb->
pixels - 10);
858 int left = wi->
pos_x + (rtl ? clearbtn_width : 0);
865 const Textbuf *tb = &this->text;
866 int delta =
min(0, (right - left) - tb->
pixels - 10);
895 int left = wi->
pos_x + (rtl ? clearbtn_width : 0);
901 if (!
IsInsideMM(pt.y, top, bottom))
return NULL;
904 const Textbuf *tb = &this->text;
905 int delta =
min(0, (right - left) - tb->
pixels - 10);
911 void QueryString::ClickEditBox(
Window *w,
Point pt,
int wid,
int click_count,
bool focus_changed)
918 int clearbtn_width =
GetSpriteSize(rtl ? SPR_IMG_DELETE_RIGHT : SPR_IMG_DELETE_LEFT).width;
920 int clearbtn_left = wi->
pos_x + (rtl ? 0 : wi->
current_x - clearbtn_width);
922 if (
IsInsideBS(pt.x, clearbtn_left, clearbtn_width)) {
923 if (this->text.
bytes > 1) {
949 GetString(this->
editbox.text.
buf, str, last_of);
963 this->
editbox.caption = caption;
993 if (this->
editbox.orig == NULL || strcmp(this->
editbox.text.
buf, this->editbox.orig) != 0) {
996 if (this->
parent != NULL) {
1022 if (!this->
editbox.handled && this->parent != NULL) {
1024 this->parent = NULL;
1030 static const NWidgetPart _nested_query_string_widgets[] = {
1036 NWidget(
WWT_EDITBOX, COLOUR_GREY,
WID_QS_TEXT),
SetMinimalSize(256, 12),
SetFill(1, 1),
SetPadding(2, 2, 2, 2),
1049 _nested_query_string_widgets,
lengthof(_nested_query_string_widgets)
1084 this->
proc = callback;
1089 this->left = parent->
left + (parent->
width / 2) - (this->
width / 2);
1127 this->message, TC_FROMSTRING,
SA_CENTER);
1159 if (this->
proc != NULL) {
1172 static const NWidgetPart _nested_query_widgets[] = {
1190 _nested_query_widgets,
lengthof(_nested_query_widgets)
1207 FOR_ALL_WINDOWS_FROM_BACK(w) {
1211 if (qw->
parent != parent || qw->
proc != callback)
continue;
1217 new QueryWindow(&_query_desc, caption, message, parent, callback);