Make brackets to sections preferred.
Also does: - Add brackets to sections when not send. - Some code reformatting.
This commit is contained in:
parent
e78f048b24
commit
43ec60a6ac
2 changed files with 34 additions and 13 deletions
|
@ -29,6 +29,9 @@
|
|||
#include "formula_string_utils.hpp"
|
||||
#include "log.hpp"
|
||||
|
||||
static lg::log_domain log_engine("engine");
|
||||
#define WRN_NG LOG_STREAM(warn, log_engine)
|
||||
|
||||
void wml_exception(
|
||||
const char* cond
|
||||
, const char* file
|
||||
|
@ -62,11 +65,23 @@ void twml_exception::show(display &disp)
|
|||
gui2::show_error_message(disp.video(), sstr.str());
|
||||
}
|
||||
|
||||
std::string missing_mandatory_wml_key(const std::string §ion, const std::string &key,
|
||||
const std::string& primary_key, const std::string& primary_value)
|
||||
std::string missing_mandatory_wml_key(
|
||||
const std::string §ion
|
||||
, const std::string &key
|
||||
, const std::string& primary_key
|
||||
, const std::string& primary_value)
|
||||
{
|
||||
utils::string_map symbols;
|
||||
symbols["section"] = section;
|
||||
if(!section.empty()) {
|
||||
if(section[0] == '[') {
|
||||
symbols["section"] = section;
|
||||
} else {
|
||||
WRN_NG << __func__
|
||||
<< " parameter 'section' should contain brackets."
|
||||
<< " Added them.\n";
|
||||
symbols["section"] = "[" + section + "]";
|
||||
}
|
||||
}
|
||||
symbols["key"] = key;
|
||||
if(!primary_key.empty()) {
|
||||
assert(!primary_value.empty());
|
||||
|
|
|
@ -104,19 +104,25 @@ struct twml_exception: game::error
|
|||
};
|
||||
|
||||
/**
|
||||
* Returns a standard message for a missing wml key.
|
||||
* Returns a standard message for a missing wml key.
|
||||
*
|
||||
* @param section The section is which the key should appear.
|
||||
* @param key The ommitted key.
|
||||
* @param primary_key The primary key of the section.
|
||||
* @param primary_value
|
||||
* The value of the primary key (mandatory if primary key
|
||||
* isn't empty).
|
||||
* @param section The section is which the key should appear
|
||||
* (this should include the section brackets).
|
||||
* It may contain parent sections to make it
|
||||
* easier to find the wanted sections. They are
|
||||
* listed like [parent][child][section].
|
||||
* @param key The ommitted key.
|
||||
* @param primary_key The primary key of the section.
|
||||
* @param primary_value The value of the primary key (mandatory if
|
||||
* primary key isn't empty).
|
||||
*
|
||||
* @return The error message.
|
||||
* @returns The error message.
|
||||
*/
|
||||
std::string missing_mandatory_wml_key(const std::string& section, const std::string& key,
|
||||
const std::string& primary_key = "", const std::string& primary_value = "");
|
||||
std::string missing_mandatory_wml_key(
|
||||
const std::string& section
|
||||
, const std::string& key
|
||||
, const std::string& primary_key = ""
|
||||
, const std::string& primary_value = "");
|
||||
/**
|
||||
* Returns a standard warning message for using a deprecated wml key.
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue