2005-07-24 14:12:37 +00:00
|
|
|
/* $Id$ */
|
|
|
|
|
2007-04-04 01:35:16 +00:00
|
|
|
/** @file settings_gui.cpp */
|
|
|
|
|
2004-08-09 17:04:08 +00:00
|
|
|
#include "stdafx.h"
|
2005-06-02 19:30:21 +00:00
|
|
|
#include "openttd.h"
|
2005-08-06 14:59:54 +00:00
|
|
|
#include "currency.h"
|
2005-07-22 07:02:20 +00:00
|
|
|
#include "functions.h"
|
2005-02-06 13:41:02 +00:00
|
|
|
#include "string.h"
|
2005-02-06 08:18:00 +00:00
|
|
|
#include "strings.h" // XXX GetCurrentCurrencyRate()
|
2005-02-13 11:18:02 +00:00
|
|
|
#include "table/sprites.h"
|
2004-11-25 10:47:30 +00:00
|
|
|
#include "table/strings.h"
|
2004-08-09 17:04:08 +00:00
|
|
|
#include "window.h"
|
|
|
|
#include "gui.h"
|
|
|
|
#include "gfx.h"
|
|
|
|
#include "command.h"
|
|
|
|
#include "engine.h"
|
2004-11-15 19:25:59 +00:00
|
|
|
#include "screenshot.h"
|
2004-11-21 22:44:13 +00:00
|
|
|
#include "newgrf.h"
|
2007-01-02 17:34:03 +00:00
|
|
|
#include "network/network.h"
|
2004-12-31 18:57:24 +00:00
|
|
|
#include "town.h"
|
2005-07-21 22:15:02 +00:00
|
|
|
#include "variables.h"
|
2006-03-02 01:41:25 +00:00
|
|
|
#include "settings.h"
|
2006-04-18 05:16:13 +00:00
|
|
|
#include "vehicle.h"
|
2006-08-14 14:21:15 +00:00
|
|
|
#include "date.h"
|
2007-01-10 18:56:51 +00:00
|
|
|
#include "helpers.hpp"
|
2007-06-18 23:00:55 +00:00
|
|
|
#include "newgrf_townname.h"
|
2004-08-09 17:04:08 +00:00
|
|
|
|
|
|
|
static uint32 _difficulty_click_a;
|
|
|
|
static uint32 _difficulty_click_b;
|
|
|
|
static byte _difficulty_timeout;
|
|
|
|
|
2006-03-26 21:50:57 +00:00
|
|
|
static const StringID _units_dropdown[] = {
|
|
|
|
STR_UNITS_IMPERIAL,
|
|
|
|
STR_UNITS_METRIC,
|
|
|
|
STR_UNITS_SI,
|
2004-08-09 17:04:08 +00:00
|
|
|
INVALID_STRING_ID
|
|
|
|
};
|
|
|
|
|
|
|
|
static const StringID _driveside_dropdown[] = {
|
|
|
|
STR_02E9_DRIVE_ON_LEFT,
|
|
|
|
STR_02EA_DRIVE_ON_RIGHT,
|
|
|
|
INVALID_STRING_ID
|
|
|
|
};
|
|
|
|
|
|
|
|
static const StringID _autosave_dropdown[] = {
|
|
|
|
STR_02F7_OFF,
|
|
|
|
STR_AUTOSAVE_1_MONTH,
|
|
|
|
STR_02F8_EVERY_3_MONTHS,
|
|
|
|
STR_02F9_EVERY_6_MONTHS,
|
|
|
|
STR_02FA_EVERY_12_MONTHS,
|
|
|
|
INVALID_STRING_ID,
|
|
|
|
};
|
|
|
|
|
|
|
|
static const StringID _designnames_dropdown[] = {
|
|
|
|
STR_02BE_DEFAULT,
|
|
|
|
STR_02BF_CUSTOM,
|
|
|
|
INVALID_STRING_ID
|
|
|
|
};
|
|
|
|
|
|
|
|
static StringID *BuildDynamicDropdown(StringID base, int num)
|
|
|
|
{
|
|
|
|
static StringID buf[32 + 1];
|
|
|
|
StringID *p = buf;
|
|
|
|
while (--num>=0) *p++ = base++;
|
|
|
|
*p = INVALID_STRING_ID;
|
|
|
|
return buf;
|
|
|
|
}
|
|
|
|
|
2007-06-18 23:00:55 +00:00
|
|
|
int _nb_orig_names = SPECSTR_TOWNNAME_LAST - SPECSTR_TOWNNAME_START + 1;
|
|
|
|
static StringID *_town_names = NULL;
|
|
|
|
static StringID *_grf_names = NULL;
|
|
|
|
static int _nb_grf_names = 0;
|
2007-06-04 19:51:31 +00:00
|
|
|
|
|
|
|
void SortTownGeneratorNames()
|
|
|
|
{
|
2007-06-18 23:00:55 +00:00
|
|
|
int n = 0;
|
|
|
|
|
|
|
|
/* Get Newgrf generators' names */
|
|
|
|
free(_grf_names);
|
|
|
|
_grf_names = GetGRFTownNameList();
|
|
|
|
_nb_grf_names = 0;
|
|
|
|
for (StringID *s = _grf_names; *s != INVALID_STRING_ID; s++) _nb_grf_names++;
|
|
|
|
|
|
|
|
/* Prepare the list */
|
|
|
|
free(_town_names);
|
|
|
|
_town_names = MallocT<StringID>(_nb_orig_names + _nb_grf_names + 1);
|
|
|
|
|
|
|
|
/* Put the original strings */
|
|
|
|
for (int i = 0; i < _nb_orig_names; i++) _town_names[n++] = STR_TOWNNAME_ORIGINAL_ENGLISH + i;
|
|
|
|
|
|
|
|
/* Put the grf strings */
|
|
|
|
for (int i = 0; i < _nb_grf_names; i++) _town_names[n++] = _grf_names[i];
|
|
|
|
|
|
|
|
/* Put the terminator */
|
|
|
|
_town_names[n] = INVALID_STRING_ID;
|
2007-06-04 19:51:31 +00:00
|
|
|
|
|
|
|
/* Sort the strings */
|
2007-06-18 23:00:55 +00:00
|
|
|
qsort(&_town_names[0], _nb_orig_names + _nb_grf_names, sizeof(StringID), &StringIDSorter);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline StringID TownName(int town_name)
|
|
|
|
{
|
|
|
|
if (town_name < _nb_orig_names) return STR_TOWNNAME_ORIGINAL_ENGLISH + town_name;
|
|
|
|
town_name -= _nb_orig_names;
|
|
|
|
if (town_name < _nb_grf_names) return _grf_names[town_name];
|
|
|
|
return STR_UNDEFINED;
|
2007-06-04 19:51:31 +00:00
|
|
|
}
|
|
|
|
|
2007-03-07 11:47:46 +00:00
|
|
|
static int GetCurRes()
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
|
|
|
int i;
|
2005-11-14 19:48:04 +00:00
|
|
|
|
|
|
|
for (i = 0; i != _num_resolutions; i++) {
|
2004-09-23 21:14:20 +00:00
|
|
|
if (_resolutions[i][0] == _screen.width &&
|
2005-11-14 19:48:04 +00:00
|
|
|
_resolutions[i][1] == _screen.height) {
|
2004-08-09 17:04:08 +00:00
|
|
|
break;
|
2005-11-14 19:48:04 +00:00
|
|
|
}
|
|
|
|
}
|
2004-08-09 17:04:08 +00:00
|
|
|
return i;
|
|
|
|
}
|
|
|
|
|
2007-03-07 11:47:46 +00:00
|
|
|
static inline bool RoadVehiclesAreBuilt()
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
2005-11-14 19:48:04 +00:00
|
|
|
const Vehicle* v;
|
|
|
|
|
2005-01-06 18:45:28 +00:00
|
|
|
FOR_ALL_VEHICLES(v) {
|
2007-03-08 16:27:54 +00:00
|
|
|
if (v->type == VEH_ROAD) return true;
|
2005-01-03 21:05:03 +00:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2006-01-05 12:40:50 +00:00
|
|
|
|
2007-03-07 11:47:46 +00:00
|
|
|
static void ShowCustCurrency();
|
2006-01-05 12:40:50 +00:00
|
|
|
|
2005-01-03 21:05:03 +00:00
|
|
|
static void GameOptionsWndProc(Window *w, WindowEvent *e)
|
|
|
|
{
|
2005-03-12 21:21:47 +00:00
|
|
|
switch (e->event) {
|
2004-08-09 17:04:08 +00:00
|
|
|
case WE_PAINT: {
|
2005-01-03 21:05:03 +00:00
|
|
|
int i;
|
2004-08-09 17:04:08 +00:00
|
|
|
StringID str = STR_02BE_DEFAULT;
|
2006-10-03 02:08:15 +00:00
|
|
|
|
|
|
|
SetWindowWidgetDisabledState(w, 21, !(_vehicle_design_names & 1));
|
|
|
|
if (!IsWindowWidgetDisabled(w, 21)) str = STR_02BF_CUSTOM;
|
2004-12-02 22:53:07 +00:00
|
|
|
SetDParam(0, str);
|
2006-08-25 00:41:10 +00:00
|
|
|
SetDParam(1, _currency_specs[_opt_ptr->currency].name);
|
2006-03-26 21:50:57 +00:00
|
|
|
SetDParam(2, STR_UNITS_IMPERIAL + _opt_ptr->units);
|
2005-03-12 21:21:47 +00:00
|
|
|
SetDParam(3, STR_02E9_DRIVE_ON_LEFT + _opt_ptr->road_side);
|
2007-06-18 23:00:55 +00:00
|
|
|
SetDParam(4, TownName(_opt_ptr->town_name));
|
2005-03-12 21:21:47 +00:00
|
|
|
SetDParam(5, _autosave_dropdown[_opt_ptr->autosave]);
|
2004-12-02 22:53:07 +00:00
|
|
|
SetDParam(6, SPECSTR_LANGUAGE_START + _dynlang.curr);
|
2004-08-09 17:04:08 +00:00
|
|
|
i = GetCurRes();
|
2004-12-02 22:53:07 +00:00
|
|
|
SetDParam(7, i == _num_resolutions ? STR_RES_OTHER : SPECSTR_RESOLUTION_START + i);
|
|
|
|
SetDParam(8, SPECSTR_SCREENSHOT_START + _cur_screenshot_format);
|
2006-10-04 19:11:43 +00:00
|
|
|
SetWindowWidgetLoweredState(w, 28, _fullscreen);
|
2004-09-21 20:56:49 +00:00
|
|
|
|
2004-08-09 17:04:08 +00:00
|
|
|
DrawWindowWidgets(w);
|
2007-11-04 00:08:57 +00:00
|
|
|
DrawString(20, 175, STR_OPTIONS_FULLSCREEN, TC_FROMSTRING); // fullscreen
|
2007-04-18 22:41:53 +00:00
|
|
|
} break;
|
2004-08-09 17:04:08 +00:00
|
|
|
|
|
|
|
case WE_CLICK:
|
2006-09-23 02:39:24 +00:00
|
|
|
switch (e->we.click.widget) {
|
2005-05-14 21:01:57 +00:00
|
|
|
case 4: case 5: /* Setup currencies dropdown */
|
2006-08-25 00:41:10 +00:00
|
|
|
ShowDropDownMenu(w, BuildCurrencyDropdown(), _opt_ptr->currency, 5, _game_mode == GM_MENU ? 0 : ~GetMaskOfAllowedCurrencies(), 0);;
|
2004-08-09 17:04:08 +00:00
|
|
|
return;
|
2005-05-14 21:01:57 +00:00
|
|
|
case 7: case 8: /* Setup distance unit dropdown */
|
2006-03-26 21:50:57 +00:00
|
|
|
ShowDropDownMenu(w, _units_dropdown, _opt_ptr->units, 8, 0, 0);
|
2004-08-09 17:04:08 +00:00
|
|
|
return;
|
2005-05-14 21:01:57 +00:00
|
|
|
case 10: case 11: { /* Setup road-side dropdown */
|
2005-01-03 21:05:03 +00:00
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
/* You can only change the drive side if you are in the menu or ingame with
|
|
|
|
* no vehicles present. In a networking game only the server can change it */
|
|
|
|
if ((_game_mode != GM_MENU && RoadVehiclesAreBuilt()) || (_networking && !_network_server))
|
2005-03-12 21:21:47 +00:00
|
|
|
i = (-1) ^ (1 << _opt_ptr->road_side); // disable the other value
|
2005-01-03 21:05:03 +00:00
|
|
|
|
2005-05-14 21:01:57 +00:00
|
|
|
ShowDropDownMenu(w, _driveside_dropdown, _opt_ptr->road_side, 11, i, 0);
|
2005-01-03 21:05:03 +00:00
|
|
|
} return;
|
2005-05-14 21:01:57 +00:00
|
|
|
case 13: case 14: { /* Setup townname dropdown */
|
2007-06-04 20:06:54 +00:00
|
|
|
uint sel = 0;
|
2007-06-18 23:00:55 +00:00
|
|
|
for (uint i = 0; _town_names[i] != INVALID_STRING_ID; i++) {
|
|
|
|
if (_town_names[i] == TownName(_opt_ptr->town_name)) {
|
2007-06-04 19:51:31 +00:00
|
|
|
sel = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ShowDropDownMenu(w, _town_names, sel, 14, (_game_mode == GM_MENU) ? 0 : (-1) ^ (1 << sel), 0);
|
2004-08-09 17:04:08 +00:00
|
|
|
return;
|
|
|
|
}
|
2005-05-14 21:01:57 +00:00
|
|
|
case 16: case 17: /* Setup autosave dropdown */
|
|
|
|
ShowDropDownMenu(w, _autosave_dropdown, _opt_ptr->autosave, 17, 0, 0);
|
2004-08-09 17:04:08 +00:00
|
|
|
return;
|
2005-05-14 21:01:57 +00:00
|
|
|
case 19: case 20: /* Setup customized vehicle-names dropdown */
|
|
|
|
ShowDropDownMenu(w, _designnames_dropdown, (_vehicle_design_names & 1) ? 1 : 0, 20, (_vehicle_design_names & 2) ? 0 : 2, 0);
|
2004-08-09 17:04:08 +00:00
|
|
|
return;
|
2005-01-03 21:05:03 +00:00
|
|
|
case 21: /* Save customized vehicle-names to disk */
|
2004-08-09 17:04:08 +00:00
|
|
|
return;
|
2005-05-14 21:01:57 +00:00
|
|
|
case 23: case 24: /* Setup interface language dropdown */
|
|
|
|
ShowDropDownMenu(w, _dynlang.dropdown, _dynlang.curr, 24, 0, 0);
|
2004-08-09 17:04:08 +00:00
|
|
|
return;
|
2005-05-14 21:01:57 +00:00
|
|
|
case 26: case 27: /* Setup resolution dropdown */
|
|
|
|
ShowDropDownMenu(w, BuildDynamicDropdown(SPECSTR_RESOLUTION_START, _num_resolutions), GetCurRes(), 27, 0, 0);
|
2004-08-09 17:04:08 +00:00
|
|
|
return;
|
2004-09-21 20:56:49 +00:00
|
|
|
case 28: /* Click fullscreen on/off */
|
2006-10-04 19:11:43 +00:00
|
|
|
SetWindowWidgetLoweredState(w, 28, !_fullscreen);
|
2004-09-21 20:56:49 +00:00
|
|
|
ToggleFullScreen(!_fullscreen); // toggle full-screen on/off
|
|
|
|
SetWindowDirty(w);
|
|
|
|
return;
|
2005-05-14 21:01:57 +00:00
|
|
|
case 30: case 31: /* Setup screenshot format dropdown */
|
|
|
|
ShowDropDownMenu(w, BuildDynamicDropdown(SPECSTR_SCREENSHOT_START, _num_screenshot_formats), _cur_screenshot_format, 31, 0, 0);
|
2004-08-09 17:04:08 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2004-09-10 19:02:27 +00:00
|
|
|
case WE_DROPDOWN_SELECT:
|
2006-09-23 02:39:24 +00:00
|
|
|
switch (e->we.dropdown.button) {
|
2005-01-03 21:05:03 +00:00
|
|
|
case 20: /* Vehicle design names */
|
2006-09-23 02:39:24 +00:00
|
|
|
if (e->we.dropdown.index == 0) {
|
2004-08-09 17:04:08 +00:00
|
|
|
DeleteCustomEngineNames();
|
|
|
|
MarkWholeScreenDirty();
|
2005-03-12 21:21:47 +00:00
|
|
|
} else if (!(_vehicle_design_names & 1)) {
|
2004-08-09 17:04:08 +00:00
|
|
|
LoadCustomEngineNames();
|
|
|
|
MarkWholeScreenDirty();
|
|
|
|
}
|
|
|
|
break;
|
2005-01-03 21:05:03 +00:00
|
|
|
case 5: /* Currency */
|
2006-09-23 02:39:24 +00:00
|
|
|
if (e->we.dropdown.index == CUSTOM_CURRENCY_ID) ShowCustCurrency();
|
|
|
|
_opt_ptr->currency = e->we.dropdown.index;
|
2004-08-09 17:04:08 +00:00
|
|
|
MarkWholeScreenDirty();
|
|
|
|
break;
|
2006-03-26 21:50:57 +00:00
|
|
|
case 8: /* Measuring units */
|
2006-09-23 02:39:24 +00:00
|
|
|
_opt_ptr->units = e->we.dropdown.index;
|
2004-08-09 17:04:08 +00:00
|
|
|
MarkWholeScreenDirty();
|
|
|
|
break;
|
2005-01-03 21:05:03 +00:00
|
|
|
case 11: /* Road side */
|
2006-09-23 02:39:24 +00:00
|
|
|
if (_opt_ptr->road_side != e->we.dropdown.index) { // only change if setting changed
|
|
|
|
DoCommandP(0, e->we.dropdown.index, 0, NULL, CMD_SET_ROAD_DRIVE_SIDE | CMD_MSG(STR_00B4_CAN_T_DO_THIS));
|
2005-01-23 13:45:20 +00:00
|
|
|
MarkWholeScreenDirty();
|
|
|
|
}
|
2004-08-09 17:04:08 +00:00
|
|
|
break;
|
2005-01-03 21:05:03 +00:00
|
|
|
case 14: /* Town names */
|
2005-05-12 00:18:30 +00:00
|
|
|
if (_game_mode == GM_MENU) {
|
2007-06-18 23:00:55 +00:00
|
|
|
for (uint i = 0; _town_names[i] != INVALID_STRING_ID; i++) {
|
|
|
|
if (_town_names[e->we.dropdown.index] == TownName(i)) {
|
|
|
|
_opt_ptr->town_name = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2005-05-12 00:18:30 +00:00
|
|
|
InvalidateWindow(WC_GAME_OPTIONS, 0);
|
|
|
|
}
|
2004-08-09 17:04:08 +00:00
|
|
|
break;
|
2005-01-03 21:05:03 +00:00
|
|
|
case 17: /* Autosave options */
|
2006-09-23 02:39:24 +00:00
|
|
|
_opt.autosave = _opt_newgame.autosave = e->we.dropdown.index;
|
2004-08-09 17:04:08 +00:00
|
|
|
SetWindowDirty(w);
|
|
|
|
break;
|
2005-01-03 21:05:03 +00:00
|
|
|
case 24: /* Change interface language */
|
2006-09-23 02:39:24 +00:00
|
|
|
ReadLanguagePack(e->we.dropdown.index);
|
2007-04-29 07:24:48 +00:00
|
|
|
UpdateAllStationVirtCoord();
|
2004-08-09 17:04:08 +00:00
|
|
|
MarkWholeScreenDirty();
|
|
|
|
break;
|
2005-01-03 21:05:03 +00:00
|
|
|
case 27: /* Change resolution */
|
2006-09-23 02:39:24 +00:00
|
|
|
if (e->we.dropdown.index < _num_resolutions && ChangeResInGame(_resolutions[e->we.dropdown.index][0],_resolutions[e->we.dropdown.index][1]))
|
2004-08-09 17:04:08 +00:00
|
|
|
SetWindowDirty(w);
|
|
|
|
break;
|
2005-01-03 21:05:03 +00:00
|
|
|
case 31: /* Change screenshot format */
|
2006-09-23 02:39:24 +00:00
|
|
|
SetScreenshotFormat(e->we.dropdown.index);
|
2004-08-09 17:04:08 +00:00
|
|
|
SetWindowDirty(w);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2004-12-22 13:19:26 +00:00
|
|
|
|
|
|
|
case WE_DESTROY:
|
|
|
|
DeleteWindowById(WC_CUSTOM_CURRENCY, 0);
|
|
|
|
break;
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
2004-12-22 13:19:26 +00:00
|
|
|
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
2005-05-12 00:18:30 +00:00
|
|
|
/** Change the side of the road vehicles drive on (server only).
|
2006-04-10 07:15:58 +00:00
|
|
|
* @param tile unused
|
2007-04-17 21:09:38 +00:00
|
|
|
* @param flags operation to perform
|
2005-05-12 00:18:30 +00:00
|
|
|
* @param p1 the side of the road; 0 = left side and 1 = right side
|
|
|
|
* @param p2 unused
|
|
|
|
*/
|
2007-06-18 10:48:15 +00:00
|
|
|
CommandCost CmdSetRoadDriveSide(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
2005-05-14 18:25:01 +00:00
|
|
|
/* Check boundaries and you can only change this if NO vehicles have been built yet,
|
|
|
|
* except in the intro-menu where of course it's always possible to do so. */
|
|
|
|
if (p1 > 1 || (_game_mode != GM_MENU && RoadVehiclesAreBuilt())) return CMD_ERROR;
|
2004-08-09 17:04:08 +00:00
|
|
|
|
|
|
|
if (flags & DC_EXEC) {
|
2005-05-12 00:18:30 +00:00
|
|
|
_opt_ptr->road_side = p1;
|
2004-08-09 17:04:08 +00:00
|
|
|
InvalidateWindow(WC_GAME_OPTIONS,0);
|
|
|
|
}
|
2007-06-18 19:53:50 +00:00
|
|
|
return CommandCost();
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static const Widget _game_options_widgets[] = {
|
2006-08-22 14:38:37 +00:00
|
|
|
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
|
|
|
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 369, 0, 13, STR_00B1_GAME_OPTIONS, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
|
|
|
{ WWT_PANEL, RESIZE_NONE, 14, 0, 369, 14, 238, 0x0, STR_NULL},
|
|
|
|
{ WWT_FRAME, RESIZE_NONE, 14, 10, 179, 20, 55, STR_02E0_CURRENCY_UNITS, STR_NULL},
|
2006-10-24 16:27:18 +00:00
|
|
|
{ WWT_INSET, RESIZE_NONE, 14, 20, 169, 34, 45, STR_02E1, STR_02E2_CURRENCY_UNITS_SELECTION},
|
2006-08-22 14:38:37 +00:00
|
|
|
{ WWT_TEXTBTN, RESIZE_NONE, 14, 158, 168, 35, 44, STR_0225, STR_02E2_CURRENCY_UNITS_SELECTION},
|
|
|
|
{ WWT_FRAME, RESIZE_NONE, 14, 190, 359, 20, 55, STR_MEASURING_UNITS, STR_NULL},
|
2006-10-24 16:27:18 +00:00
|
|
|
{ WWT_INSET, RESIZE_NONE, 14, 200, 349, 34, 45, STR_02E4, STR_MEASURING_UNITS_SELECTION},
|
2006-08-22 14:38:37 +00:00
|
|
|
{ WWT_TEXTBTN, RESIZE_NONE, 14, 338, 348, 35, 44, STR_0225, STR_MEASURING_UNITS_SELECTION},
|
|
|
|
{ WWT_FRAME, RESIZE_NONE, 14, 10, 179, 62, 97, STR_02E6_ROAD_VEHICLES, STR_NULL},
|
2006-10-24 16:27:18 +00:00
|
|
|
{ WWT_INSET, RESIZE_NONE, 14, 20, 169, 76, 87, STR_02E7, STR_02E8_SELECT_SIDE_OF_ROAD_FOR},
|
2006-08-22 14:38:37 +00:00
|
|
|
{ WWT_TEXTBTN, RESIZE_NONE, 14, 158, 168, 77, 86, STR_0225, STR_02E8_SELECT_SIDE_OF_ROAD_FOR},
|
|
|
|
{ WWT_FRAME, RESIZE_NONE, 14, 190, 359, 62, 97, STR_02EB_TOWN_NAMES, STR_NULL},
|
2006-10-24 16:27:18 +00:00
|
|
|
{ WWT_INSET, RESIZE_NONE, 14, 200, 349, 76, 87, STR_02EC, STR_02ED_SELECT_STYLE_OF_TOWN_NAMES},
|
2006-08-22 14:38:37 +00:00
|
|
|
{ WWT_TEXTBTN, RESIZE_NONE, 14, 338, 348, 77, 86, STR_0225, STR_02ED_SELECT_STYLE_OF_TOWN_NAMES},
|
|
|
|
{ WWT_FRAME, RESIZE_NONE, 14, 10, 179, 104, 139, STR_02F4_AUTOSAVE, STR_NULL},
|
2006-10-24 16:27:18 +00:00
|
|
|
{ WWT_INSET, RESIZE_NONE, 14, 20, 169, 118, 129, STR_02F5, STR_02F6_SELECT_INTERVAL_BETWEEN},
|
2006-08-22 14:38:37 +00:00
|
|
|
{ WWT_TEXTBTN, RESIZE_NONE, 14, 158, 168, 119, 128, STR_0225, STR_02F6_SELECT_INTERVAL_BETWEEN},
|
|
|
|
|
|
|
|
{ WWT_FRAME, RESIZE_NONE, 14, 10, 359, 194, 228, STR_02BC_VEHICLE_DESIGN_NAMES, STR_NULL},
|
2006-10-24 16:27:18 +00:00
|
|
|
{ WWT_INSET, RESIZE_NONE, 14, 20, 119, 207, 218, STR_02BD, STR_02C1_VEHICLE_DESIGN_NAMES_SELECTION},
|
2006-08-22 14:38:37 +00:00
|
|
|
{ WWT_TEXTBTN, RESIZE_NONE, 14, 108, 118, 208, 217, STR_0225, STR_02C1_VEHICLE_DESIGN_NAMES_SELECTION},
|
|
|
|
{ WWT_TEXTBTN, RESIZE_NONE, 14, 130, 349, 207, 218, STR_02C0_SAVE_CUSTOM_NAMES, STR_02C2_SAVE_CUSTOMIZED_VEHICLE},
|
|
|
|
|
|
|
|
{ WWT_FRAME, RESIZE_NONE, 14, 190, 359, 104, 139, STR_OPTIONS_LANG, STR_NULL},
|
2006-10-24 16:27:18 +00:00
|
|
|
{ WWT_INSET, RESIZE_NONE, 14, 200, 349, 118, 129, STR_OPTIONS_LANG_CBO, STR_OPTIONS_LANG_TIP},
|
2006-08-22 14:38:37 +00:00
|
|
|
{ WWT_TEXTBTN, RESIZE_NONE, 14, 338, 348, 119, 128, STR_0225, STR_OPTIONS_LANG_TIP},
|
|
|
|
|
|
|
|
{ WWT_FRAME, RESIZE_NONE, 14, 10, 179, 146, 190, STR_OPTIONS_RES, STR_NULL},
|
2006-10-24 16:27:18 +00:00
|
|
|
{ WWT_INSET, RESIZE_NONE, 14, 20, 169, 160, 171, STR_OPTIONS_RES_CBO, STR_OPTIONS_RES_TIP},
|
2006-08-22 14:38:37 +00:00
|
|
|
{ WWT_TEXTBTN, RESIZE_NONE, 14, 158, 168, 161, 170, STR_0225, STR_OPTIONS_RES_TIP},
|
|
|
|
{ WWT_TEXTBTN, RESIZE_NONE, 14, 149, 169, 176, 184, STR_EMPTY, STR_OPTIONS_FULLSCREEN_TIP},
|
|
|
|
|
|
|
|
{ WWT_FRAME, RESIZE_NONE, 14, 190, 359, 146, 190, STR_OPTIONS_SCREENSHOT_FORMAT, STR_NULL},
|
2006-10-24 16:27:18 +00:00
|
|
|
{ WWT_INSET, RESIZE_NONE, 14, 200, 349, 160, 171, STR_OPTIONS_SCREENSHOT_FORMAT_CBO, STR_OPTIONS_SCREENSHOT_FORMAT_TIP},
|
2006-08-22 14:38:37 +00:00
|
|
|
{ WWT_TEXTBTN, RESIZE_NONE, 14, 338, 348, 161, 170, STR_0225, STR_OPTIONS_SCREENSHOT_FORMAT_TIP},
|
2004-09-07 21:48:09 +00:00
|
|
|
|
|
|
|
{ WIDGETS_END},
|
2004-08-09 17:04:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const WindowDesc _game_options_desc = {
|
2007-07-27 12:49:04 +00:00
|
|
|
WDP_CENTER, WDP_CENTER, 370, 239, 370, 239,
|
2007-02-01 15:49:12 +00:00
|
|
|
WC_GAME_OPTIONS, WC_NONE,
|
2005-07-15 15:09:52 +00:00
|
|
|
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
|
2004-08-09 17:04:08 +00:00
|
|
|
_game_options_widgets,
|
|
|
|
GameOptionsWndProc
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-03-07 11:47:46 +00:00
|
|
|
void ShowGameOptions()
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
|
|
|
DeleteWindowById(WC_GAME_OPTIONS, 0);
|
|
|
|
AllocateWindowDesc(&_game_options_desc);
|
|
|
|
}
|
|
|
|
|
2007-03-07 12:11:48 +00:00
|
|
|
struct GameSettingData {
|
2004-08-09 17:04:08 +00:00
|
|
|
int16 min;
|
|
|
|
int16 max;
|
|
|
|
int16 step;
|
|
|
|
StringID str;
|
2007-03-07 12:11:48 +00:00
|
|
|
};
|
2004-08-09 17:04:08 +00:00
|
|
|
|
|
|
|
static const GameSettingData _game_setting_info[] = {
|
2005-03-12 21:21:47 +00:00
|
|
|
{ 0, 7, 1, STR_NULL},
|
|
|
|
{ 0, 3, 1, STR_6830_IMMEDIATE},
|
2007-05-01 17:16:51 +00:00
|
|
|
{ 0, 3, 1, STR_NUM_VERY_LOW},
|
|
|
|
{ 0, 4, 1, STR_26816_NONE},
|
2005-03-12 21:21:47 +00:00
|
|
|
{100, 500, 50, STR_NULL},
|
|
|
|
{ 2, 4, 1, STR_NULL},
|
|
|
|
{ 0, 2, 1, STR_6820_LOW},
|
|
|
|
{ 0, 4, 1, STR_681B_VERY_SLOW},
|
|
|
|
{ 0, 2, 1, STR_6820_LOW},
|
|
|
|
{ 0, 2, 1, STR_6823_NONE},
|
|
|
|
{ 0, 3, 1, STR_6826_X1_5},
|
|
|
|
{ 0, 2, 1, STR_6820_LOW},
|
|
|
|
{ 0, 3, 1, STR_682A_VERY_FLAT},
|
|
|
|
{ 0, 3, 1, STR_VERY_LOW},
|
|
|
|
{ 0, 1, 1, STR_682E_STEADY},
|
|
|
|
{ 0, 1, 1, STR_6834_AT_END_OF_LINE_AND_AT_STATIONS},
|
|
|
|
{ 0, 1, 1, STR_6836_OFF},
|
|
|
|
{ 0, 2, 1, STR_6839_PERMISSIVE},
|
2004-08-09 17:04:08 +00:00
|
|
|
};
|
|
|
|
|
2005-02-18 22:17:33 +00:00
|
|
|
/*
|
2006-09-04 20:40:33 +00:00
|
|
|
* A: competitors
|
|
|
|
* B: start time in months / 3
|
2007-05-01 17:16:51 +00:00
|
|
|
* C: town count (2 = high, 0 = very low)
|
|
|
|
* D: industry count (4 = high, 0 = none)
|
2006-09-04 20:40:33 +00:00
|
|
|
* E: inital loan / 1000 (in GBP)
|
|
|
|
* F: interest rate
|
|
|
|
* G: running costs (0 = low, 2 = high)
|
|
|
|
* H: construction speed of competitors (0 = very slow, 4 = very fast)
|
|
|
|
* I: intelligence (0-2)
|
|
|
|
* J: breakdowns (0 = off, 2 = normal)
|
|
|
|
* K: subsidy multiplier (0 = 1.5, 3 = 4.0)
|
|
|
|
* L: construction cost (0-2)
|
|
|
|
* M: terrain type (0 = very flat, 3 = mountainous)
|
|
|
|
* N: amount of water (0 = very low, 3 = high)
|
|
|
|
* O: economy (0 = steady, 1 = fluctuating)
|
|
|
|
* P: Train reversing (0 = end of line + stations, 1 = end of line)
|
|
|
|
* Q: disasters
|
|
|
|
* R: area restructuring (0 = permissive, 2 = hostile)
|
|
|
|
*/
|
2007-10-16 21:15:34 +00:00
|
|
|
static const GDType _default_game_diff[3][GAME_DIFFICULTY_NUM] = { /*
|
2005-02-18 22:17:33 +00:00
|
|
|
A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R*/
|
2007-05-01 17:16:51 +00:00
|
|
|
{2, 2, 1, 4, 300, 2, 0, 2, 0, 1, 2, 0, 1, 0, 0, 0, 0, 0}, ///< easy
|
|
|
|
{4, 1, 1, 3, 150, 3, 1, 3, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1}, ///< medium
|
|
|
|
{7, 0, 0, 2, 100, 4, 1, 3, 2, 2, 0, 2, 3, 2, 1, 1, 1, 2}, ///< hard
|
2004-08-09 17:04:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
void SetDifficultyLevel(int mode, GameOptions *gm_opt)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
assert(mode <= 3);
|
|
|
|
|
|
|
|
gm_opt->diff_level = mode;
|
|
|
|
if (mode != 3) { // not custom
|
2005-03-12 21:21:47 +00:00
|
|
|
for (i = 0; i != GAME_DIFFICULTY_NUM; i++)
|
2007-10-16 21:15:34 +00:00
|
|
|
((GDType*)&gm_opt->diff)[i] = _default_game_diff[mode][i];
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-03-25 19:21:22 +00:00
|
|
|
/**
|
|
|
|
* Checks the difficulty levels read from the configuration and
|
|
|
|
* forces them to be correct when invalid.
|
|
|
|
*/
|
|
|
|
void CheckDifficultyLevels()
|
|
|
|
{
|
|
|
|
if (_opt_newgame.diff_level != 3) {
|
|
|
|
SetDifficultyLevel(_opt_newgame.diff_level, &_opt_newgame);
|
|
|
|
} else {
|
|
|
|
for (uint i = 0; i < GAME_DIFFICULTY_NUM; i++) {
|
2007-10-16 21:15:34 +00:00
|
|
|
GDType *diff = ((GDType*)&_opt_newgame.diff) + i;
|
2007-11-19 18:38:10 +00:00
|
|
|
*diff = Clamp(*diff, _game_setting_info[i].min, _game_setting_info[i].max);
|
2007-03-25 19:21:22 +00:00
|
|
|
*diff -= *diff % _game_setting_info[i].step;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-03-07 11:47:46 +00:00
|
|
|
extern void StartupEconomy();
|
2004-08-13 21:48:04 +00:00
|
|
|
|
2005-01-11 00:54:06 +00:00
|
|
|
enum {
|
|
|
|
GAMEDIFF_WND_TOP_OFFSET = 45,
|
|
|
|
GAMEDIFF_WND_ROWSIZE = 9
|
|
|
|
};
|
|
|
|
|
2007-04-04 01:35:16 +00:00
|
|
|
/* Temporary holding place of values in the difficulty window until 'Save' is clicked */
|
2005-03-12 21:21:47 +00:00
|
|
|
static GameOptions _opt_mod_temp;
|
|
|
|
// 0x383E = (1 << 13) | (1 << 12) | (1 << 11) | (1 << 5) | (1 << 4) | (1 << 3) | (1 << 2) | (1 << 1)
|
|
|
|
#define DIFF_INGAME_DISABLED_BUTTONS 0x383E
|
|
|
|
|
2004-08-09 17:04:08 +00:00
|
|
|
static void GameDifficultyWndProc(Window *w, WindowEvent *e)
|
|
|
|
{
|
2005-03-12 21:21:47 +00:00
|
|
|
switch (e->event) {
|
2006-10-03 02:08:15 +00:00
|
|
|
case WE_CREATE: // Setup disabled buttons when creating window
|
|
|
|
/* disable all other difficulty buttons during gameplay except for 'custom' */
|
|
|
|
SetWindowWidgetDisabledState(w, 3, _game_mode == GM_NORMAL);
|
|
|
|
SetWindowWidgetDisabledState(w, 4, _game_mode == GM_NORMAL);
|
|
|
|
SetWindowWidgetDisabledState(w, 5, _game_mode == GM_NORMAL);
|
|
|
|
SetWindowWidgetDisabledState(w, 6, _game_mode == GM_NORMAL);
|
|
|
|
SetWindowWidgetDisabledState(w, 7, _game_mode == GM_EDITOR || _networking); // highscore chart in multiplayer
|
|
|
|
SetWindowWidgetDisabledState(w, 10, _networking && !_network_server); // Save-button in multiplayer (and if client)
|
2007-03-11 14:56:35 +00:00
|
|
|
LowerWindowWidget(w, _opt_mod_temp.diff_level + 3);
|
2005-01-31 11:36:16 +00:00
|
|
|
|
2005-05-12 00:18:30 +00:00
|
|
|
break;
|
|
|
|
case WE_PAINT: {
|
|
|
|
uint32 click_a, click_b, disabled;
|
|
|
|
int i;
|
|
|
|
int y, value;
|
2005-01-13 16:28:47 +00:00
|
|
|
|
2004-08-09 17:04:08 +00:00
|
|
|
DrawWindowWidgets(w);
|
|
|
|
|
|
|
|
click_a = _difficulty_click_a;
|
|
|
|
click_b = _difficulty_click_b;
|
|
|
|
|
2005-03-12 21:21:47 +00:00
|
|
|
/* XXX - Disabled buttons in normal gameplay. Bitshifted for each button to see if
|
|
|
|
* that bit is set. If it is set, the button is disabled */
|
|
|
|
disabled = (_game_mode == GM_NORMAL) ? DIFF_INGAME_DISABLED_BUTTONS : 0;
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2005-01-11 00:54:06 +00:00
|
|
|
y = GAMEDIFF_WND_TOP_OFFSET;
|
2004-08-09 17:04:08 +00:00
|
|
|
for (i = 0; i != GAME_DIFFICULTY_NUM; i++) {
|
2007-11-19 21:02:30 +00:00
|
|
|
DrawFrameRect( 5, y, 5 + 8, y + 8, 3, HasBit(click_a, i) ? FR_LOWERED : FR_NONE);
|
|
|
|
DrawFrameRect(15, y, 15 + 8, y + 8, 3, HasBit(click_b, i) ? FR_LOWERED : FR_NONE);
|
|
|
|
if (HasBit(disabled, i) || (_networking && !_network_server)) {
|
2007-01-14 19:57:49 +00:00
|
|
|
int color = (1 << PALETTE_MODIFIER_GREYOUT) | _colour_gradient[COLOUR_YELLOW][2];
|
2005-03-12 21:21:47 +00:00
|
|
|
GfxFillRect( 6, y + 1, 6 + 8, y + 8, color);
|
|
|
|
GfxFillRect(16, y + 1, 16 + 8, y + 8, color);
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
2007-11-04 00:08:57 +00:00
|
|
|
DrawStringCentered(10, y, STR_6819, TC_FROMSTRING);
|
|
|
|
DrawStringCentered(20, y, STR_681A, TC_FROMSTRING);
|
2004-08-09 17:04:08 +00:00
|
|
|
|
|
|
|
|
2007-10-16 21:15:34 +00:00
|
|
|
value = _game_setting_info[i].str + ((GDType*)&_opt_mod_temp.diff)[i];
|
2005-03-12 21:21:47 +00:00
|
|
|
if (i == 4) value *= 1000; // XXX - handle currency option
|
2004-12-02 22:53:07 +00:00
|
|
|
SetDParam(0, value);
|
2007-11-04 00:08:57 +00:00
|
|
|
DrawString(30, y, STR_6805_MAXIMUM_NO_COMPETITORS + i, TC_FROMSTRING);
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2005-01-11 00:54:06 +00:00
|
|
|
y += GAMEDIFF_WND_ROWSIZE + 2; // space items apart a bit
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
} break;
|
|
|
|
|
|
|
|
case WE_CLICK:
|
2006-09-23 02:39:24 +00:00
|
|
|
switch (e->we.click.widget) {
|
2005-03-12 21:21:47 +00:00
|
|
|
case 8: { /* Difficulty settings widget, decode click */
|
|
|
|
const GameSettingData *info;
|
|
|
|
int x, y;
|
2004-08-09 17:04:08 +00:00
|
|
|
uint btn, dis;
|
2007-01-11 11:05:01 +00:00
|
|
|
int16 val;
|
2004-09-10 19:02:27 +00:00
|
|
|
|
2007-04-04 01:35:16 +00:00
|
|
|
/* Don't allow clients to make any changes */
|
2004-12-04 17:54:56 +00:00
|
|
|
if (_networking && !_network_server)
|
|
|
|
return;
|
|
|
|
|
2006-09-23 02:39:24 +00:00
|
|
|
x = e->we.click.pt.x - 5;
|
2007-11-24 10:38:43 +00:00
|
|
|
if (!IsInsideMM(x, 0, 21)) // Button area
|
2004-08-09 17:04:08 +00:00
|
|
|
return;
|
|
|
|
|
2006-09-23 02:39:24 +00:00
|
|
|
y = e->we.click.pt.y - GAMEDIFF_WND_TOP_OFFSET;
|
2004-08-09 17:04:08 +00:00
|
|
|
if (y < 0)
|
|
|
|
return;
|
|
|
|
|
2007-04-04 01:35:16 +00:00
|
|
|
/* Get button from Y coord. */
|
2005-01-11 00:54:06 +00:00
|
|
|
btn = y / (GAMEDIFF_WND_ROWSIZE + 2);
|
|
|
|
if (btn >= GAME_DIFFICULTY_NUM || y % (GAMEDIFF_WND_ROWSIZE + 2) >= 9)
|
2004-08-09 17:04:08 +00:00
|
|
|
return;
|
|
|
|
|
2007-04-04 01:35:16 +00:00
|
|
|
/* Clicked disabled button? */
|
2005-03-12 21:21:47 +00:00
|
|
|
dis = (_game_mode == GM_NORMAL) ? DIFF_INGAME_DISABLED_BUTTONS : 0;
|
2005-01-11 00:54:06 +00:00
|
|
|
|
2007-11-19 21:02:30 +00:00
|
|
|
if (HasBit(dis, btn))
|
2004-08-09 17:04:08 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
_difficulty_timeout = 5;
|
|
|
|
|
2007-10-16 21:15:34 +00:00
|
|
|
val = ((GDType*)&_opt_mod_temp.diff)[btn];
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2005-03-12 21:21:47 +00:00
|
|
|
info = &_game_setting_info[btn]; // get information about the difficulty setting
|
2004-08-09 17:04:08 +00:00
|
|
|
if (x >= 10) {
|
|
|
|
// Increase button clicked
|
|
|
|
val = min(val + info->step, info->max);
|
2007-11-20 13:35:54 +00:00
|
|
|
SetBit(_difficulty_click_b, btn);
|
2004-08-09 17:04:08 +00:00
|
|
|
} else {
|
|
|
|
// Decrease button clicked
|
2007-01-11 11:05:01 +00:00
|
|
|
val -= info->step;
|
|
|
|
val = max(val, info->min);
|
2007-11-20 13:35:54 +00:00
|
|
|
SetBit(_difficulty_click_a, btn);
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// save value in temporary variable
|
2007-10-16 21:15:34 +00:00
|
|
|
((GDType*)&_opt_mod_temp.diff)[btn] = val;
|
2007-04-16 10:30:31 +00:00
|
|
|
RaiseWindowWidget(w, _opt_mod_temp.diff_level + 3);
|
2004-08-09 17:04:08 +00:00
|
|
|
SetDifficultyLevel(3, &_opt_mod_temp); // set difficulty level to custom
|
2007-04-16 10:30:31 +00:00
|
|
|
LowerWindowWidget(w, _opt_mod_temp.diff_level + 3);
|
2004-08-09 17:04:08 +00:00
|
|
|
SetWindowDirty(w);
|
2007-04-18 22:41:53 +00:00
|
|
|
} break;
|
2005-01-11 00:54:06 +00:00
|
|
|
case 3: case 4: case 5: case 6: /* Easy / Medium / Hard / Custom */
|
2004-08-09 17:04:08 +00:00
|
|
|
// temporarily change difficulty level
|
2006-10-03 20:16:20 +00:00
|
|
|
RaiseWindowWidget(w, _opt_mod_temp.diff_level + 3);
|
2006-09-23 02:39:24 +00:00
|
|
|
SetDifficultyLevel(e->we.click.widget - 3, &_opt_mod_temp);
|
2006-10-03 20:16:20 +00:00
|
|
|
LowerWindowWidget(w, _opt_mod_temp.diff_level + 3);
|
2004-08-09 17:04:08 +00:00
|
|
|
SetWindowDirty(w);
|
|
|
|
break;
|
2005-01-11 00:54:06 +00:00
|
|
|
case 7: /* Highscore Table */
|
|
|
|
ShowHighscoreTable(_opt_mod_temp.diff_level, -1);
|
2004-08-09 17:04:08 +00:00
|
|
|
break;
|
2005-01-11 00:54:06 +00:00
|
|
|
case 10: { /* Save button - save changes */
|
2007-10-16 21:15:34 +00:00
|
|
|
GDType btn, val;
|
2004-08-09 17:04:08 +00:00
|
|
|
for (btn = 0; btn != GAME_DIFFICULTY_NUM; btn++) {
|
2007-10-16 21:15:34 +00:00
|
|
|
val = ((GDType*)&_opt_mod_temp.diff)[btn];
|
2004-08-09 17:04:08 +00:00
|
|
|
// if setting has changed, change it
|
2007-10-16 21:15:34 +00:00
|
|
|
if (val != ((GDType*)&_opt_ptr->diff)[btn])
|
2004-08-09 17:04:08 +00:00
|
|
|
DoCommandP(0, btn, val, NULL, CMD_CHANGE_DIFFICULTY_LEVEL);
|
|
|
|
}
|
2007-01-10 18:56:51 +00:00
|
|
|
DoCommandP(0, UINT_MAX, _opt_mod_temp.diff_level, NULL, CMD_CHANGE_DIFFICULTY_LEVEL);
|
2004-08-09 17:04:08 +00:00
|
|
|
DeleteWindow(w);
|
2004-08-13 19:18:53 +00:00
|
|
|
// If we are in the editor, we should reload the economy.
|
|
|
|
// This way when you load a game, the max loan and interest rate
|
|
|
|
// are loaded correctly.
|
|
|
|
if (_game_mode == GM_EDITOR)
|
|
|
|
StartupEconomy();
|
2004-08-09 17:04:08 +00:00
|
|
|
break;
|
|
|
|
}
|
2005-03-12 21:21:47 +00:00
|
|
|
case 11: /* Cancel button - close window, abandon changes */
|
2004-08-09 17:04:08 +00:00
|
|
|
DeleteWindow(w);
|
|
|
|
break;
|
2005-03-12 21:21:47 +00:00
|
|
|
} break;
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2005-03-12 21:21:47 +00:00
|
|
|
case WE_MOUSELOOP: /* Handle the visual 'clicking' of the buttons */
|
2004-08-09 17:04:08 +00:00
|
|
|
if (_difficulty_timeout != 0 && !--_difficulty_timeout) {
|
|
|
|
_difficulty_click_a = 0;
|
|
|
|
_difficulty_click_b = 0;
|
|
|
|
SetWindowDirty(w);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-03-12 21:21:47 +00:00
|
|
|
#undef DIFF_INGAME_DISABLED_BUTTONS
|
|
|
|
|
2004-08-09 17:04:08 +00:00
|
|
|
static const Widget _game_difficulty_widgets[] = {
|
2006-08-22 14:38:37 +00:00
|
|
|
{ WWT_CLOSEBOX, RESIZE_NONE, 10, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
|
|
|
{ WWT_CAPTION, RESIZE_NONE, 10, 11, 369, 0, 13, STR_6800_DIFFICULTY_LEVEL, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
|
|
|
{ WWT_PANEL, RESIZE_NONE, 10, 0, 369, 14, 29, 0x0, STR_NULL},
|
|
|
|
{ WWT_PUSHTXTBTN, RESIZE_NONE, 3, 10, 96, 16, 27, STR_6801_EASY, STR_NULL},
|
|
|
|
{ WWT_PUSHTXTBTN, RESIZE_NONE, 3, 97, 183, 16, 27, STR_6802_MEDIUM, STR_NULL},
|
|
|
|
{ WWT_PUSHTXTBTN, RESIZE_NONE, 3, 184, 270, 16, 27, STR_6803_HARD, STR_NULL},
|
|
|
|
{ WWT_PUSHTXTBTN, RESIZE_NONE, 3, 271, 357, 16, 27, STR_6804_CUSTOM, STR_NULL},
|
|
|
|
{ WWT_TEXTBTN, RESIZE_NONE, 10, 0, 369, 30, 41, STR_6838_SHOW_HI_SCORE_CHART, STR_NULL},
|
|
|
|
{ WWT_PANEL, RESIZE_NONE, 10, 0, 369, 42, 262, 0x0, STR_NULL},
|
|
|
|
{ WWT_PANEL, RESIZE_NONE, 10, 0, 369, 263, 278, 0x0, STR_NULL},
|
|
|
|
{ WWT_PUSHTXTBTN, RESIZE_NONE, 3, 105, 185, 265, 276, STR_OPTIONS_SAVE_CHANGES, STR_NULL},
|
|
|
|
{ WWT_PUSHTXTBTN, RESIZE_NONE, 3, 186, 266, 265, 276, STR_012E_CANCEL, STR_NULL},
|
2004-09-07 21:48:09 +00:00
|
|
|
{ WIDGETS_END},
|
2004-08-09 17:04:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const WindowDesc _game_difficulty_desc = {
|
2007-07-27 12:49:04 +00:00
|
|
|
WDP_CENTER, WDP_CENTER, 370, 279, 370, 279,
|
2007-02-01 15:49:12 +00:00
|
|
|
WC_GAME_OPTIONS, WC_NONE,
|
2004-08-09 17:04:08 +00:00
|
|
|
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
|
|
|
|
_game_difficulty_widgets,
|
|
|
|
GameDifficultyWndProc
|
|
|
|
};
|
|
|
|
|
2007-03-07 11:47:46 +00:00
|
|
|
void ShowGameDifficulty()
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
|
|
|
DeleteWindowById(WC_GAME_OPTIONS, 0);
|
2005-03-12 21:21:47 +00:00
|
|
|
/* Copy current settings (ingame or in intro) to temporary holding place
|
|
|
|
* change that when setting stuff, copy back on clicking 'OK' */
|
2006-11-05 08:24:52 +00:00
|
|
|
_opt_mod_temp = *_opt_ptr;
|
2004-08-09 17:04:08 +00:00
|
|
|
AllocateWindowDesc(&_game_difficulty_desc);
|
2004-09-10 19:02:27 +00:00
|
|
|
}
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2006-03-17 22:47:52 +00:00
|
|
|
static const char *_patches_ui[] = {
|
|
|
|
"vehicle_speed",
|
|
|
|
"status_long_date",
|
|
|
|
"show_finances",
|
|
|
|
"autoscroll",
|
|
|
|
"reverse_scroll",
|
2007-05-28 16:46:16 +00:00
|
|
|
"smooth_scroll",
|
2006-03-17 22:47:52 +00:00
|
|
|
"errmsg_duration",
|
|
|
|
"toolbar_pos",
|
2006-10-12 15:13:40 +00:00
|
|
|
"measure_tooltip",
|
2006-03-17 22:47:52 +00:00
|
|
|
"window_snap_radius",
|
|
|
|
"invisible_trees",
|
|
|
|
"population_in_label",
|
|
|
|
"link_terraform_toolbar",
|
2006-09-17 20:52:54 +00:00
|
|
|
"liveries",
|
2006-11-16 20:57:23 +00:00
|
|
|
"prefer_teamchat",
|
2007-03-11 10:55:35 +00:00
|
|
|
/* While the horizontal scrollwheel scrolling is written as general code, only
|
|
|
|
* the cocoa (OSX) driver generates input for it.
|
2007-03-11 21:53:46 +00:00
|
|
|
* Since it's also able to completely disable the scrollwheel will we display it on all platforms anyway */
|
2007-03-11 10:55:35 +00:00
|
|
|
"scrollwheel_scrolling",
|
|
|
|
"scrollwheel_multiplier",
|
2007-08-29 08:20:04 +00:00
|
|
|
#ifdef __APPLE__
|
|
|
|
/* We might need to emulate a right mouse button on mac */
|
|
|
|
"right_mouse_btn_emulation",
|
|
|
|
#endif
|
2007-04-28 15:06:32 +00:00
|
|
|
"pause_on_newgame",
|
2007-05-19 09:40:18 +00:00
|
|
|
"advanced_vehicle_list",
|
2007-06-21 16:17:47 +00:00
|
|
|
"loading_indicators",
|
2007-06-20 19:17:22 +00:00
|
|
|
"timetable_in_ticks",
|
2007-06-25 19:13:55 +00:00
|
|
|
"default_rail_type",
|
2007-06-27 14:15:48 +00:00
|
|
|
"always_build_infrastructure",
|
2004-08-11 21:48:27 +00:00
|
|
|
};
|
|
|
|
|
2006-03-17 22:47:52 +00:00
|
|
|
static const char *_patches_construction[] = {
|
|
|
|
"build_on_slopes",
|
2007-09-14 22:27:40 +00:00
|
|
|
"autoslope",
|
2006-03-17 22:47:52 +00:00
|
|
|
"extra_dynamite",
|
|
|
|
"longbridges",
|
|
|
|
"signal_side",
|
|
|
|
"always_small_airport",
|
|
|
|
"drag_signals_density",
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
"oil_refinery_limit",
|
2007-01-15 22:18:35 +00:00
|
|
|
"semaphore_build_before",
|
2006-03-17 22:47:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const char *_patches_stations[] = {
|
|
|
|
"join_stations",
|
|
|
|
"full_load_any",
|
|
|
|
"improved_load",
|
|
|
|
"selectgoods",
|
|
|
|
"new_nonstop",
|
|
|
|
"nonuniform_stations",
|
|
|
|
"station_spread",
|
|
|
|
"serviceathelipad",
|
|
|
|
"modified_catchment",
|
2006-12-02 16:56:32 +00:00
|
|
|
"gradual_loading",
|
2007-02-14 16:37:16 +00:00
|
|
|
"road_stop_on_town_road",
|
2007-05-23 17:33:03 +00:00
|
|
|
"adjacent_stations",
|
2006-03-17 22:47:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const char *_patches_economy[] = {
|
|
|
|
"inflation",
|
2007-07-06 07:24:10 +00:00
|
|
|
"raw_industry_construction",
|
2006-03-17 22:47:52 +00:00
|
|
|
"multiple_industry_per_town",
|
|
|
|
"same_industry_close",
|
|
|
|
"bribe",
|
2007-09-30 17:38:42 +00:00
|
|
|
"exclusive_rights",
|
|
|
|
"give_money",
|
2006-08-15 14:52:17 +00:00
|
|
|
"colored_news_year",
|
|
|
|
"ending_year",
|
2006-03-17 22:47:52 +00:00
|
|
|
"smooth_economy",
|
|
|
|
"allow_shares",
|
2007-09-26 16:12:43 +00:00
|
|
|
"town_layout",
|
|
|
|
"mod_road_rebuild",
|
2007-04-12 17:24:34 +00:00
|
|
|
"town_growth_rate",
|
|
|
|
"larger_towns",
|
2007-04-18 14:23:30 +00:00
|
|
|
"initial_city_size",
|
2006-03-17 22:47:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const char *_patches_ai[] = {
|
|
|
|
"ainew_active",
|
|
|
|
"ai_in_multiplayer",
|
|
|
|
"ai_disable_veh_train",
|
|
|
|
"ai_disable_veh_roadveh",
|
|
|
|
"ai_disable_veh_aircraft",
|
|
|
|
"ai_disable_veh_ship",
|
|
|
|
};
|
|
|
|
|
|
|
|
static const char *_patches_vehicles[] = {
|
|
|
|
"realistic_acceleration",
|
|
|
|
"forbid_90_deg",
|
|
|
|
"mammoth_trains",
|
|
|
|
"gotodepot",
|
|
|
|
"roadveh_queue",
|
|
|
|
"new_pathfinding_all",
|
2006-05-27 16:12:16 +00:00
|
|
|
"yapf.ship_use_yapf",
|
|
|
|
"yapf.road_use_yapf",
|
|
|
|
"yapf.rail_use_yapf",
|
2006-03-17 22:47:52 +00:00
|
|
|
"train_income_warn",
|
|
|
|
"order_review_system",
|
|
|
|
"never_expire_vehicles",
|
2006-10-17 16:16:19 +00:00
|
|
|
"lost_train_warn",
|
2006-03-17 22:47:52 +00:00
|
|
|
"autorenew",
|
|
|
|
"autorenew_months",
|
|
|
|
"autorenew_money",
|
|
|
|
"max_trains",
|
|
|
|
"max_roadveh",
|
|
|
|
"max_aircraft",
|
|
|
|
"max_ships",
|
|
|
|
"servint_ispercent",
|
|
|
|
"servint_trains",
|
|
|
|
"servint_roadveh",
|
|
|
|
"servint_ships",
|
|
|
|
"servint_aircraft",
|
|
|
|
"no_servicing_if_no_breakdowns",
|
|
|
|
"wagon_speed_limits",
|
2006-11-17 19:31:44 +00:00
|
|
|
"disable_elrails",
|
2006-11-27 23:11:56 +00:00
|
|
|
"freight_trains",
|
2007-06-20 19:17:22 +00:00
|
|
|
"timetabling",
|
2006-03-17 22:47:52 +00:00
|
|
|
};
|
|
|
|
|
2007-03-07 12:11:48 +00:00
|
|
|
struct PatchEntry {
|
2006-03-17 22:47:52 +00:00
|
|
|
const SettingDesc *setting;
|
|
|
|
uint index;
|
2007-03-07 12:11:48 +00:00
|
|
|
};
|
2006-03-17 22:47:52 +00:00
|
|
|
|
2007-03-07 12:11:48 +00:00
|
|
|
struct PatchPage {
|
2006-03-17 22:47:52 +00:00
|
|
|
const char **names;
|
|
|
|
PatchEntry *entries;
|
2006-03-02 01:41:25 +00:00
|
|
|
byte num;
|
2007-03-07 12:11:48 +00:00
|
|
|
};
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2006-03-17 22:47:52 +00:00
|
|
|
/* PatchPage holds the categories, the number of elements in each category
|
|
|
|
* and (in NULL) a dynamic array of settings based on the string-representations
|
|
|
|
* of the settings. This way there is no worry about indeces, and such */
|
|
|
|
static PatchPage _patches_page[] = {
|
|
|
|
{_patches_ui, NULL, lengthof(_patches_ui)},
|
|
|
|
{_patches_construction, NULL, lengthof(_patches_construction)},
|
|
|
|
{_patches_vehicles, NULL, lengthof(_patches_vehicles)},
|
|
|
|
{_patches_stations, NULL, lengthof(_patches_stations)},
|
|
|
|
{_patches_economy, NULL, lengthof(_patches_economy)},
|
|
|
|
{_patches_ai, NULL, lengthof(_patches_ai)},
|
2004-08-09 17:04:08 +00:00
|
|
|
};
|
|
|
|
|
2006-03-02 01:41:25 +00:00
|
|
|
/** The main patches window. Shows a number of categories on top and
|
|
|
|
* a selection of patches in that category.
|
|
|
|
* Uses WP(w, def_d) macro - data_1, data_2, data_3 */
|
2004-08-09 17:04:08 +00:00
|
|
|
static void PatchesSelectionWndProc(Window *w, WindowEvent *e)
|
|
|
|
{
|
2006-03-02 01:41:25 +00:00
|
|
|
static Patches *patches_ptr;
|
|
|
|
|
2005-05-02 16:01:53 +00:00
|
|
|
switch (e->event) {
|
2006-03-14 22:56:22 +00:00
|
|
|
case WE_CREATE: {
|
2006-03-17 22:47:52 +00:00
|
|
|
static bool first_time = true;
|
|
|
|
|
2006-03-02 02:22:15 +00:00
|
|
|
patches_ptr = (_game_mode == GM_MENU) ? &_patches_newgame : &_patches;
|
2006-03-17 22:47:52 +00:00
|
|
|
|
|
|
|
/* Build up the dynamic settings-array only once per OpenTTD session */
|
|
|
|
if (first_time) {
|
|
|
|
PatchPage *page;
|
|
|
|
for (page = &_patches_page[0]; page != endof(_patches_page); page++) {
|
|
|
|
uint i;
|
|
|
|
|
2007-01-11 17:29:39 +00:00
|
|
|
page->entries = MallocT<PatchEntry>(page->num);
|
2006-03-17 22:47:52 +00:00
|
|
|
for (i = 0; i != page->num; i++) {
|
|
|
|
uint index;
|
|
|
|
const SettingDesc *sd = GetPatchFromName(page->names[i], &index);
|
|
|
|
assert(sd != NULL);
|
|
|
|
|
|
|
|
page->entries[i].setting = sd;
|
|
|
|
page->entries[i].index = index;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
first_time = false;
|
|
|
|
}
|
2006-10-03 20:16:20 +00:00
|
|
|
LowerWindowWidget(w, 4);
|
2006-03-14 22:56:22 +00:00
|
|
|
} break;
|
2006-03-02 01:41:25 +00:00
|
|
|
|
2004-08-09 17:04:08 +00:00
|
|
|
case WE_PAINT: {
|
2006-03-02 01:41:25 +00:00
|
|
|
int x, y;
|
|
|
|
const PatchPage *page = &_patches_page[WP(w,def_d).data_1];
|
2005-11-14 19:48:04 +00:00
|
|
|
uint i;
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2006-03-02 01:41:25 +00:00
|
|
|
/* Set up selected category */
|
2004-08-09 17:04:08 +00:00
|
|
|
DrawWindowWidgets(w);
|
|
|
|
|
2006-03-02 01:41:25 +00:00
|
|
|
x = 5;
|
|
|
|
y = 47;
|
2006-03-17 22:47:52 +00:00
|
|
|
for (i = 0; i != page->num; i++) {
|
|
|
|
const SettingDesc *sd = page->entries[i].setting;
|
2006-03-02 01:41:25 +00:00
|
|
|
const SettingDescBase *sdb = &sd->desc;
|
2006-11-21 20:20:30 +00:00
|
|
|
const void *var = GetVariableAddress(patches_ptr, &sd->save);
|
2004-12-04 17:54:56 +00:00
|
|
|
bool editable = true;
|
2006-03-02 01:41:25 +00:00
|
|
|
bool disabled = false;
|
2005-01-13 16:28:47 +00:00
|
|
|
|
2004-12-04 17:54:56 +00:00
|
|
|
// We do not allow changes of some items when we are a client in a networkgame
|
2006-03-02 01:41:25 +00:00
|
|
|
if (!(sd->save.conv & SLF_NETWORK_NO) && _networking && !_network_server) editable = false;
|
|
|
|
if ((sdb->flags & SGF_NETWORK_ONLY) && !_networking) editable = false;
|
2007-11-17 22:25:16 +00:00
|
|
|
if ((sdb->flags & SGF_NO_NETWORK) && _networking) editable = false;
|
2006-03-02 01:41:25 +00:00
|
|
|
|
|
|
|
if (sdb->cmd == SDT_BOOLX) {
|
2006-03-02 09:57:28 +00:00
|
|
|
static const int _bool_ctabs[2][2] = {{9, 4}, {7, 6}};
|
2006-03-02 01:41:25 +00:00
|
|
|
/* Draw checkbox for boolean-value either on/off */
|
|
|
|
bool on = (*(bool*)var);
|
|
|
|
|
2007-01-10 18:56:51 +00:00
|
|
|
DrawFrameRect(x, y, x + 19, y + 8, _bool_ctabs[!!on][!!editable], on ? FR_LOWERED : FR_NONE);
|
2006-03-02 01:41:25 +00:00
|
|
|
SetDParam(0, on ? STR_CONFIG_PATCHES_ON : STR_CONFIG_PATCHES_OFF);
|
2004-08-09 17:04:08 +00:00
|
|
|
} else {
|
2006-03-02 01:41:25 +00:00
|
|
|
int32 value;
|
|
|
|
|
|
|
|
value = (int32)ReadValue(var, sd->save.conv);
|
|
|
|
|
2006-08-02 18:36:53 +00:00
|
|
|
/* Draw [<][>] boxes for settings of an integer-type */
|
|
|
|
DrawArrowButtons(x, y, 3, WP(w,def_d).data_2 - (i * 2), (editable && value != sdb->min), (editable && value != sdb->max));
|
|
|
|
|
2006-03-02 01:41:25 +00:00
|
|
|
disabled = (value == 0) && (sdb->flags & SGF_0ISDISABLED);
|
2004-08-10 17:06:10 +00:00
|
|
|
if (disabled) {
|
2004-12-02 22:53:07 +00:00
|
|
|
SetDParam(0, STR_CONFIG_PATCHES_DISABLED);
|
2004-08-09 17:04:08 +00:00
|
|
|
} else {
|
2006-03-02 01:41:25 +00:00
|
|
|
if (sdb->flags & SGF_CURRENCY) {
|
2004-12-02 22:53:07 +00:00
|
|
|
SetDParam(0, STR_CONFIG_PATCHES_CURRENCY);
|
2006-03-02 01:41:25 +00:00
|
|
|
} else if (sdb->flags & SGF_MULTISTRING) {
|
|
|
|
SetDParam(0, sdb->str + value + 1);
|
|
|
|
} else {
|
|
|
|
SetDParam(0, (sdb->flags & SGF_NOCOMMA) ? STR_CONFIG_PATCHES_INT32 : STR_7024);
|
2004-08-14 19:55:36 +00:00
|
|
|
}
|
2006-03-02 01:41:25 +00:00
|
|
|
SetDParam(1, value);
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
}
|
2007-11-04 00:08:57 +00:00
|
|
|
DrawString(30, y, (sdb->str) + disabled, TC_FROMSTRING);
|
2004-08-09 17:04:08 +00:00
|
|
|
y += 11;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case WE_CLICK:
|
2006-09-23 02:39:24 +00:00
|
|
|
switch (e->we.click.widget) {
|
2004-08-09 17:04:08 +00:00
|
|
|
case 3: {
|
2006-03-02 01:41:25 +00:00
|
|
|
const PatchPage *page = &_patches_page[WP(w,def_d).data_1];
|
|
|
|
const SettingDesc *sd;
|
|
|
|
void *var;
|
|
|
|
int32 value;
|
|
|
|
int x, y;
|
|
|
|
byte btn;
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2006-09-23 02:39:24 +00:00
|
|
|
y = e->we.click.pt.y - 46 - 1;
|
2004-08-09 17:04:08 +00:00
|
|
|
if (y < 0) return;
|
2004-09-10 19:02:27 +00:00
|
|
|
|
2006-09-23 02:39:24 +00:00
|
|
|
x = e->we.click.pt.x - 5;
|
2006-03-02 01:41:25 +00:00
|
|
|
if (x < 0) return;
|
|
|
|
|
2004-08-09 17:04:08 +00:00
|
|
|
btn = y / 11;
|
|
|
|
if (y % 11 > 9) return;
|
|
|
|
if (btn >= page->num) return;
|
|
|
|
|
2006-03-17 22:47:52 +00:00
|
|
|
sd = page->entries[btn].setting;
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2006-03-02 01:41:25 +00:00
|
|
|
/* return if action is only active in network, or only settable by server */
|
|
|
|
if (!(sd->save.conv & SLF_NETWORK_NO) && _networking && !_network_server) return;
|
2007-11-17 22:25:16 +00:00
|
|
|
if ((sd->desc.flags & SGF_NETWORK_ONLY) && !_networking) return;
|
|
|
|
if ((sd->desc.flags & SGF_NO_NETWORK) && _networking) return;
|
2006-03-02 01:41:25 +00:00
|
|
|
|
2006-11-21 20:20:30 +00:00
|
|
|
var = GetVariableAddress(patches_ptr, &sd->save);
|
2006-03-02 01:41:25 +00:00
|
|
|
value = (int32)ReadValue(var, sd->save.conv);
|
|
|
|
|
|
|
|
/* clicked on the icon on the left side. Either scroller or bool on/off */
|
|
|
|
if (x < 21) {
|
|
|
|
const SettingDescBase *sdb = &sd->desc;
|
|
|
|
int32 oldvalue = value;
|
|
|
|
|
|
|
|
switch (sdb->cmd) {
|
|
|
|
case SDT_BOOLX: value ^= 1; break;
|
|
|
|
case SDT_NUMX: {
|
|
|
|
/* Add a dynamic step-size to the scroller. In a maximum of
|
2006-08-28 09:13:33 +00:00
|
|
|
* 50-steps you should be able to get from min to max,
|
|
|
|
* unless specified otherwise in the 'interval' variable
|
|
|
|
* of the current patch. */
|
|
|
|
uint32 step = (sdb->interval == 0) ? ((sdb->max - sdb->min) / 50) : sdb->interval;
|
2006-03-02 01:41:25 +00:00
|
|
|
if (step == 0) step = 1;
|
2004-12-04 17:54:56 +00:00
|
|
|
|
2004-08-09 17:04:08 +00:00
|
|
|
// don't allow too fast scrolling
|
|
|
|
if ((w->flags4 & WF_TIMEOUT_MASK) > 2 << WF_TIMEOUT_SHL) {
|
|
|
|
_left_button_clicked = false;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-03-02 01:41:25 +00:00
|
|
|
/* Increase or decrease the value and clamp it to extremes */
|
2004-08-09 17:04:08 +00:00
|
|
|
if (x >= 10) {
|
2006-03-02 01:41:25 +00:00
|
|
|
value += step;
|
|
|
|
if (value > sdb->max) value = sdb->max;
|
2004-08-09 17:04:08 +00:00
|
|
|
} else {
|
2006-03-02 01:41:25 +00:00
|
|
|
value -= step;
|
|
|
|
if (value < sdb->min) value = (sdb->flags & SGF_0ISDISABLED) ? 0 : sdb->min;
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
2004-09-10 19:02:27 +00:00
|
|
|
|
2007-03-08 12:57:08 +00:00
|
|
|
/* Set up scroller timeout for numeric values */
|
|
|
|
if (value != oldvalue && !(sd->desc.flags & SGF_MULTISTRING)) {
|
2006-03-02 01:41:25 +00:00
|
|
|
WP(w,def_d).data_2 = btn * 2 + 1 + ((x >= 10) ? 1 : 0);
|
2004-08-09 17:04:08 +00:00
|
|
|
w->flags4 |= 5 << WF_TIMEOUT_SHL;
|
|
|
|
_left_button_clicked = false;
|
|
|
|
}
|
2006-03-02 01:41:25 +00:00
|
|
|
} break;
|
|
|
|
default: NOT_REACHED();
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
2004-08-16 21:02:06 +00:00
|
|
|
|
2006-03-02 01:41:25 +00:00
|
|
|
if (value != oldvalue) {
|
2006-03-17 22:47:52 +00:00
|
|
|
SetPatchValue(page->entries[btn].index, patches_ptr, value);
|
2006-03-02 01:41:25 +00:00
|
|
|
SetWindowDirty(w);
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
} else {
|
2006-03-02 01:41:25 +00:00
|
|
|
/* only open editbox for types that its sensible for */
|
|
|
|
if (sd->desc.cmd != SDT_BOOLX && !(sd->desc.flags & SGF_MULTISTRING)) {
|
|
|
|
/* Show the correct currency-translated value */
|
|
|
|
if (sd->desc.flags & SGF_CURRENCY) value *= _currency->rate;
|
|
|
|
|
2004-08-09 17:04:08 +00:00
|
|
|
WP(w,def_d).data_3 = btn;
|
2006-03-02 01:41:25 +00:00
|
|
|
SetDParam(0, value);
|
2006-12-30 01:17:53 +00:00
|
|
|
ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_CONFIG_PATCHES_QUERY_CAPT, 10, 100, w, CS_NUMERAL);
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
}
|
2004-09-10 19:02:27 +00:00
|
|
|
|
2004-08-09 17:04:08 +00:00
|
|
|
break;
|
|
|
|
}
|
2004-08-11 21:48:27 +00:00
|
|
|
case 4: case 5: case 6: case 7: case 8: case 9:
|
2006-10-03 20:16:20 +00:00
|
|
|
RaiseWindowWidget(w, WP(w, def_d).data_1 + 4);
|
|
|
|
WP(w, def_d).data_1 = e->we.click.widget - 4;
|
|
|
|
LowerWindowWidget(w, WP(w, def_d).data_1 + 4);
|
2004-08-09 17:04:08 +00:00
|
|
|
DeleteWindowById(WC_QUERY_STRING, 0);
|
|
|
|
SetWindowDirty(w);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WE_TIMEOUT:
|
|
|
|
WP(w,def_d).data_2 = 0;
|
|
|
|
SetWindowDirty(w);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WE_ON_EDIT_TEXT: {
|
2006-09-23 02:39:24 +00:00
|
|
|
if (e->we.edittext.str != NULL) {
|
2006-03-17 22:47:52 +00:00
|
|
|
const PatchEntry *pe = &_patches_page[WP(w,def_d).data_1].entries[WP(w,def_d).data_3];
|
|
|
|
const SettingDesc *sd = pe->setting;
|
2006-09-23 02:39:24 +00:00
|
|
|
int32 value = atoi(e->we.edittext.str);
|
2006-03-02 01:41:25 +00:00
|
|
|
|
|
|
|
/* Save the correct currency-translated value */
|
|
|
|
if (sd->desc.flags & SGF_CURRENCY) value /= _currency->rate;
|
|
|
|
|
2006-03-17 22:47:52 +00:00
|
|
|
SetPatchValue(pe->index, patches_ptr, value);
|
2004-08-09 17:04:08 +00:00
|
|
|
SetWindowDirty(w);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case WE_DESTROY:
|
|
|
|
DeleteWindowById(WC_QUERY_STRING, 0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static const Widget _patches_selection_widgets[] = {
|
2006-08-22 14:38:37 +00:00
|
|
|
{ WWT_CLOSEBOX, RESIZE_NONE, 10, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
|
|
|
{ WWT_CAPTION, RESIZE_NONE, 10, 11, 369, 0, 13, STR_CONFIG_PATCHES_CAPTION, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
|
|
|
{ WWT_PANEL, RESIZE_NONE, 10, 0, 369, 14, 41, 0x0, STR_NULL},
|
2007-06-20 19:17:22 +00:00
|
|
|
{ WWT_PANEL, RESIZE_NONE, 10, 0, 369, 42, 380, 0x0, STR_NULL},
|
2006-08-22 14:38:37 +00:00
|
|
|
|
|
|
|
{ WWT_TEXTBTN, RESIZE_NONE, 3, 10, 96, 16, 27, STR_CONFIG_PATCHES_GUI, STR_NULL},
|
|
|
|
{ WWT_TEXTBTN, RESIZE_NONE, 3, 97, 183, 16, 27, STR_CONFIG_PATCHES_CONSTRUCTION, STR_NULL},
|
|
|
|
{ WWT_TEXTBTN, RESIZE_NONE, 3, 184, 270, 16, 27, STR_CONFIG_PATCHES_VEHICLES, STR_NULL},
|
|
|
|
{ WWT_TEXTBTN, RESIZE_NONE, 3, 271, 357, 16, 27, STR_CONFIG_PATCHES_STATIONS, STR_NULL},
|
|
|
|
{ WWT_TEXTBTN, RESIZE_NONE, 3, 10, 96, 28, 39, STR_CONFIG_PATCHES_ECONOMY, STR_NULL},
|
|
|
|
{ WWT_TEXTBTN, RESIZE_NONE, 3, 97, 183, 28, 39, STR_CONFIG_PATCHES_AI, STR_NULL},
|
2004-09-07 21:48:09 +00:00
|
|
|
{ WIDGETS_END},
|
2004-08-09 17:04:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const WindowDesc _patches_selection_desc = {
|
2007-07-27 12:49:04 +00:00
|
|
|
WDP_CENTER, WDP_CENTER, 370, 381, 370, 381,
|
2007-02-01 15:49:12 +00:00
|
|
|
WC_GAME_OPTIONS, WC_NONE,
|
2004-08-09 17:04:08 +00:00
|
|
|
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
|
|
|
|
_patches_selection_widgets,
|
|
|
|
PatchesSelectionWndProc,
|
|
|
|
};
|
|
|
|
|
2007-03-07 11:47:46 +00:00
|
|
|
void ShowPatchesSelection()
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
|
|
|
DeleteWindowById(WC_GAME_OPTIONS, 0);
|
|
|
|
AllocateWindowDesc(&_patches_selection_desc);
|
|
|
|
}
|
2004-11-21 22:44:13 +00:00
|
|
|
|
|
|
|
|
2006-08-02 18:36:53 +00:00
|
|
|
/**
|
|
|
|
* Draw [<][>] boxes.
|
|
|
|
* @param x the x position to draw
|
|
|
|
* @param y the y position to draw
|
|
|
|
* @param ctab the color of the buttons
|
|
|
|
* @param state 0 = none clicked, 1 = first clicked, 2 = second clicked
|
|
|
|
* @param clickable_left is the left button clickable?
|
|
|
|
* @param clickable_right is the right button clickable?
|
|
|
|
*/
|
|
|
|
void DrawArrowButtons(int x, int y, int ctab, byte state, bool clickable_left, bool clickable_right)
|
2004-12-22 13:19:26 +00:00
|
|
|
{
|
2007-01-14 19:57:49 +00:00
|
|
|
int color = (1 << PALETTE_MODIFIER_GREYOUT) | _colour_gradient[COLOUR_YELLOW][2];
|
2006-08-02 18:36:53 +00:00
|
|
|
|
2007-01-10 18:56:51 +00:00
|
|
|
DrawFrameRect(x, y + 1, x + 9, y + 9, ctab, (state == 1) ? FR_LOWERED : FR_NONE);
|
|
|
|
DrawFrameRect(x + 10, y + 1, x + 19, y + 9, ctab, (state == 2) ? FR_LOWERED : FR_NONE);
|
2007-11-04 00:08:57 +00:00
|
|
|
DrawStringCentered(x + 5, y + 1, STR_6819, TC_FROMSTRING); // [<]
|
|
|
|
DrawStringCentered(x + 15, y + 1, STR_681A, TC_FROMSTRING); // [>]
|
2006-08-02 18:36:53 +00:00
|
|
|
|
|
|
|
/* Grey out the buttons that aren't clickable */
|
|
|
|
if (!clickable_left)
|
|
|
|
GfxFillRect(x + 1, y + 1, x + 1 + 8, y + 8, color);
|
|
|
|
if (!clickable_right)
|
|
|
|
GfxFillRect(x + 11, y + 1, x + 11 + 8, y + 8, color);
|
2004-12-22 13:19:26 +00:00
|
|
|
}
|
|
|
|
|
2005-08-07 14:18:17 +00:00
|
|
|
static char _str_separator[2];
|
2004-12-22 13:19:26 +00:00
|
|
|
|
|
|
|
static void CustCurrencyWndProc(Window *w, WindowEvent *e)
|
|
|
|
{
|
|
|
|
switch (e->event) {
|
2006-08-31 14:12:08 +00:00
|
|
|
case WE_PAINT: {
|
|
|
|
int x;
|
|
|
|
int y = 20;
|
|
|
|
int clk = WP(w,def_d).data_1;
|
|
|
|
DrawWindowWidgets(w);
|
|
|
|
|
|
|
|
// exchange rate
|
|
|
|
DrawArrowButtons(10, y, 3, GB(clk, 0, 2), true, true);
|
|
|
|
SetDParam(0, 1);
|
|
|
|
SetDParam(1, 1);
|
2007-11-04 00:08:57 +00:00
|
|
|
DrawString(35, y + 1, STR_CURRENCY_EXCHANGE_RATE, TC_FROMSTRING);
|
2006-08-31 14:12:08 +00:00
|
|
|
y += 12;
|
|
|
|
|
|
|
|
// separator
|
2007-01-10 18:56:51 +00:00
|
|
|
DrawFrameRect(10, y + 1, 29, y + 9, 0, GB(clk, 2, 2) ? FR_LOWERED : FR_NONE);
|
2007-11-04 00:08:57 +00:00
|
|
|
x = DrawString(35, y + 1, STR_CURRENCY_SEPARATOR, TC_FROMSTRING);
|
|
|
|
DoDrawString(_str_separator, x + 4, y + 1, TC_ORANGE);
|
2006-08-31 14:12:08 +00:00
|
|
|
y += 12;
|
|
|
|
|
|
|
|
// prefix
|
2007-01-10 18:56:51 +00:00
|
|
|
DrawFrameRect(10, y + 1, 29, y + 9, 0, GB(clk, 4, 2) ? FR_LOWERED : FR_NONE);
|
2007-11-04 00:08:57 +00:00
|
|
|
x = DrawString(35, y + 1, STR_CURRENCY_PREFIX, TC_FROMSTRING);
|
|
|
|
DoDrawString(_custom_currency.prefix, x + 4, y + 1, TC_ORANGE);
|
2006-08-31 14:12:08 +00:00
|
|
|
y += 12;
|
|
|
|
|
|
|
|
// suffix
|
2007-01-10 18:56:51 +00:00
|
|
|
DrawFrameRect(10, y + 1, 29, y + 9, 0, GB(clk, 6, 2) ? FR_LOWERED : FR_NONE);
|
2007-11-04 00:08:57 +00:00
|
|
|
x = DrawString(35, y + 1, STR_CURRENCY_SUFFIX, TC_FROMSTRING);
|
|
|
|
DoDrawString(_custom_currency.suffix, x + 4, y + 1, TC_ORANGE);
|
2006-08-31 14:12:08 +00:00
|
|
|
y += 12;
|
|
|
|
|
|
|
|
// switch to euro
|
|
|
|
DrawArrowButtons(10, y, 3, GB(clk, 8, 2), true, true);
|
|
|
|
SetDParam(0, _custom_currency.to_euro);
|
2007-11-04 00:08:57 +00:00
|
|
|
DrawString(35, y + 1, (_custom_currency.to_euro != CF_NOEURO) ? STR_CURRENCY_SWITCH_TO_EURO : STR_CURRENCY_SWITCH_TO_EURO_NEVER, TC_FROMSTRING);
|
2006-08-31 14:12:08 +00:00
|
|
|
y += 12;
|
|
|
|
|
|
|
|
// Preview
|
|
|
|
y += 12;
|
|
|
|
SetDParam(0, 10000);
|
2007-11-04 00:08:57 +00:00
|
|
|
DrawString(35, y + 1, STR_CURRENCY_PREVIEW, TC_FROMSTRING);
|
2004-12-22 13:19:26 +00:00
|
|
|
break;
|
|
|
|
}
|
2004-12-27 18:18:44 +00:00
|
|
|
|
2006-08-31 14:12:08 +00:00
|
|
|
case WE_CLICK: {
|
2006-09-23 02:39:24 +00:00
|
|
|
int line = (e->we.click.pt.y - 20) / 12;
|
2006-08-31 14:12:08 +00:00
|
|
|
int len = 0;
|
2006-09-23 02:39:24 +00:00
|
|
|
int x = e->we.click.pt.x;
|
2006-08-31 14:12:08 +00:00
|
|
|
StringID str = 0;
|
|
|
|
CharSetFilter afilter = CS_ALPHANUMERAL;
|
|
|
|
|
|
|
|
switch (line) {
|
|
|
|
case 0: // rate
|
2007-11-24 10:38:43 +00:00
|
|
|
if (IsInsideMM(x, 10, 30)) { // clicked buttons
|
2006-08-31 14:12:08 +00:00
|
|
|
if (x < 20) {
|
|
|
|
if (_custom_currency.rate > 1) _custom_currency.rate--;
|
|
|
|
WP(w,def_d).data_1 = 1 << (line * 2 + 0);
|
|
|
|
} else {
|
|
|
|
if (_custom_currency.rate < 5000) _custom_currency.rate++;
|
|
|
|
WP(w,def_d).data_1 = 1 << (line * 2 + 1);
|
|
|
|
}
|
|
|
|
} else { // enter text
|
|
|
|
SetDParam(0, _custom_currency.rate);
|
|
|
|
str = STR_CONFIG_PATCHES_INT32;
|
|
|
|
len = 4;
|
|
|
|
afilter = CS_NUMERAL;
|
|
|
|
}
|
2005-11-14 19:48:04 +00:00
|
|
|
break;
|
|
|
|
|
2006-08-31 14:12:08 +00:00
|
|
|
case 1: // separator
|
2007-11-24 10:38:43 +00:00
|
|
|
if (IsInsideMM(x, 10, 30)) { // clicked button
|
2006-08-31 14:12:08 +00:00
|
|
|
WP(w,def_d).data_1 = 1 << (line * 2 + 1);
|
|
|
|
}
|
|
|
|
str = BindCString(_str_separator);
|
|
|
|
len = 1;
|
2005-11-14 19:48:04 +00:00
|
|
|
break;
|
|
|
|
|
2006-08-31 14:12:08 +00:00
|
|
|
case 2: // prefix
|
2007-11-24 10:38:43 +00:00
|
|
|
if (IsInsideMM(x, 10, 30)) { // clicked button
|
2006-08-31 14:12:08 +00:00
|
|
|
WP(w,def_d).data_1 = 1 << (line * 2 + 1);
|
|
|
|
}
|
|
|
|
str = BindCString(_custom_currency.prefix);
|
|
|
|
len = 12;
|
2005-11-14 19:48:04 +00:00
|
|
|
break;
|
|
|
|
|
2006-08-31 14:12:08 +00:00
|
|
|
case 3: // suffix
|
2007-11-24 10:38:43 +00:00
|
|
|
if (IsInsideMM(x, 10, 30)) { // clicked button
|
2006-08-31 14:12:08 +00:00
|
|
|
WP(w,def_d).data_1 = 1 << (line * 2 + 1);
|
|
|
|
}
|
|
|
|
str = BindCString(_custom_currency.suffix);
|
|
|
|
len = 12;
|
2005-11-14 19:48:04 +00:00
|
|
|
break;
|
|
|
|
|
2006-08-31 14:12:08 +00:00
|
|
|
case 4: // to euro
|
2007-11-24 10:38:43 +00:00
|
|
|
if (IsInsideMM(x, 10, 30)) { // clicked buttons
|
2006-08-31 14:12:08 +00:00
|
|
|
if (x < 20) {
|
|
|
|
_custom_currency.to_euro = (_custom_currency.to_euro <= 2000) ?
|
|
|
|
CF_NOEURO : _custom_currency.to_euro - 1;
|
|
|
|
WP(w,def_d).data_1 = 1 << (line * 2 + 0);
|
|
|
|
} else {
|
|
|
|
_custom_currency.to_euro =
|
2007-11-19 18:38:10 +00:00
|
|
|
Clamp(_custom_currency.to_euro + 1, 2000, MAX_YEAR);
|
2006-08-31 14:12:08 +00:00
|
|
|
WP(w,def_d).data_1 = 1 << (line * 2 + 1);
|
|
|
|
}
|
|
|
|
} else { // enter text
|
|
|
|
SetDParam(0, _custom_currency.to_euro);
|
|
|
|
str = STR_CONFIG_PATCHES_INT32;
|
|
|
|
len = 4;
|
|
|
|
afilter = CS_NUMERAL;
|
|
|
|
}
|
2005-11-14 19:48:04 +00:00
|
|
|
break;
|
2004-12-22 13:19:26 +00:00
|
|
|
}
|
2004-12-27 18:18:44 +00:00
|
|
|
|
2006-08-31 14:12:08 +00:00
|
|
|
if (len != 0) {
|
2006-12-30 01:17:53 +00:00
|
|
|
WP(w, def_d).data_2 = line;
|
|
|
|
ShowQueryString(str, STR_CURRENCY_CHANGE_PARAMETER, len + 1, 250, w, afilter);
|
2006-08-31 14:12:08 +00:00
|
|
|
}
|
2004-12-27 18:18:44 +00:00
|
|
|
|
2006-08-31 14:12:08 +00:00
|
|
|
w->flags4 |= 5 << WF_TIMEOUT_SHL;
|
|
|
|
SetWindowDirty(w);
|
|
|
|
break;
|
|
|
|
}
|
2004-12-22 13:19:26 +00:00
|
|
|
|
2006-08-31 14:12:08 +00:00
|
|
|
case WE_ON_EDIT_TEXT: {
|
2006-09-23 02:39:24 +00:00
|
|
|
const char *b = e->we.edittext.str;
|
2004-12-22 13:19:26 +00:00
|
|
|
|
2006-08-31 14:12:08 +00:00
|
|
|
switch (WP(w,def_d).data_2) {
|
|
|
|
case 0: /* Exchange rate */
|
2007-11-19 18:38:10 +00:00
|
|
|
_custom_currency.rate = Clamp(atoi(b), 1, 5000);
|
2006-08-31 14:12:08 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 1: /* Thousands seperator */
|
|
|
|
_custom_currency.separator = (b[0] == '\0') ? ' ' : b[0];
|
|
|
|
ttd_strlcpy(_str_separator, b, lengthof(_str_separator));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2: /* Currency prefix */
|
|
|
|
ttd_strlcpy(_custom_currency.prefix, b, lengthof(_custom_currency.prefix));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3: /* Currency suffix */
|
|
|
|
ttd_strlcpy(_custom_currency.suffix, b, lengthof(_custom_currency.suffix));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 4: { /* Year to switch to euro */
|
|
|
|
int val = atoi(b);
|
|
|
|
|
|
|
|
_custom_currency.to_euro =
|
|
|
|
(val < 2000 ? CF_NOEURO : min(val, MAX_YEAR));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
MarkWholeScreenDirty();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case WE_TIMEOUT:
|
|
|
|
WP(w,def_d).data_1 = 0;
|
|
|
|
SetWindowDirty(w);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WE_DESTROY:
|
|
|
|
DeleteWindowById(WC_QUERY_STRING, 0);
|
|
|
|
MarkWholeScreenDirty();
|
|
|
|
break;
|
2004-12-22 13:19:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static const Widget _cust_currency_widgets[] = {
|
2006-08-22 14:38:37 +00:00
|
|
|
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
|
|
|
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 229, 0, 13, STR_CURRENCY_WINDOW, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
|
|
|
{ WWT_PANEL, RESIZE_NONE, 14, 0, 229, 14, 119, 0x0, STR_NULL},
|
2004-12-22 13:19:26 +00:00
|
|
|
{ WIDGETS_END},
|
|
|
|
};
|
|
|
|
|
|
|
|
static const WindowDesc _cust_currency_desc = {
|
2007-07-27 12:49:04 +00:00
|
|
|
WDP_CENTER, WDP_CENTER, 230, 120, 230, 120,
|
2007-02-01 15:49:12 +00:00
|
|
|
WC_CUSTOM_CURRENCY, WC_NONE,
|
2004-12-22 13:19:26 +00:00
|
|
|
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
|
|
|
|
_cust_currency_widgets,
|
|
|
|
CustCurrencyWndProc,
|
|
|
|
};
|
|
|
|
|
2007-03-07 11:47:46 +00:00
|
|
|
static void ShowCustCurrency()
|
2004-12-22 13:19:26 +00:00
|
|
|
{
|
2005-08-07 12:41:57 +00:00
|
|
|
_str_separator[0] = _custom_currency.separator;
|
2005-05-03 22:05:34 +00:00
|
|
|
_str_separator[1] = '\0';
|
2004-12-22 13:19:26 +00:00
|
|
|
|
|
|
|
DeleteWindowById(WC_CUSTOM_CURRENCY, 0);
|
2005-11-14 19:48:04 +00:00
|
|
|
AllocateWindowDesc(&_cust_currency_desc);
|
2004-12-22 13:19:26 +00:00
|
|
|
}
|