|
@@ -83,43 +83,43 @@ static void LandInfoWndProc(Window *w, W
|
|
|
SetDParam(2, STR_SPEC_USERSTRING);
|
|
|
DrawStringCentered(140, 49, STR_LANDINFO_COORDS, 0);
|
|
|
|
|
|
SetDParam(0, STR_01A9_NONE);
|
|
|
if (lid->town != NULL) {
|
|
|
SetDParam(0, STR_TOWN);
|
|
|
SetDParam(1, lid->town->index);
|
|
|
}
|
|
|
DrawStringCentered(140,60, STR_01A8_LOCAL_AUTHORITY, 0);
|
|
|
|
|
|
{
|
|
|
char buf[512];
|
|
|
char *p = GetString(buf, STR_01CE_CARGO_ACCEPTED);
|
|
|
char *p = GetString(buf, STR_01CE_CARGO_ACCEPTED, lastof(buf));
|
|
|
bool found = false;
|
|
|
|
|
|
for (i = 0; i < NUM_CARGO; ++i) {
|
|
|
if (lid->ac[i] > 0) {
|
|
|
// Add a comma between each item.
|
|
|
if (found) {
|
|
|
*p++ = ',';
|
|
|
*p++ = ' ';
|
|
|
}
|
|
|
found = true;
|
|
|
|
|
|
// If the accepted value is less than 8, show it in 1/8:ths
|
|
|
if (lid->ac[i] < 8) {
|
|
|
SetDParam(0, lid->ac[i]);
|
|
|
SetDParam(1, _cargoc.names_s[i]);
|
|
|
p = GetString(p, STR_01D1_8);
|
|
|
p = GetString(p, STR_01D1_8, lastof(buf));
|
|
|
} else {
|
|
|
p = GetString(p, _cargoc.names_s[i]);
|
|
|
p = GetString(p, _cargoc.names_s[i], lastof(buf));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (found) DrawStringMultiCenter(140, 76, BindCString(buf), 276);
|
|
|
}
|
|
|
|
|
|
if (lid->td.build_date != 0) {
|
|
|
SetDParam(0,lid->td.build_date);
|
|
|
DrawStringCentered(140,71, STR_BUILD_DATE, 0);
|
|
|
}
|
|
|
}
|
|
@@ -670,25 +670,25 @@ void GuiShowTooltipsWithArgs(StringID st
|
|
|
char buffer[512];
|
|
|
BoundingRect br;
|
|
|
Window *w;
|
|
|
uint i;
|
|
|
int x, y;
|
|
|
|
|
|
DeleteWindowById(WC_TOOLTIPS, 0);
|
|
|
|
|
|
/* We only show measurement tooltips with patch setting on */
|
|
|
if (str == STR_NULL || (paramcount != 0 && !_patches.measure_tooltip)) return;
|
|
|
|
|
|
for (i = 0; i != paramcount; i++) SetDParam(i, params[i]);
|
|
|
GetString(buffer, str);
|
|
|
GetString(buffer, str, lastof(buffer));
|
|
|
|
|
|
br = GetStringBoundingBox(buffer);
|
|
|
br.width += 6; br.height += 4; // increase slightly to have some space around the box
|
|
|
|
|
|
/* Cut tooltip length to 200 pixels max, wrap to new line if longer */
|
|
|
if (br.width > 200) {
|
|
|
br.height += ((br.width - 4) / 176) * 10;
|
|
|
br.width = 200;
|
|
|
}
|
|
|
|
|
|
/* Correctly position the tooltip position, watch out for window and cursor size
|
|
|
* Clamp value to below main toolbar and above statusbar. If tooltip would
|
|
@@ -1067,25 +1067,25 @@ static char _orig_str_buf[lengthof(_edit
|
|
|
void ShowQueryString(StringID str, StringID caption, uint maxlen, uint maxwidth, WindowClass window_class, WindowNumber window_number, CharSetFilter afilter)
|
|
|
{
|
|
|
Window *w;
|
|
|
uint realmaxlen = maxlen & ~0x1000;
|
|
|
|
|
|
assert(realmaxlen < lengthof(_edit_str_buf));
|
|
|
|
|
|
DeleteWindowById(WC_QUERY_STRING, 0);
|
|
|
DeleteWindowById(WC_SAVELOAD, 0);
|
|
|
|
|
|
w = AllocateWindowDesc(&_query_string_desc);
|
|
|
|
|
|
GetString(_edit_str_buf, str);
|
|
|
GetString(_edit_str_buf, str, lastof(_edit_str_buf));
|
|
|
_edit_str_buf[realmaxlen-1] = '\0';
|
|
|
|
|
|
if (maxlen & 0x1000) {
|
|
|
WP(w, querystr_d).orig = NULL;
|
|
|
} else {
|
|
|
strcpy(_orig_str_buf, _edit_str_buf);
|
|
|
WP(w, querystr_d).orig = _orig_str_buf;
|
|
|
}
|
|
|
|
|
|
LowerWindowWidget(w, 5);
|
|
|
WP(w, querystr_d).caption = caption;
|
|
|
WP(w, querystr_d).wnd_class = window_class;
|
|
@@ -1302,25 +1302,25 @@ static void MakeSortedSaveGameList(void)
|
|
|
qsort(_fios_list + sort_start, s_amount, sizeof(FiosItem), compare_FiosItems);
|
|
|
}
|
|
|
|
|
|
static void GenerateFileName(void)
|
|
|
{
|
|
|
/* Check if we are not a specatator who wants to generate a name..
|
|
|
Let's use the name of player #0 for now. */
|
|
|
const Player *p = GetPlayer(IsValidPlayer(_local_player) ? _local_player : 0);
|
|
|
|
|
|
SetDParam(0, p->name_1);
|
|
|
SetDParam(1, p->name_2);
|
|
|
SetDParam(2, _date);
|
|
|
GetString(_edit_str_buf, STR_4004);
|
|
|
GetString(_edit_str_buf, STR_4004, lastof(_edit_str_buf));
|
|
|
}
|
|
|
|
|
|
extern void StartupEngines(void);
|
|
|
|
|
|
static void SaveLoadDlgWndProc(Window *w, WindowEvent *e)
|
|
|
{
|
|
|
static FiosItem o_dir;
|
|
|
|
|
|
switch (e->event) {
|
|
|
case WE_CREATE: { /* Set up OPENTTD button */
|
|
|
o_dir.type = FIOS_TYPE_DIRECT;
|
|
|
switch (_saveload_mode) {
|
|
@@ -1768,25 +1768,25 @@ static void CheatsWndProc(Window *w, Win
|
|
|
int32 val = (int32)ReadValue(ce->variable, ce->type);
|
|
|
char buf[512];
|
|
|
|
|
|
/* Draw [<][>] boxes for settings of an integer-type */
|
|
|
DrawArrowButtons(x + 20, y, 3, clk - (i * 2), true, true);
|
|
|
|
|
|
switch (ce->str) {
|
|
|
/* Display date for change date cheat */
|
|
|
case STR_CHEAT_CHANGE_DATE: SetDParam(0, _date); break;
|
|
|
/* Draw colored flag for change player cheat */
|
|
|
case STR_CHEAT_CHANGE_PLAYER:
|
|
|
SetDParam(0, val);
|
|
|
GetString(buf, STR_CHEAT_CHANGE_PLAYER);
|
|
|
GetString(buf, STR_CHEAT_CHANGE_PLAYER, lastof(buf));
|
|
|
DrawPlayerIcon(_current_player, 60 + GetStringBoundingBox(buf).width, y + 2);
|
|
|
break;
|
|
|
/* Set correct string for switch climate cheat */
|
|
|
case STR_CHEAT_SWITCH_CLIMATE: val += STR_TEMPERATE_LANDSCAPE;
|
|
|
/* Fallthrough */
|
|
|
default: SetDParam(0, val);
|
|
|
}
|
|
|
} break;
|
|
|
}
|
|
|
|
|
|
DrawString(50, y + 1, ce->str, 0);
|
|
|
|