Merge branch 'master' into jgrpp
Replace build and refit, and group collapse implementations Fix template creation build and refit # Conflicts: # Makefile.bundle.in # config.lib # src/animated_tile.cpp # src/blitter/32bpp_anim.hpp # src/blitter/32bpp_base.hpp # src/blitter/8bpp_base.hpp # src/blitter/null.hpp # src/build_vehicle_gui.cpp # src/command.cpp # src/command_func.h # src/console_gui.cpp # src/core/smallstack_type.hpp # src/date.cpp # src/debug.cpp # src/genworld_gui.cpp # src/ground_vehicle.hpp # src/group_gui.cpp # src/lang/korean.txt # src/linkgraph/linkgraph_gui.h # src/main_gui.cpp # src/misc_gui.cpp # src/network/core/game.h # src/network/core/packet.cpp # src/network/core/udp.cpp # src/network/core/udp.h # src/network/network_content.cpp # src/network/network_type.h # src/network/network_udp.cpp # src/newgrf_house.h # src/openttd.cpp # src/order_cmd.cpp # src/order_gui.cpp # src/os/unix/crashlog_unix.cpp # src/os/windows/crashlog_win.cpp # src/osk_gui.cpp # src/pathfinder/opf/opf_ship.cpp # src/rail_cmd.cpp # src/rail_gui.cpp # src/saveload/saveload.cpp # src/settings.cpp # src/settings_gui.cpp # src/smallmap_gui.h # src/station_base.h # src/station_cmd.cpp # src/table/gameopt_settings.ini # src/table/newgrf_debug_data.h # src/table/settings.ini # src/timetable_gui.cpp # src/toolbar_gui.cpp # src/train_gui.cpp # src/vehicle.cpp # src/vehicle_gui.cpp # src/vehiclelist.cpp # src/viewport.cpp # src/widgets/dropdown.cpp # src/window_gui.h
This commit is contained in:
@@ -455,13 +455,30 @@ static void Write_ValidateSetting(void *ptr, const SettingDesc *sd, int32 val)
|
||||
case SLE_VAR_U16:
|
||||
case SLE_VAR_I32: {
|
||||
/* Override the minimum value. No value below sdb->min, except special value 0 */
|
||||
if (!(sdb->flags & SGF_0ISDISABLED) || val != 0) val = Clamp(val, sdb->min, sdb->max);
|
||||
if (!(sdb->flags & SGF_0ISDISABLED) || val != 0) {
|
||||
if (!(sdb->flags & SGF_MULTISTRING)) {
|
||||
/* Clamp value-type setting to its valid range */
|
||||
val = Clamp(val, sdb->min, sdb->max);
|
||||
} else if (val < sdb->min || val > (int32)sdb->max) {
|
||||
/* Reset invalid discrete setting (where different values change gameplay) to its default value */
|
||||
val = (int32)(size_t)sdb->def;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SLE_VAR_U32: {
|
||||
/* Override the minimum value. No value below sdb->min, except special value 0 */
|
||||
uint min = ((sdb->flags & SGF_0ISDISABLED) && (uint)val <= (uint)sdb->min) ? 0 : sdb->min;
|
||||
WriteValue(ptr, SLE_VAR_U32, (int64)ClampU(val, min, sdb->max));
|
||||
uint32 uval = (uint32)val;
|
||||
if (!(sdb->flags & SGF_0ISDISABLED) || uval != 0) {
|
||||
if (!(sdb->flags & SGF_MULTISTRING)) {
|
||||
/* Clamp value-type setting to its valid range */
|
||||
uval = ClampU(uval, sdb->min, sdb->max);
|
||||
} else if (uval < (uint)sdb->min || uval > sdb->max) {
|
||||
/* Reset invalid discrete setting to its default value */
|
||||
uval = (uint32)(size_t)sdb->def;
|
||||
}
|
||||
}
|
||||
WriteValue(ptr, SLE_VAR_U32, (int64)uval);
|
||||
return;
|
||||
}
|
||||
case SLE_VAR_I64:
|
||||
@@ -717,7 +734,7 @@ static void IniLoadSettingList(IniFile *ini, const char *grpname, StringList *li
|
||||
list->Clear();
|
||||
|
||||
for (const IniItem *item = group->item; item != NULL; item = item->next) {
|
||||
if (item->name != NULL) *list->Append() = stredup(item->name);
|
||||
if (item->name != NULL) list->push_back(stredup(item->name));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -737,8 +754,8 @@ static void IniSaveSettingList(IniFile *ini, const char *grpname, StringList *li
|
||||
if (group == NULL || list == NULL) return;
|
||||
group->Clear();
|
||||
|
||||
for (char **iter = list->Begin(); iter != list->End(); iter++) {
|
||||
group->GetItem(*iter, true)->SetValue("");
|
||||
for (char *iter : *list) {
|
||||
group->GetItem(iter, true)->SetValue("");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1436,8 +1453,6 @@ static bool DayLengthChanged(int32 p1)
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
|
||||
static bool UpdateClientName(int32 p1)
|
||||
{
|
||||
NetworkUpdateClientName();
|
||||
@@ -1469,9 +1484,6 @@ static bool UpdateClientConfigValues(int32 p1)
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
||||
|
||||
/* End - Callback Functions */
|
||||
|
||||
/* Begin - GUI order callbacks */
|
||||
@@ -1816,11 +1828,9 @@ static void HandleSettingDescs(IniFile *ini, SettingDescProc *proc, SettingDescP
|
||||
proc(ini, _currency_settings,"currency", &_custom_currency);
|
||||
proc(ini, _company_settings, "company", &_settings_client.company);
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
proc_list(ini, "server_bind_addresses", &_network_bind_list);
|
||||
proc_list(ini, "servers", &_network_host_list);
|
||||
proc_list(ini, "bans", &_network_ban_list);
|
||||
#endif /* ENABLE_NETWORK */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1896,7 +1906,7 @@ void GetGRFPresetList(GRFPresetList *list)
|
||||
IniGroup *group;
|
||||
for (group = ini->group; group != NULL; group = group->next) {
|
||||
if (strncmp(group->name, "preset-", 7) == 0) {
|
||||
*list->Append() = stredup(group->name + 7);
|
||||
list->push_back(stredup(group->name + 7));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2120,7 +2130,6 @@ void SetDefaultCompanySettings(CompanyID cid)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(ENABLE_NETWORK)
|
||||
/**
|
||||
* Sync all company settings in a multiplayer game.
|
||||
*/
|
||||
@@ -2136,7 +2145,6 @@ void SyncCompanySettings()
|
||||
if (old_value != new_value) NetworkSendCommand(0, i, new_value, CMD_CHANGE_COMPANY_SETTING, NULL, NULL, _local_company, 0);
|
||||
}
|
||||
}
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
||||
/**
|
||||
* Get the index in the _company_settings array of a setting
|
||||
@@ -2771,18 +2779,6 @@ static void Save_PATX()
|
||||
SaveSettingsPatx(_settings, &_settings_game);
|
||||
}
|
||||
|
||||
void CheckConfig()
|
||||
{
|
||||
/*
|
||||
* Increase old default values for pf_maxdepth and pf_maxlength
|
||||
* to support big networks.
|
||||
*/
|
||||
if (_settings_newgame.pf.opf.pf_maxdepth == 16 && _settings_newgame.pf.opf.pf_maxlength == 512) {
|
||||
_settings_newgame.pf.opf.pf_maxdepth = 48;
|
||||
_settings_newgame.pf.opf.pf_maxlength = 4096;
|
||||
}
|
||||
}
|
||||
|
||||
extern const ChunkHandler _setting_chunk_handlers[] = {
|
||||
{ 'OPTS', NULL, Load_OPTS, NULL, NULL, CH_RIFF},
|
||||
{ 'PATS', Save_PATS, Load_PATS, NULL, Check_PATS, CH_RIFF},
|
||||
|
Reference in New Issue
Block a user