mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-05 12:38:18 +00:00
Don't use optional::value since MacOS < 10.14 doesn't like it
This commit is contained in:
parent
f8bf44ecf0
commit
f323deb23e
@ -660,7 +660,7 @@ bool game_launcher::load_game()
|
||||
|
||||
savegame::loadgame load(savegame::save_index_class::default_saves_dir(), state_);
|
||||
if(load_data_) {
|
||||
load.data() = std::move(load_data_.value());
|
||||
load.data() = std::move(*load_data_);
|
||||
clear_loaded_game();
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ cave_map_generator::cave_map_generator_job::cave_map_generator_job(const cave_ma
|
||||
"message", "Use the Lua cave generator instead, with scenario_generation=lua and create_scenario= (see wiki for details).",
|
||||
},
|
||||
});
|
||||
uint32_t seed = randomseed ? randomseed.value() : seed_rng::next_seed();
|
||||
uint32_t seed = randomseed ? *randomseed : seed_rng::next_seed();
|
||||
rng_.seed(seed);
|
||||
LOG_NG << "creating random cave with seed: " << seed << '\n';
|
||||
flipx_ = static_cast<int>(rng_() % 100) < params.flipx_chance_;
|
||||
|
@ -81,7 +81,7 @@ std::string default_map_generator::generate_map(std::map<map_location,std::strin
|
||||
{
|
||||
uint32_t seed;
|
||||
if(randomseed) {
|
||||
seed = randomseed.value();
|
||||
seed = *randomseed;
|
||||
} else {
|
||||
seed = seed_rng::next_seed();
|
||||
}
|
||||
|
@ -1507,10 +1507,10 @@ void push_tab_pair(std::vector<help::item> &v, const std::string &s, const std::
|
||||
help::item item(s, font::line_width(s, normal_font_size));
|
||||
if (image) {
|
||||
// If the image doesn't exist, don't add padding.
|
||||
auto width = image_width(image.value());
|
||||
auto width = image_width(*image);
|
||||
padding = (width ? padding : 0);
|
||||
|
||||
item.first = "<img>src='" + image.value() + "'</img>" + (padding ? jump(padding) : "") + s;
|
||||
item.first = "<img>src='" + *image + "'</img>" + (padding ? jump(padding) : "") + s;
|
||||
item.second += width + padding;
|
||||
}
|
||||
v.emplace_back(item);
|
||||
|
@ -147,7 +147,7 @@ struct lexical_caster
|
||||
std::stringstream sstr;
|
||||
|
||||
if(!(sstr << value && sstr >> result)) {
|
||||
if(fallback) { return fallback.value(); }
|
||||
if(fallback) { return *fallback; }
|
||||
|
||||
throw bad_lexical_cast();
|
||||
} else {
|
||||
@ -200,7 +200,7 @@ struct lexical_caster<
|
||||
DEBUG_THROW("specialized - To long long - From (const) char*");
|
||||
|
||||
if(fallback) {
|
||||
return lexical_cast_default<long long>(std::string(value), fallback.value());
|
||||
return lexical_cast_default<long long>(std::string(value), *fallback);
|
||||
} else {
|
||||
return lexical_cast<long long>(std::string(value));
|
||||
}
|
||||
@ -231,7 +231,7 @@ struct lexical_caster<
|
||||
}
|
||||
|
||||
if(fallback) {
|
||||
return fallback.value();
|
||||
return *fallback;
|
||||
} else {
|
||||
throw bad_lexical_cast();
|
||||
}
|
||||
@ -256,7 +256,7 @@ struct lexical_caster<
|
||||
DEBUG_THROW("specialized - To signed - From (const) char*");
|
||||
|
||||
if(fallback) {
|
||||
return lexical_cast_default<To>(std::string(value), fallback.value());
|
||||
return lexical_cast_default<To>(std::string(value), *fallback);
|
||||
} else {
|
||||
return lexical_cast<To>(std::string(value));
|
||||
}
|
||||
@ -289,7 +289,7 @@ struct lexical_caster<
|
||||
}
|
||||
|
||||
if(fallback) {
|
||||
return fallback.value();
|
||||
return *fallback;
|
||||
} else {
|
||||
throw bad_lexical_cast();
|
||||
}
|
||||
@ -314,7 +314,7 @@ struct lexical_caster<
|
||||
DEBUG_THROW("specialized - To floating point - From (const) char*");
|
||||
|
||||
if(fallback) {
|
||||
return lexical_cast_default<To>(std::string(value), fallback.value());
|
||||
return lexical_cast_default<To>(std::string(value), *fallback);
|
||||
} else {
|
||||
return lexical_cast<To>(std::string(value));
|
||||
}
|
||||
@ -340,7 +340,7 @@ struct lexical_caster<
|
||||
// Explicitly reject hexadecimal values. Unit tests of the config class require that.
|
||||
if(value.find_first_of("Xx") != std::string::npos) {
|
||||
if(fallback) {
|
||||
return fallback.value();
|
||||
return *fallback;
|
||||
} else {
|
||||
throw bad_lexical_cast();
|
||||
}
|
||||
@ -356,7 +356,7 @@ struct lexical_caster<
|
||||
}
|
||||
|
||||
if(fallback) {
|
||||
return fallback.value();
|
||||
return *fallback;
|
||||
} else {
|
||||
throw bad_lexical_cast();
|
||||
}
|
||||
@ -384,7 +384,7 @@ struct lexical_caster<
|
||||
"specialized - To unsigned long long - From (const) char*");
|
||||
|
||||
if(fallback) {
|
||||
return lexical_cast_default<unsigned long long>(std::string(value), fallback.value());
|
||||
return lexical_cast_default<unsigned long long>(std::string(value), *fallback);
|
||||
} else {
|
||||
return lexical_cast<unsigned long long>(std::string(value));
|
||||
}
|
||||
@ -415,7 +415,7 @@ struct lexical_caster<
|
||||
}
|
||||
|
||||
if(fallback) {
|
||||
return fallback.value();
|
||||
return *fallback;
|
||||
} else {
|
||||
throw bad_lexical_cast();
|
||||
}
|
||||
@ -440,7 +440,7 @@ struct lexical_caster<
|
||||
DEBUG_THROW("specialized - To unsigned - From (const) char*");
|
||||
|
||||
if(fallback) {
|
||||
return lexical_cast_default<To>(std::string(value), fallback.value());
|
||||
return lexical_cast_default<To>(std::string(value), *fallback);
|
||||
} else {
|
||||
return lexical_cast<To>(std::string(value));
|
||||
}
|
||||
@ -474,7 +474,7 @@ struct lexical_caster<
|
||||
}
|
||||
|
||||
if(fallback) {
|
||||
return fallback.value();
|
||||
return *fallback;
|
||||
} else {
|
||||
throw bad_lexical_cast();
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ static int impl_music_get(lua_State* L) {
|
||||
if(strcmp(m, "current_i") == 0) {
|
||||
auto current_index = sound::get_current_track_index();
|
||||
if(current_index) {
|
||||
lua_pushinteger(L, current_index.value() + 1);
|
||||
lua_pushinteger(L, *current_index + 1);
|
||||
} else {
|
||||
lua_pushnil(L);
|
||||
}
|
||||
|
@ -301,7 +301,7 @@ config mapgen_lua_kernel::create_scenario(const char * prog, const config & gene
|
||||
uint32_t mapgen_lua_kernel::get_random_seed()
|
||||
{
|
||||
if(random_seed_) {
|
||||
return random_seed_.value()++;
|
||||
return (*random_seed_)++;
|
||||
}
|
||||
else {
|
||||
return lua_kernel_base::get_random_seed();
|
||||
|
@ -1437,15 +1437,15 @@ void unit::write(config& cfg, bool write_all) const
|
||||
}
|
||||
|
||||
if(halo_) {
|
||||
cfg["halo"] = halo_.value();
|
||||
cfg["halo"] = *halo_;
|
||||
}
|
||||
|
||||
if(ellipse_) {
|
||||
cfg["ellipse"] = ellipse_.value();
|
||||
cfg["ellipse"] = *ellipse_;
|
||||
}
|
||||
|
||||
if(usage_) {
|
||||
cfg["usage"] = usage_.value();
|
||||
cfg["usage"] = *usage_;
|
||||
}
|
||||
|
||||
write_upkeep(cfg["upkeep"]);
|
||||
|
@ -364,7 +364,7 @@ static int process_command_args(const commandline_options& cmdline_opts)
|
||||
// Options that don't change behavior based on any others should be checked alphabetically below.
|
||||
|
||||
if(cmdline_opts.log) {
|
||||
for(const auto& log_pair : cmdline_opts.log.value()) {
|
||||
for(const auto& log_pair : *cmdline_opts.log) {
|
||||
const std::string log_domain = log_pair.second;
|
||||
const int severity = log_pair.first;
|
||||
if(!lg::set_log_domain_severity(log_domain, severity)) {
|
||||
@ -1124,44 +1124,44 @@ int main(int argc, char** argv)
|
||||
/**
|
||||
* @page GUIToolkitWML GUIToolkitWML
|
||||
* @tableofcontents
|
||||
*
|
||||
*
|
||||
* @section State State
|
||||
*
|
||||
*
|
||||
* A state contains the info what to do in a state. At the moment this is rather focussed on the drawing part, might change later. Keys:
|
||||
* Key |Type |Default |Description
|
||||
* Key |Type |Default |Description
|
||||
* -----------------|------------------------------------|---------|-------------
|
||||
* draw | @ref guivartype_section "section" |mandatory|Section with drawing directions for a canvas.
|
||||
*
|
||||
*
|
||||
* @section WindowDefinition Window Definition
|
||||
*
|
||||
*
|
||||
* A window defines how a window looks in the game.
|
||||
* Key |Type |Default |Description
|
||||
* Key |Type |Default |Description
|
||||
* -----------------|------------------------------------|---------|-------------
|
||||
* id | @ref guivartype_string "string" |mandatory|Unique id for this window.
|
||||
* description | @ref guivartype_t_string "t_string"|mandatory|Unique translatable name for this window.
|
||||
* resolution | @ref guivartype_section "section" |mandatory|The definitions of the window in various resolutions.
|
||||
*
|
||||
*
|
||||
* @section Cell Cell
|
||||
*
|
||||
*
|
||||
* Every grid cell has some cell configuration values and one widget in the grid cell.
|
||||
* Here we describe the what is available more information about the usage can be found at @ref GUILayout.
|
||||
*
|
||||
* Key |Type |Default |Description
|
||||
*
|
||||
* Key |Type |Default |Description
|
||||
* --------------------|----------------------------------------|---------|-------------
|
||||
* id | @ref guivartype_string "string" |"" |A grid is a widget and can have an id. This isn't used that often, but is allowed.
|
||||
* linked_group | @ref guivartype_string "string" |0 |.
|
||||
*
|
||||
*
|
||||
* @section RowValues Row Values
|
||||
*
|
||||
*
|
||||
* For every row the following variables are available:
|
||||
* Key |Type |Default |Description
|
||||
* Key |Type |Default |Description
|
||||
* --------------------|----------------------------------------|---------|-------------
|
||||
* grow_factor | @ref guivartype_unsigned "unsigned" |0 |The grow factor for a row.
|
||||
*
|
||||
*
|
||||
* @section CellValues Cell Values
|
||||
*
|
||||
*
|
||||
* For every column the following variables are available:
|
||||
* Key |Type |Default |Description
|
||||
* Key |Type |Default |Description
|
||||
* --------------------|----------------------------------------|---------|-------------
|
||||
* grow_factor | @ref guivartype_unsigned "unsigned" |0 |The grow factor for a column, this value is only read for the first row.
|
||||
* border_size | @ref guivartype_unsigned "unsigned" |0 |The border size for this grid cell.
|
||||
@ -1175,7 +1175,7 @@ int main(int argc, char** argv)
|
||||
/**
|
||||
* @page GUILayout GUILayout
|
||||
* @tableofcontents
|
||||
*
|
||||
*
|
||||
* @section Abstract Abstract
|
||||
*
|
||||
* In the widget library the placement and sizes of elements is determined by
|
||||
@ -1375,7 +1375,7 @@ int main(int argc, char** argv)
|
||||
/**
|
||||
* @defgroup GUIWidgetWML GUIWidgetWML
|
||||
* In various parts of the GUI there are several variables types in use. This section describes them.
|
||||
*
|
||||
*
|
||||
* Below are the simple types which have one value or a short list of options:
|
||||
* Variable |description
|
||||
* ------------------------------------------------|-----------
|
||||
@ -1398,16 +1398,16 @@ int main(int argc, char** argv)
|
||||
* @anchor guivartype_scrollbar_mode scrollbar_mode|How to show the scrollbar of a widget. Possible values:<ul><li>always - The scrollbar is always shown, regardless whether it's required or not.</li><li>never - The scrollbar is never shown, even not when needed. (Note when setting this mode dialogs might not properly fit anymore).</li><li>auto - Shows the scrollbar when needed. The widget will reserve space for the scrollbar, but only show when needed.</li><li>initial_auto - Like auto, but when the scrollbar is not needed the space is not reserved.</li></ul>Use auto when the list can be changed dynamically eg the game list in the lobby. For optimization you can also use auto when you really expect a scrollbar, but don't want it to be shown when not needed eg the language list will need a scrollbar on most screens.
|
||||
* @anchor guivartype_resize_mode resize_mode |Determines how an image is resized. Possible values:<ul><li>scale - The image is scaled.</li><li>stretch - The first row or column of pixels is copied over the entire image. (Can only be used to scale resize in one direction, else falls back to scale.)</li><li>tile - The image is placed several times until the entire surface is filled. The last images are truncated.</li></ul>
|
||||
* @anchor guivartype_grow_direction grow_direction|Determines how an image is resized. Possible values:<ul><li>scale - The image is scaled.</li><li>stretch - The first row or column of pixels is copied over the entire image. (Can only be used to scale resize in one direction, else falls back to scale.)</li><li>tile - The image is placed several times until the entire surface is filled. The last images are truncated.</li></ul>
|
||||
*
|
||||
*
|
||||
* For more complex parts, there are sections. Sections contain of several lines of WML and can have sub sections. For example a grid has sub sections which contain various widgets. Here's the list of sections:
|
||||
* Variable |description
|
||||
* ------------------------------------------------|-----------
|
||||
* @anchor guivartype_section section |A generic section. The documentation about the section should describe the section in further detail.
|
||||
* @anchor guivartype_grid grid |A grid contains several widgets.
|
||||
* @anchor guivartype_config config |.
|
||||
*
|
||||
*
|
||||
* Every widget has some parts in common. First of all, every definition has the following fields:
|
||||
* Key |Type |Default |Description
|
||||
* Key |Type |Default |Description
|
||||
* -------------|------------------------------------|---------|-----------
|
||||
* id | @ref guivartype_string "string" |mandatory|Unique id for this gui (theme).
|
||||
* description | @ref guivartype_t_string "t_string"|mandatory|Unique translatable name for this gui.
|
||||
@ -1417,29 +1417,29 @@ int main(int argc, char** argv)
|
||||
|
||||
/**
|
||||
* @defgroup GUICanvasWML GUICanvasWML
|
||||
*
|
||||
*
|
||||
* A canvas is a blank drawing area on which the user can draw several shapes.
|
||||
* The drawing is done by adding WML structures to the canvas.
|
||||
*
|
||||
*
|
||||
* @section PreCommit Pre-commit
|
||||
*
|
||||
*
|
||||
* This section contains the pre commit functions.
|
||||
* These functions will be executed before the drawn canvas is applied on top of the normal background.
|
||||
* There should only be one pre commit section and its order regarding the other shapes doesn't matter.
|
||||
* The function has effect on the entire canvas, it's not possible to affect only a small part of the canvas.
|
||||
*
|
||||
* The function has effect on the entire canvas, it's not possible to affect only a small part of the canvas.
|
||||
*
|
||||
* @subsection Blur Blur
|
||||
*
|
||||
* Blurs the background before applying the canvas. This doesn't make sense if the widget isn't semi-transparent.
|
||||
*
|
||||
*
|
||||
* Blurs the background before applying the canvas. This doesn't make sense if the widget isn't semi-transparent.
|
||||
*
|
||||
* Keys:
|
||||
* Key |Type |Default |Description
|
||||
* Key |Type |Default |Description
|
||||
* -------------|------------------------------------|---------|-----------
|
||||
* depth | @ref guivartype_unsigned "unsigned"|0 |The depth to blur.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup GUIWindowDefinitionWML GUIWindowDefinitionWML
|
||||
*
|
||||
*
|
||||
* The window definition define how the windows shown in the dialog look.
|
||||
*/
|
Loading…
x
Reference in New Issue
Block a user