MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / IsEditable

Method IsEditable

src/settings.cpp:894–905  ·  view source on GitHub ↗

* Check whether the setting is editable in the current gamemode. * @param do_command true if this is about checking a command from the server. * @return true if editable. */

Source from the content-addressed store, hash-verified

892 * @return true if editable.
893 */
894bool SettingDesc::IsEditable(bool do_command) const
895{
896 if (!do_command && !this->flags.Test(SettingFlag::NoNetworkSync) && _networking && !_network_server && !this->flags.Test(SettingFlag::PerCompany)) return false;
897 if (do_command && this->flags.Test(SettingFlag::NoNetworkSync)) return false;
898 if (this->flags.Test(SettingFlag::NetworkOnly) && !_networking && _game_mode != GM_MENU) return false;
899 if (this->flags.Test(SettingFlag::NoNetwork) && _networking) return false;
900 if (this->flags.Test(SettingFlag::NewgameOnly) &&
901 (_game_mode == GM_NORMAL ||
902 (_game_mode == GM_EDITOR && !this->flags.Test(SettingFlag::SceneditToo)))) return false;
903 if (this->flags.Test(SettingFlag::SceneditOnly) && _game_mode != GM_EDITOR) return false;
904 return true;
905}
906
907/**
908 * Return the type of the setting.

Callers 5

DrawSettingMethod · 0.45
CmdChangeSettingFunction · 0.45
DrawSettingMethod · 0.45
SettingsPanelClickMethod · 0.45
OptionsPanelClickMethod · 0.45

Calls 1

TestMethod · 0.80

Tested by

no test coverage detected