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;
171 AddAcceptedCargo(tile, acceptance, NULL);
172 GetTileDesc(tile, &td);
178 GetString(this->landinfo_data[line_nr], td.
str,
lastof(this->landinfo_data[line_nr]));
182 for (uint i = 0; i < 4; i++) {
185 SetDParam(0, STR_LAND_AREA_INFORMATION_OWNER_N_A);
187 GetString(this->landinfo_data[line_nr], td.
owner_type[i],
lastof(this->landinfo_data[line_nr]));
192 StringID str = STR_LAND_AREA_INFORMATION_COST_TO_CLEAR_N_A;
196 c->
money = INT64_MAX;
199 c->
money = old_money;
204 str = STR_LAND_AREA_INFORMATION_REVENUE_WHEN_CLEARED;
206 str = STR_LAND_AREA_INFORMATION_COST_TO_CLEAR;
211 GetString(this->landinfo_data[line_nr], str,
lastof(this->landinfo_data[line_nr]));
221 GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_LANDINFO_COORDS,
lastof(this->landinfo_data[line_nr]));
225 SetDParam(0, STR_LAND_AREA_INFORMATION_LOCAL_AUTHORITY_NONE);
230 GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_LOCAL_AUTHORITY,
lastof(this->landinfo_data[line_nr]));
236 GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_BUILD_DATE,
lastof(this->landinfo_data[line_nr]));
243 GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_STATION_CLASS,
lastof(this->landinfo_data[line_nr]));
250 GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_STATION_TYPE,
lastof(this->landinfo_data[line_nr]));
257 GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_AIRPORT_CLASS,
lastof(this->landinfo_data[line_nr]));
264 GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_AIRPORT_NAME,
lastof(this->landinfo_data[line_nr]));
271 GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_AIRPORTTILE_NAME,
lastof(this->landinfo_data[line_nr]));
278 GetString(this->landinfo_data[line_nr], STR_LANG_AREA_INFORMATION_RAIL_SPEED_LIMIT,
lastof(this->landinfo_data[line_nr]));
285 GetString(this->landinfo_data[line_nr], STR_LANG_AREA_INFORMATION_ROAD_SPEED_LIMIT,
lastof(this->landinfo_data[line_nr]));
290 if (td.
grf != NULL) {
292 GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_NEWGRF_NAME,
lastof(this->landinfo_data[line_nr]));
299 this->landinfo_data[line_nr][0] =
'\0';
302 char *strp = GetString(this->landinfo_data[
LAND_INFO_MULTICENTER_LINE], STR_LAND_AREA_INFORMATION_CARGO_ACCEPTED,
lastof(this->landinfo_data[LAND_INFO_MULTICENTER_LINE]));
306 if (acceptance[i] > 0) {
315 if (acceptance[i] < 8) {
318 strp = GetString(strp, STR_LAND_AREA_INFORMATION_CARGO_EIGHTS,
lastof(this->landinfo_data[LAND_INFO_MULTICENTER_LINE]));
320 strp = GetString(strp,
CargoSpec::Get(i)->name,
lastof(this->landinfo_data[LAND_INFO_MULTICENTER_LINE]));
344 if (!gui_scope)
return;
364 static const NWidgetPart _nested_about_widgets[] = {
384 _nested_about_widgets,
lengthof(_nested_about_widgets)
387 static const char *
const _credits[] = {
388 "Original design by Chris Sawyer",
389 "Original graphics by Simon Foster",
391 "The OpenTTD team (in alphabetical order):",
392 " Albert Hofkamp (Alberth) - GUI expert (since 0.7)",
393 " Matthijs Kooijman (blathijs) - Pathfinder-guru, Debian port (since 0.3)",
394 " Ulf Hermann (fonsinchen) - Cargo Distribution (since 1.3)",
395 " Christoph Elsenhans (frosch) - General coding (since 0.6)",
396 " Lo\xC3\xAF""c Guilloux (glx) - General / Windows Expert (since 0.4.5)",
397 " Michael Lutz (michi_cc) - Path based signals (since 0.7)",
398 " Owen Rudge (orudge) - Forum host, OS/2 port (since 0.1)",
399 " Peter Nelson (peter1138) - Spiritual descendant from NewGRF gods (since 0.4.5)",
400 " Ingo von Borstel (planetmaker) - General, Support (since 1.1)",
401 " Remko Bijker (Rubidium) - Lead coder and way more (since 0.4.5)",
402 " Jos\xC3\xA9 Soler (Terkhen) - General coding (since 1.0)",
403 " Leif Linse (Zuu) - AI/Game Script (since 1.2)",
405 "Inactive Developers:",
406 " Jean-Fran\xC3\xA7ois Claeys (Belugas) - GUI, NewGRF and more (0.4.5 - 1.0)",
407 " Bjarni Corfitzen (Bjarni) - MacOSX port, coder and vehicles (0.3 - 0.7)",
408 " Victor Fischer (Celestar) - Programming everywhere you need him to (0.3 - 0.6)",
409 " Jaroslav Mazanec (KUDr) - YAPG (Yet Another Pathfinder God) ;) (0.4.5 - 0.6)",
410 " Jonathan Coome (Maedhros) - High priest of the NewGRF Temple (0.5 - 0.6)",
411 " Attila B\xC3\xA1n (MiHaMiX) - Developer WebTranslator 1 and 2 (0.3 - 0.5)",
412 " Zden\xC4\x9Bk Sojka (SmatZ) - Bug finder and fixer (0.6 - 1.3)",
413 " Christoph Mallon (Tron) - Programmer, code correctness police (0.3 - 0.5)",
414 " Patric Stout (TrueBrain) - NoAI, NoGo, Network (0.3 - 1.2), sys op (active)",
415 " Thijs Marinussen (Yexo) - AI Framework, General (0.6 - 1.3)",
417 "Retired Developers:",
418 " Tam\xC3\xA1s Farag\xC3\xB3 (Darkvater) - Ex-Lead coder (0.3 - 0.5)",
419 " Dominik Scherer (dominik81) - Lead programmer, GUI expert (0.3 - 0.3)",
420 " Emil Djupfeld (egladil) - MacOSX (0.4.5 - 0.6)",
421 " Simon Sasburg (HackyKid) - Many bugfixes (0.4 - 0.4.5)",
422 " Ludvig Strigeus (ludde) - Original author of OpenTTD, main coder (0.1 - 0.3)",
423 " Cian Duffy (MYOB) - BeOS port / manual writing (0.1 - 0.3)",
424 " Petr Baudi\xC5\xA1 (pasky) - Many patches, NewGRF support (0.3 - 0.3)",
425 " Benedikt Br\xC3\xBCggemeier (skidd13) - Bug fixer and code reworker (0.6 - 0.7)",
426 " Serge Paquet (vurlix) - 2nd contributor after ludde (0.1 - 0.3)",
428 "Special thanks go out to:",
429 " Josef Drexler - For his great work on TTDPatch",
430 " Marcin Grzegorczyk - Track foundations and for describing TTD internals",
431 " Stefan Mei\xC3\x9Fner (sign_de) - For his work on the console",
432 " Mike Ragsdale - OpenTTD installer",
433 " Christian Rosentreter (tokai) - MorphOS / AmigaOS port",
434 " Richard Kempton (richK) - additional airports, initial TGP implementation",
436 " Alberto Demichelis - Squirrel scripting language \xC2\xA9 2003-2008",
437 " L. Peter Deutsch - MD5 implementation \xC2\xA9 1999, 2000, 2002",
438 " Michael Blunck - Pre-signals and semaphores \xC2\xA9 2003",
439 " George - Canal/Lock graphics \xC2\xA9 2003-2004",
440 " Andrew Parkhouse (andythenorth) - River graphics",
441 " David Dallaston (Pikka) - Tram tracks",
442 " All Translators - Who made OpenTTD a truly international game",
443 " Bug Reporters - Without whom OpenTTD would still be full of bugs!",
446 "And last but not least:",
447 " Chris Sawyer - For an amazing game!"
479 for (uint i = 0; i <
lengthof(_credits); i++) {
492 for (uint i = 0; i <
lengthof(_credits); i++) {
493 if (y >= r.top + 7 && y < r.bottom - this->
line_height) {
514 void ShowAboutWindow()
528 StringID msg = STR_MESSAGE_ESTIMATED_COST;
532 msg = STR_MESSAGE_ESTIMATED_INCOME;
548 StringID msg = STR_INCOME_FLOAT_COST;
552 msg = STR_INCOME_FLOAT_INCOME;
577 msg = STR_FEEDER_INCOME;
597 assert(
string != STR_NULL);
600 return AddTextEffect(
string, pt.x, pt.y, 0,
TE_STATIC);
610 assert(
string != STR_NULL);
613 UpdateTextEffect(te_id,
string);
622 if (*te_id == INVALID_TE_ID)
return;
624 RemoveTextEffect(*te_id);
625 *te_id = INVALID_TE_ID;
628 static const NWidgetPart _nested_tooltips_widgets[] = {
636 _nested_tooltips_widgets,
lengthof(_nested_tooltips_widgets)
651 assert_compile(
sizeof(this->params[0]) ==
sizeof(params[0]));
652 assert(paramcount <=
lengthof(this->params));
653 memcpy(this->params, params,
sizeof(this->params[0]) * paramcount);
675 pt.y =
Clamp(_cursor.pos.y + _cursor.size.y + _cursor.offs.y + 5, scr_top, scr_bot);
676 if (pt.y + sm_height > scr_bot) pt.y =
min(_cursor.pos.y + _cursor.offs.y - 5, scr_bot) - sm_height;
677 pt.x = sm_width >= _screen.width ? 0 :
Clamp(_cursor.pos.x - (sm_width >> 1), 0, _screen.width - sm_width);
701 for (uint arg = 0; arg < this->
paramcount; arg++) {
737 if (str == STR_NULL)
return;
739 new TooltipsWindow(parent, str, paramcount, params, close_tooltip);
742 void QueryString::HandleEditBox(
Window *w,
int wid)
752 void QueryString::DrawEditBox(
const Window *w,
int wid)
const
762 int clearbtn_left = wi->
pos_x + (rtl ? 0 : wi->
current_x - clearbtn_width);
763 int clearbtn_right = wi->
pos_x + (rtl ? clearbtn_width : wi->
current_x) - 1;
764 int left = wi->
pos_x + (rtl ? clearbtn_width : 0);
786 const Textbuf *tb = &this->text;
787 int delta =
min(0, (right - left) - tb->
pixels - 10);
796 if (focussed && tb->
caret) {
820 int left = wi->
pos_x + (rtl ? clearbtn_width : 0);
824 const Textbuf *tb = &this->text;
825 int delta =
min(0, (right - left) - tb->
pixels - 10);
850 int left = wi->
pos_x + (rtl ? clearbtn_width : 0);
857 const Textbuf *tb = &this->text;
858 int delta =
min(0, (right - left) - tb->
pixels - 10);
887 int left = wi->
pos_x + (rtl ? clearbtn_width : 0);
893 if (!
IsInsideMM(pt.y, top, bottom))
return NULL;
896 const Textbuf *tb = &this->text;
897 int delta =
min(0, (right - left) - tb->
pixels - 10);
903 void QueryString::ClickEditBox(
Window *w,
Point pt,
int wid,
int click_count,
bool focus_changed)
910 int clearbtn_width =
GetSpriteSize(rtl ? SPR_IMG_DELETE_RIGHT : SPR_IMG_DELETE_LEFT).width;
912 int clearbtn_left = wi->
pos_x + (rtl ? 0 : wi->
current_x - clearbtn_width);
914 if (
IsInsideBS(pt.x, clearbtn_left, clearbtn_width)) {
915 if (this->text.
bytes > 1) {
941 GetString(this->
editbox.text.
buf, str, last_of);
955 this->
editbox.caption = caption;
985 if (this->
editbox.orig == NULL || strcmp(this->
editbox.text.
buf, this->editbox.orig) != 0) {
988 if (this->
parent != NULL) {
1014 if (!this->
editbox.handled && this->parent != NULL) {
1016 this->parent = NULL;
1022 static const NWidgetPart _nested_query_string_widgets[] = {
1028 NWidget(
WWT_EDITBOX, COLOUR_GREY,
WID_QS_TEXT),
SetMinimalSize(256, 12),
SetFill(1, 1),
SetPadding(2, 2, 2, 2),
1041 _nested_query_string_widgets,
lengthof(_nested_query_string_widgets)
1076 this->
proc = callback;
1081 this->left = parent->
left + (parent->
width / 2) - (this->
width / 2);
1119 this->message, TC_FROMSTRING,
SA_CENTER);
1151 if (this->
proc != NULL) {
1164 static const NWidgetPart _nested_query_widgets[] = {
1182 _nested_query_widgets,
lengthof(_nested_query_widgets)
1199 FOR_ALL_WINDOWS_FROM_BACK(w) {
1203 if (qw->
parent != parent || qw->
proc != callback)
continue;
1209 new QueryWindow(&_query_desc, caption, message, parent, callback);