Drop trailing underscore from public members.
This commit is contained in:
parent
dc0bf7458c
commit
38181e489a
4 changed files with 35 additions and 25 deletions
|
@ -723,7 +723,7 @@ expression_ptr parse_expression(const token* i1, const token* i2, function_symbo
|
|||
parse_expression(tok+1,i2-1,symbols)));
|
||||
}
|
||||
catch (formula_error& e){
|
||||
throw formula_error( e.type_, tokens_to_string(i1, i2-1), *i1->filename, i1->line_number );
|
||||
throw formula_error( e.type, tokens_to_string(i1, i2-1), *i1->filename, i1->line_number );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -761,7 +761,7 @@ expression_ptr parse_expression(const token* i1, const token* i2, function_symbo
|
|||
return expression_ptr( create_function(std::string(i1->begin,i1->end),args,symbols) );
|
||||
}
|
||||
catch(formula_error& e) {
|
||||
throw formula_error(e.type_, tokens_to_string(begin,end), *i1->filename, i1->line_number);
|
||||
throw formula_error(e.type, tokens_to_string(begin,end), *i1->filename, i1->line_number);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -776,7 +776,7 @@ expression_ptr parse_expression(const token* i1, const token* i2, function_symbo
|
|||
parse_expression(op+1,i2,symbols)));
|
||||
}
|
||||
catch(formula_error& e) {
|
||||
throw formula_error( e.type_, tokens_to_string(begin,end-1), *op->filename, op->line_number);
|
||||
throw formula_error( e.type, tokens_to_string(begin,end-1), *op->filename, op->line_number);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -60,15 +60,25 @@ private:
|
|||
|
||||
struct formula_error
|
||||
{
|
||||
formula_error() : type_(), formula_(), filename_(), line_(0)
|
||||
formula_error()
|
||||
: type()
|
||||
, formula()
|
||||
, filename()
|
||||
, line(0)
|
||||
{}
|
||||
formula_error(const std::string& type, const std::string& formula, const std::string& file, int line) :
|
||||
type_(type), formula_(formula), filename_(file), line_(line)
|
||||
|
||||
formula_error(const std::string& type, const std::string& formula,
|
||||
const std::string& file, int line)
|
||||
: type(type)
|
||||
, formula(formula)
|
||||
, filename(file)
|
||||
, line(line)
|
||||
{}
|
||||
std::string type_;
|
||||
std::string formula_;
|
||||
std::string filename_;
|
||||
int line_;
|
||||
|
||||
std::string type;
|
||||
std::string formula;
|
||||
std::string filename;
|
||||
int line;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -1365,15 +1365,15 @@ void formula_ai::handle_exception(game_logic::formula_error& e)
|
|||
|
||||
void formula_ai::handle_exception(game_logic::formula_error& e, const std::string& failed_operation)
|
||||
{
|
||||
LOG_AI << failed_operation << ": " << e.formula_ << std::endl;
|
||||
display_message(failed_operation + ": " + e.formula_);
|
||||
LOG_AI << failed_operation << ": " << e.formula << std::endl;
|
||||
display_message(failed_operation + ": " + e.formula);
|
||||
//if line number = 0, don't display info about filename and line number
|
||||
if (e.line_ != 0) {
|
||||
LOG_AI << e.type_ << " in " << e.filename_ << ":" << e.line_ << std::endl;
|
||||
display_message(e.type_ + " in " + e.filename_ + ":" + boost::lexical_cast<std::string>(e.line_));
|
||||
if (e.line != 0) {
|
||||
LOG_AI << e.type << " in " << e.filename << ":" << e.line << std::endl;
|
||||
display_message(e.type + " in " + e.filename + ":" + boost::lexical_cast<std::string>(e.line));
|
||||
} else {
|
||||
LOG_AI << e.type_ << std::endl;
|
||||
display_message(e.type_);
|
||||
LOG_AI << e.type << std::endl;
|
||||
display_message(e.type);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1406,8 +1406,8 @@ void formula_ai::play_turn()
|
|||
make_move(formula, callable);
|
||||
}
|
||||
catch(formula_error& e) {
|
||||
if(e.filename_ == "formula")
|
||||
e.line_ = 0;
|
||||
if(e.filename == "formula")
|
||||
e.line = 0;
|
||||
handle_exception( e, "Unit formula error for unit: '" + i->second.type_id() + "' standing at (" + boost::lexical_cast<std::string>(i->first.x+1) + "," + boost::lexical_cast<std::string>(i->first.y+1) + ")");
|
||||
}
|
||||
|
||||
|
@ -1421,8 +1421,8 @@ void formula_ai::play_turn()
|
|||
while ( make_move(loop_formula, callable) ) {}
|
||||
}
|
||||
catch(formula_error& e) {
|
||||
if(e.filename_ == "formula")
|
||||
e.line_ = 0;
|
||||
if(e.filename == "formula")
|
||||
e.line = 0;
|
||||
handle_exception( e, "Unit loop formula error for unit: '" + i->second.type_id() + "' standing at (" + boost::lexical_cast<std::string>(i->first.x+1) + "," + boost::lexical_cast<std::string>(i->first.y+1) + ")");
|
||||
}
|
||||
}
|
||||
|
@ -1505,7 +1505,7 @@ std::string formula_ai::evaluate(const std::string& formula_str)
|
|||
return v.to_debug_string();
|
||||
}
|
||||
catch(formula_error& e) {
|
||||
e.line_ = 0;
|
||||
e.line = 0;
|
||||
handle_exception(e);
|
||||
throw;
|
||||
}
|
||||
|
|
|
@ -2132,9 +2132,9 @@ int main(int argc, char** argv)
|
|||
std::cerr << "WML exception:\nUser message: "
|
||||
<< e.user_message << "\nDev message: " << e.dev_message << '\n';
|
||||
} catch(game_logic::formula_error& e) {
|
||||
std::cerr << "Formula error found in " << e.filename_ << ":" << e.line_
|
||||
<< "\nIn formula " << e.formula_
|
||||
<< "\nError: " << e.type_
|
||||
std::cerr << "Formula error found in " << e.filename << ":" << e.line
|
||||
<< "\nIn formula " << e.formula
|
||||
<< "\nError: " << e.type
|
||||
<< "\n\nGame will be aborted.\n";
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue