Strip trailing whitespace.
This commit is contained in:
parent
1f32116d33
commit
671b0b256c
60 changed files with 142 additions and 142 deletions
|
@ -2639,7 +2639,7 @@ void apply_shroud_changes(undo_list &undos, int side)
|
|||
// FIXME: A wml-killed unit will not update the shroud explored before its death
|
||||
if(unit_itor == units.end())
|
||||
continue;
|
||||
|
||||
|
||||
unit temporary_unit(unit_itor->second);
|
||||
// We're not really going to mutate the unit, just temporarily
|
||||
// set its moves to maximum, but then switch them back.
|
||||
|
|
|
@ -305,13 +305,13 @@ void attack_result::do_execute()
|
|||
set_error(E_UNABLE_TO_CHOOSE_ATTACKER_WEAPON);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
const unit *d_ = get_unit(get_info(),defender_loc_);
|
||||
const unit *a_ = get_unit(get_info(),attacker_loc_);
|
||||
|
||||
//@TODO: change ToD to be location specific for the defender unit
|
||||
recorder.add_attack(attacker_loc_, defender_loc_, attacker_weapon, defender_weapon, a_->type_id(),
|
||||
d_->type_id(), a_->level(), d_->level(), resources::tod_manager->turn(),
|
||||
d_->type_id(), a_->level(), d_->level(), resources::tod_manager->turn(),
|
||||
resources::tod_manager->get_time_of_day());
|
||||
rand_rng::invalidate_seed();
|
||||
rand_rng::clear_new_seed_callback();
|
||||
|
|
|
@ -164,7 +164,7 @@ component* ai_composite::get_child(const path_element &child)
|
|||
aspect_map::const_iterator a = get_aspects().find(child.id);
|
||||
if (a!=get_aspects().end()){
|
||||
return &*a->second;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
} else if (child.property=="stage") {
|
||||
//std::vector< stage_ptr >::iterator i = std::find_if(stages_.begin(),stages_.end(),path_element_matches< stage_ptr >(child));
|
||||
|
@ -262,7 +262,7 @@ bool ai_composite::delete_child(const path_element &child)
|
|||
get_goals().erase(i);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
//OOPS
|
||||
|
|
|
@ -103,7 +103,7 @@ bool aspect::redeploy(const config &cfg, const std::string& /*id*/)
|
|||
engine_ = cfg["engine"];
|
||||
name_ = cfg["name"];
|
||||
id_ = cfg["id"];
|
||||
DBG_AI_COMPOSITE_ASPECT << "redeploying aspect: engine=["<<engine_<<"], name=["<<name_<<"], id=["<<id_<<"]"<< std::endl;
|
||||
DBG_AI_COMPOSITE_ASPECT << "redeploying aspect: engine=["<<engine_<<"], name=["<<name_<<"], id=["<<id_<<"]"<< std::endl;
|
||||
if (invalidate_on_turn_start_) {
|
||||
manager::add_turn_started_observer(this);
|
||||
}
|
||||
|
|
|
@ -448,7 +448,7 @@ class variant_value_translator<attacks_vector> {
|
|||
public:
|
||||
|
||||
static void variant_to_value(const variant &/*var*/, attacks_vector &/*value*/)
|
||||
{
|
||||
{
|
||||
assert(false);//not implemented
|
||||
}
|
||||
|
||||
|
@ -622,7 +622,7 @@ public:
|
|||
}
|
||||
|
||||
virtual void recalculate() const = 0;
|
||||
|
||||
|
||||
|
||||
virtual boost::shared_ptr<T> get_ptr() const
|
||||
{
|
||||
|
|
|
@ -114,7 +114,7 @@ static component *find_component(component *root, const std::string &path, path_
|
|||
} catch (boost::bad_lexical_cast){
|
||||
pe.position = -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
DBG_AI_COMPOSITE << "adding path element: "<< pe << std::endl;
|
||||
elements.push_back(pe);
|
||||
}
|
||||
|
@ -129,9 +129,9 @@ static component *find_component(component *root, const std::string &path, path_
|
|||
if (c==NULL) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tail = *k_max;
|
||||
tail = *k_max;
|
||||
return c;
|
||||
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ bool component_manager::add_component(component *root, const std::string &path,
|
|||
return false;
|
||||
}
|
||||
return c->add_child(tail, cfg);
|
||||
|
||||
|
||||
}
|
||||
|
||||
bool component_manager::change_component(component *root, const std::string &path, const config &cfg)
|
||||
|
|
|
@ -44,7 +44,7 @@ public:
|
|||
fai_candidate_action_wrapper( rca_context &context, const config &cfg, game_logic::candidate_action_ptr fai_ca, formula_ai &_formula_ai )
|
||||
: candidate_action(context,cfg),fai_ca_(fai_ca),formula_ai_(_formula_ai),cfg_(cfg)//@todo 1.7: implement fai_ca->to_config()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
virtual ~fai_candidate_action_wrapper() {}
|
||||
|
|
|
@ -116,7 +116,7 @@ void configuration::init(const config &game_config)
|
|||
std::vector<description*> configuration::get_available_ais(){
|
||||
std::vector<description*> ais_list;
|
||||
for(description_map::iterator desc = ai_configurations_.begin(); desc!=ai_configurations_.end(); ++desc) {
|
||||
ais_list.push_back(&desc->second);
|
||||
ais_list.push_back(&desc->second);
|
||||
DBG_AI_CONFIGURATION << "has ai with config: "<< std::endl << desc->second.cfg<< std::endl;
|
||||
}
|
||||
return ais_list;
|
||||
|
@ -368,7 +368,7 @@ void configuration::upgrade_aspect_configs_from_1_07_02_to_1_07_03(side_number s
|
|||
cfg.add_child("ai",aiparam);
|
||||
}
|
||||
|
||||
DBG_AI_CONFIGURATION << "side "<< side <<": upgrading aspects from syntax of 1.7.2. to 1.7.3, old-style config is:" << std::endl << cfg << std::endl;
|
||||
DBG_AI_CONFIGURATION << "side "<< side <<": upgrading aspects from syntax of 1.7.2. to 1.7.3, old-style config is:" << std::endl << cfg << std::endl;
|
||||
foreach (const well_known_aspect &wka, well_known_aspects) {
|
||||
upgrade_aspect_config_from_1_07_02_to_1_07_03(side, cfg,parsed_cfg,wka.name_,wka.was_an_attribute_);
|
||||
}
|
||||
|
|
|
@ -1482,7 +1482,7 @@ bool ai_default::do_recruitment()
|
|||
return r->play_stage();
|
||||
}
|
||||
ERR_AI << "no recruitment aspect - skipping recruitment" << std::endl;
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ private:
|
|||
*/
|
||||
virtual int average_resistance_against(const unit_type& a, const unit_type& b) const;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
class ai_default : public virtual ai_context_proxy, public interface, public game_logic::formula_callable {
|
||||
|
|
|
@ -286,7 +286,7 @@ public:
|
|||
|
||||
|
||||
virtual void clear_additional_targets() const;
|
||||
|
||||
|
||||
|
||||
int get_recursion_count() const
|
||||
{
|
||||
|
|
|
@ -130,7 +130,7 @@ std::string formula_ai::evaluate(const std::string& formula_str)
|
|||
|
||||
if (ai_ptr_) {
|
||||
variant var = execute_variant(v, *ai_ptr_, true );
|
||||
|
||||
|
||||
if ( !var.is_empty() ) {
|
||||
return "Made move: " + var.to_debug_string();
|
||||
}
|
||||
|
@ -325,7 +325,7 @@ variant formula_ai::execute_variant(const variant& var, ai_context &ai_, bool co
|
|||
const set_var_callable* set_var_command = try_convert_variant<set_var_callable>(action);
|
||||
const set_unit_var_callable* set_unit_var_command = try_convert_variant<set_unit_var_callable>(action);
|
||||
const fallback_callable* fallback_command = try_convert_variant<fallback_callable>(action);
|
||||
|
||||
|
||||
if( move || move_partial ) {
|
||||
move_result_ptr move_result;
|
||||
|
||||
|
@ -355,7 +355,7 @@ variant formula_ai::execute_variant(const variant& var, ai_context &ai_, bool co
|
|||
}
|
||||
|
||||
if( move_result->is_gamestate_changed() )
|
||||
made_moves.push_back(action);
|
||||
made_moves.push_back(action);
|
||||
} else if(attack) {
|
||||
bool gamestate_changed = false;
|
||||
move_result_ptr move_result;
|
||||
|
@ -384,7 +384,7 @@ variant formula_ai::execute_variant(const variant& var, ai_context &ai_, bool co
|
|||
//attack failed
|
||||
|
||||
LOG_AI << "ERROR #" << attack_result->get_status() << " while executing 'attack' formula function\n\n";
|
||||
|
||||
|
||||
if(safe_call) {
|
||||
//safe_call was called, prepare error information
|
||||
error = variant(new safe_call_result(attack, attack_result->get_status()));
|
||||
|
@ -449,7 +449,7 @@ variant formula_ai::execute_variant(const variant& var, ai_context &ai_, bool co
|
|||
ERR_AI << "ERROR #" <<recruit_result->get_status() << " while executing 'recruit' formula function\n"<<std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//is_gamestate_changed()==true means that the game state was somehow changed by action.
|
||||
//it is believed that during a turn, a game state can change only a finite number of times
|
||||
if( recruit_result->is_gamestate_changed() )
|
||||
|
@ -489,7 +489,7 @@ variant formula_ai::execute_variant(const variant& var, ai_context &ai_, bool co
|
|||
error = variant(new safe_call_result(set_unit_var_command,
|
||||
status));
|
||||
}
|
||||
|
||||
|
||||
} else if( action.is_string() && action.as_string() == "recruit") {
|
||||
stage_ptr r = get_recruitment(ai_);
|
||||
if (r) {
|
||||
|
@ -555,7 +555,7 @@ variant formula_ai::execute_variant(const variant& var, ai_context &ai_, bool co
|
|||
}
|
||||
|
||||
//store the result in safe_call_callable case we would like to display it to the user
|
||||
//for example if this formula was executed from commandline
|
||||
//for example if this formula was executed from commandline
|
||||
safe_call->set_backup_result(backup_result);
|
||||
|
||||
error = variant();
|
||||
|
|
|
@ -64,7 +64,7 @@ public:
|
|||
|
||||
std::string evaluate(const std::string& formula_str);
|
||||
|
||||
virtual void add_formula_function(const std::string& name, game_logic::const_formula_ptr formula, game_logic::const_formula_ptr precondition, const std::vector<std::string>& args);
|
||||
virtual void add_formula_function(const std::string& name, game_logic::const_formula_ptr formula, game_logic::const_formula_ptr precondition, const std::vector<std::string>& args);
|
||||
|
||||
//class responsible for looking for possible infinite loops when calling set_var or set_unit_var
|
||||
class gamestate_change_observer : public events::observer
|
||||
|
|
|
@ -145,7 +145,7 @@ void move_candidate_action::evaluate(ai::formula_ai* ai, unit_map& units)
|
|||
score_ = 0;
|
||||
|
||||
candidate_action_filters::const_iterator me_filter = filter_map_.find("me");
|
||||
|
||||
|
||||
std::vector<variant> res;
|
||||
|
||||
for(unit_map::unit_iterator i = units.begin() ; i != units.end() ; ++i)
|
||||
|
@ -268,12 +268,12 @@ void attack_candidate_action::evaluate(ai::formula_ai* ai, unit_map& units)
|
|||
}
|
||||
enemy_units_flt.push_back(u_callable);
|
||||
}
|
||||
|
||||
|
||||
for( size_t my_unit = 0 ; my_unit < my_units_flt.size() ; ++my_unit){
|
||||
const unit_callable* my_unit_callalbe = my_units_flt[my_unit];
|
||||
for( size_t enemy_unit = 0 ; enemy_unit < enemy_units_flt.size() ; ++enemy_unit){
|
||||
if( ai->can_reach_unit( my_unit_callalbe->get_location(), enemy_units_flt[enemy_unit]->get_location() )) {
|
||||
|
||||
|
||||
game_logic::map_formula_callable callable(static_cast<const formula_callable*>(ai));
|
||||
callable.add_ref();
|
||||
callable.add("me", filtered_my_units[my_unit]);
|
||||
|
|
|
@ -294,7 +294,7 @@ private:
|
|||
for(size_t side = 0 ; side < units_input.num_elements() ; ++side) {
|
||||
if( leaders_input[side].is_empty() )
|
||||
continue;
|
||||
|
||||
|
||||
const map_location loc = convert_variant<location_callable>(leaders_input[side][0])->loc();
|
||||
const variant units_of_side = units_input[side];
|
||||
|
||||
|
@ -310,7 +310,7 @@ private:
|
|||
*j = *j / units_input[index].num_elements();
|
||||
|
||||
++index;
|
||||
}
|
||||
}
|
||||
//std::vector<variant> res;
|
||||
std::map<variant, variant> res;
|
||||
|
||||
|
@ -518,8 +518,8 @@ public:
|
|||
private:
|
||||
variant execute(const formula_callable& variables, formula_debugger *fdb) const {
|
||||
const map_location starting_loc = convert_variant<location_callable>(args()[0]->evaluate(variables,add_debug_info(fdb,0,"castle_locs:location")))->loc();
|
||||
|
||||
//looks like reimplementing a generic graph search algorithm to me
|
||||
|
||||
//looks like reimplementing a generic graph search algorithm to me
|
||||
std::set< map_location > visited_locs;
|
||||
std::queue< map_location > queued_locs;
|
||||
|
||||
|
|
|
@ -38,18 +38,18 @@ stage_rca_formulas::stage_rca_formulas(ai_context &context, const config &cfg, f
|
|||
{
|
||||
/* try {
|
||||
if( candidate_action_manager_.has_candidate_actions() ) {
|
||||
|
||||
|
||||
while( candidate_action_manager_.evaluate_candidate_actions(&fai_, get_info().units) )
|
||||
{
|
||||
game_logic::map_formula_callable callable(&fai_);
|
||||
callable.add_ref();
|
||||
|
||||
|
||||
candidate_action_manager_.update_callable_map( callable );
|
||||
|
||||
|
||||
game_logic::const_formula_ptr move_formula(candidate_action_manager_.get_best_action_formula());
|
||||
|
||||
|
||||
fai_.make_action(move_formula, callable);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -87,5 +87,5 @@ config stage_rca_formulas::to_config() const
|
|||
cfg.append(cfg_);
|
||||
return cfg;
|
||||
}
|
||||
|
||||
|
||||
} // end of namespace ai
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace ai {
|
|||
stage_side_formulas::stage_side_formulas(ai_context &context, const config &cfg, formula_ai &fai)
|
||||
: stage(context,cfg), cfg_(cfg), fai_(fai), move_formula_()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -67,7 +67,7 @@ bool stage_side_formulas::do_play_stage()
|
|||
|
||||
|
||||
void stage_side_formulas::on_create()
|
||||
{
|
||||
{
|
||||
move_formula_ = fai_.create_optional_formula(cfg_["move"]);
|
||||
}
|
||||
|
||||
|
@ -79,5 +79,5 @@ config stage_side_formulas::to_config() const
|
|||
cfg.append(cfg_);
|
||||
return cfg;
|
||||
}
|
||||
|
||||
|
||||
} // end of namespace ai
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace ai {
|
|||
stage_unit_formulas::stage_unit_formulas(ai_context &context, const config &cfg, formula_ai &fai)
|
||||
: stage(context,cfg), cfg_(cfg), fai_(fai)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -71,25 +71,25 @@ bool stage_unit_formulas::do_play_stage()
|
|||
if(e.filename == "formula")
|
||||
e.line = 0;
|
||||
fai_.handle_exception( e, "Unit priority 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) + ")");
|
||||
|
||||
|
||||
priority = 0;
|
||||
} catch(type_error& e) {
|
||||
priority = 0;
|
||||
ERR_AI << "formula type error while evaluating unit priority formula " << e.message << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
units_with_formulas.insert( game_logic::unit_formula_pair( i, priority ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for(game_logic::unit_formula_set::iterator pair_it = units_with_formulas.begin() ; pair_it != units_with_formulas.end() ; ++pair_it)
|
||||
{
|
||||
unit_map::iterator i = pair_it->first;
|
||||
|
||||
|
||||
if( i.valid() ) {
|
||||
|
||||
|
||||
if ( i->second.has_formula() ) {
|
||||
try {
|
||||
game_logic::const_formula_ptr formula(fai_.create_optional_formula(i->second.get_formula()));
|
||||
|
@ -151,5 +151,5 @@ config stage_unit_formulas::to_config() const
|
|||
//@todo: serialize to config
|
||||
return cfg;
|
||||
}
|
||||
|
||||
|
||||
} // end of namespace ai
|
||||
|
|
|
@ -302,10 +302,10 @@ public:
|
|||
|
||||
|
||||
/**
|
||||
* Returns a smart pointer to a new AI.
|
||||
* Returns a smart pointer to a new AI.
|
||||
* @param ai_algorithm_type type of AI algorithm to create
|
||||
* @param cfg a config of the ai
|
||||
* @param context context in which this ai is created
|
||||
* @param context context in which this ai is created
|
||||
* @return the reference to the created AI
|
||||
*/
|
||||
static ai_ptr create_transient_ai( const std::string &ai_algorithm_type, const config &cfg, ai_context *ai_context);
|
||||
|
@ -359,7 +359,7 @@ public:
|
|||
/**
|
||||
* Gets AI algorithm identifier for active AI of the given @a side.
|
||||
* @param side side number (1-based).
|
||||
* @return ai identifier for the active AI
|
||||
* @return ai identifier for the active AI
|
||||
*/
|
||||
static std::string get_active_ai_identifier_for_side( side_number side );
|
||||
|
||||
|
@ -367,7 +367,7 @@ public:
|
|||
/**
|
||||
* Gets AI config for active AI of the given @a side.
|
||||
* @param side side number (1-based).
|
||||
* @return a config object for the active AI
|
||||
* @return a config object for the active AI
|
||||
*/
|
||||
static config to_config( side_number side );
|
||||
|
||||
|
|
|
@ -238,7 +238,7 @@ static register_aspect_factory< standard_aspect<double> >
|
|||
|
||||
static register_aspect_factory< standard_aspect<int> >
|
||||
villages_per_scout__standard_aspect_factory("villages_per_scout*standard_aspect");
|
||||
|
||||
|
||||
|
||||
//name = default
|
||||
static register_aspect_factory< standard_aspect<double> >
|
||||
|
|
|
@ -56,7 +56,7 @@ void ai_testing::log_turn(const char* msg, unsigned int side)
|
|||
DBG_AI_TESTING << msg << "_GOLD" << side << ": " << _gold << std::endl;
|
||||
DBG_AI_TESTING << msg << "_VILLAGES" << side << ": " << _villages << std::endl;
|
||||
DBG_AI_TESTING << msg << "_INCOME" << side << ": " << _income << std::endl;
|
||||
|
||||
|
||||
config c;
|
||||
c["side"] = str_cast(side);
|
||||
c["turn"] = str_cast(_turn_number);
|
||||
|
|
|
@ -1833,7 +1833,7 @@ simple_move_and_targeting_phase::~simple_move_and_targeting_phase()
|
|||
double simple_move_and_targeting_phase::evaluate()
|
||||
{
|
||||
unit_map &units_ = get_info().units;
|
||||
|
||||
|
||||
unit_map::const_iterator leader = units_.find_leader(get_side());
|
||||
map_location my_leader_loc = map_location::null_location;
|
||||
if (leader.valid()) {
|
||||
|
|
|
@ -252,7 +252,7 @@ private:
|
|||
void get_villages(const moves_map &possible_moves,
|
||||
const move_map &dstsrc, const move_map &enemy_dstsrc,
|
||||
unit_map::const_iterator &leader);
|
||||
|
||||
|
||||
|
||||
void find_villages(
|
||||
treachmap& reachmap,
|
||||
|
|
|
@ -250,7 +250,7 @@ void unit_callable::get_inputs(std::vector<game_logic::formula_input>* inputs) c
|
|||
inputs->push_back(game_logic::formula_input("side", FORMULA_READ_ONLY));
|
||||
inputs->push_back(game_logic::formula_input("states", FORMULA_READ_ONLY));
|
||||
inputs->push_back(game_logic::formula_input("cost", FORMULA_READ_ONLY));
|
||||
inputs->push_back(game_logic::formula_input("usage", FORMULA_READ_ONLY));
|
||||
inputs->push_back(game_logic::formula_input("usage", FORMULA_READ_ONLY));
|
||||
inputs->push_back(game_logic::formula_input("vars", FORMULA_READ_ONLY));
|
||||
}
|
||||
|
||||
|
|
|
@ -334,7 +334,7 @@ public:
|
|||
void merge_children(const std::string& key);
|
||||
|
||||
/**
|
||||
* All children with the given key and with equal values
|
||||
* All children with the given key and with equal values
|
||||
* of the specified attribute will be merged into the
|
||||
* element with that key and that value of the attribute
|
||||
*/
|
||||
|
|
|
@ -25,7 +25,7 @@ lg::log_domain log_editor("editor");
|
|||
|
||||
namespace editor {
|
||||
|
||||
EXIT_STATUS start(config& game_conf, CVideo& video, const std::string& filename /* = "" */,
|
||||
EXIT_STATUS start(config& game_conf, CVideo& video, const std::string& filename /* = "" */,
|
||||
bool take_screenshot /* = false */, const std::string& screenshot_filename /* = "map_screenshot.bmp" */)
|
||||
{
|
||||
EXIT_STATUS e = EXIT_ERROR;
|
||||
|
|
|
@ -123,7 +123,7 @@ private:
|
|||
first_item = false;
|
||||
}
|
||||
s << a->str();
|
||||
}
|
||||
}
|
||||
s << ']';
|
||||
return s.str();
|
||||
}
|
||||
|
@ -907,7 +907,7 @@ expression_ptr parse_expression(const token* i1, const token* i2, function_symbo
|
|||
iterator dot = i1->begin;
|
||||
while( *dot != '.' )
|
||||
dot++;
|
||||
|
||||
|
||||
int n = atoi(std::string(i1->begin,dot).c_str());
|
||||
|
||||
iterator end = i1->end;
|
||||
|
|
|
@ -98,7 +98,7 @@ protected:
|
|||
//for example: formula_callable < terrain_callable < unit_type_callable ...
|
||||
enum TYPE { FORMULA_C, TERRAIN_C, LOCATION_C, UNIT_TYPE_C, UNIT_C,
|
||||
ATTACK_TYPE_C, MOVE_PARTIAL_C, MOVE_C, ATTACK_C, MOVE_MAP_C };
|
||||
|
||||
|
||||
TYPE type_;
|
||||
private:
|
||||
virtual variant get_value(const std::string& key) const = 0;
|
||||
|
|
|
@ -154,7 +154,7 @@ void formula_debugger::check_breakpoints()
|
|||
}
|
||||
|
||||
void formula_debugger::show_gui()
|
||||
{
|
||||
{
|
||||
if (resources::screen == NULL) {
|
||||
WRN_FDB << "do not showing debug window due to NULL gui" << std::endl;
|
||||
return;
|
||||
|
@ -174,7 +174,7 @@ void formula_debugger::call_stack_push(const std::string &str)
|
|||
f_name_extra_debug_info = "";
|
||||
execution_trace_.push_back(call_stack_.back());
|
||||
}
|
||||
|
||||
|
||||
|
||||
void formula_debugger::call_stack_pop()
|
||||
{
|
||||
|
@ -241,7 +241,7 @@ variant formula_debugger::evaluate_formula_callback(const formula &f)
|
|||
base_breakpoint::base_breakpoint(formula_debugger &fdb, const std::string &name, bool one_time_only)
|
||||
: fdb_(fdb), name_(name), one_time_only_(one_time_only)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -86,11 +86,11 @@ public:
|
|||
|
||||
|
||||
void call_stack_push(const std::string &str);
|
||||
|
||||
|
||||
|
||||
|
||||
void call_stack_pop();
|
||||
|
||||
|
||||
|
||||
void call_stack_set_evaluated(bool evaluated);
|
||||
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ std::string function_expression::str() const
|
|||
first_arg = false;
|
||||
}
|
||||
s << a->str();
|
||||
}
|
||||
}
|
||||
s << ')';
|
||||
return s.str();
|
||||
}
|
||||
|
@ -746,7 +746,7 @@ private:
|
|||
for( size_t i = 0; i < args().size() ; i++)
|
||||
args()[i]->evaluate(variables,fdb);
|
||||
}
|
||||
|
||||
|
||||
return variant();
|
||||
}
|
||||
};
|
||||
|
|
16
src/game.cpp
16
src/game.cpp
|
@ -360,7 +360,7 @@ game_controller::game_controller(int argc, char** argv) :
|
|||
force_bpp_ = 32;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
else if(val == "--smallgui") {
|
||||
game_config::small_gui = true;
|
||||
} else if(val == "--config-dir") {
|
||||
|
@ -428,7 +428,7 @@ game_controller::game_controller(int argc, char** argv) :
|
|||
gui2::new_widgets = true;
|
||||
} else if(val == "--new-uploader") {
|
||||
//hidden option to test experimental game log upload changes
|
||||
uploader_settings::new_uploader = true;
|
||||
uploader_settings::new_uploader = true;
|
||||
#ifndef DISABLE_EDITOR
|
||||
} else if(val == "-e" || val == "--editor") {
|
||||
jump_to_editor_ = true;
|
||||
|
@ -714,14 +714,14 @@ bool game_controller::play_screenshot_mode()
|
|||
if(!screenshot_mode_) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
#ifndef DISABLE_EDITOR
|
||||
cache_.clear_defines();
|
||||
cache_.add_define("EDITOR");
|
||||
load_game_cfg();
|
||||
const binary_paths_manager bin_paths_manager(game_config_);
|
||||
::init_textdomains(game_config_);
|
||||
|
||||
|
||||
editor::start(game_config_, video_, screenshot_map_, true, screenshot_filename_);
|
||||
return false;
|
||||
#else
|
||||
|
@ -925,9 +925,9 @@ bool game_controller::play_multiplayer_mode()
|
|||
foreach (config &s, level.child_range("side")) {
|
||||
if( s["controller"] != "ai" ) {
|
||||
all_ai = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
upload_log log( all_ai && uploader_settings::new_uploader );
|
||||
recorder.add_log_data("ai_log","ai_label",label);
|
||||
|
||||
|
@ -1837,9 +1837,9 @@ static int process_command_args(int argc, char** argv) {
|
|||
return 2;
|
||||
}
|
||||
static char opt[] = "SDL_VIDEODRIVER=dummy";
|
||||
SDL_putenv(opt);
|
||||
SDL_putenv(opt);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
else if(val == "--config-dir") {
|
||||
if (argc <= ++arg)
|
||||
break;
|
||||
|
|
|
@ -1200,17 +1200,17 @@ void game_display::send_notification(const std::string& /*owner*/, const std::st
|
|||
CFStringRef cf_message = CFStringCreateWithCString(NULL, message.c_str(), kCFStringEncodingUTF8);
|
||||
//Should be changed as soon as there are more than 2 types of notifications
|
||||
CFStringRef cf_note_name = CFStringCreateWithCString(NULL, owner == "Turn changed" ? "Turn changed" : "Chat message", kCFStringEncodingUTF8);
|
||||
|
||||
|
||||
growl_obj.applicationName = app_name;
|
||||
growl_obj.registrationDictionary = NULL;
|
||||
growl_obj.applicationIconData = NULL;
|
||||
growl_obj.growlIsReady = NULL;
|
||||
growl_obj.growlNotificationWasClicked = NULL;
|
||||
growl_obj.growlNotificationTimedOut = NULL;
|
||||
|
||||
|
||||
Growl_SetDelegate(&growl_obj);
|
||||
Growl_NotifyWithTitleDescriptionNameIconPriorityStickyClickContext(cf_owner, cf_message, cf_note_name, NULL, NULL, NULL, NULL);
|
||||
|
||||
|
||||
CFRelease(app_name);
|
||||
CFRelease(cf_owner);
|
||||
CFRelease(cf_message);
|
||||
|
|
|
@ -2399,7 +2399,7 @@ WML_HANDLER_FUNCTION(store_unit_type, /*event_info*/, cfg)
|
|||
if(variable.empty()) {
|
||||
variable="unit_type";
|
||||
}
|
||||
|
||||
|
||||
std::vector<std::string> types_to_store = utils::split(type_name);
|
||||
unit_type_data::unit_type_map_wrapper &ut_map = unit_type_data::types();
|
||||
|
||||
|
@ -2410,7 +2410,7 @@ WML_HANDLER_FUNCTION(store_unit_type, /*event_info*/, cfg)
|
|||
if(ut != ut_map.end()) {
|
||||
resources::state_of_game->add_variable_cfg(variable, ut->second.get_cfg());
|
||||
} else {
|
||||
lg::wml_error << "attempt to store nonexistent unit_type \""
|
||||
lg::wml_error << "attempt to store nonexistent unit_type \""
|
||||
<< types_to_store[i] << "\"\n";
|
||||
}
|
||||
}
|
||||
|
@ -3107,7 +3107,7 @@ WML_HANDLER_FUNCTION(message, event_info, cfg)
|
|||
play_controller *controller = resources::controller;
|
||||
if(!has_input && (
|
||||
controller->is_skiping_replay() ||
|
||||
current_context->skip_messages
|
||||
current_context->skip_messages
|
||||
))
|
||||
{
|
||||
return;
|
||||
|
|
|
@ -237,7 +237,7 @@ void add_completed_campaign(const std::string& campaign_id) {
|
|||
|
||||
bool is_campaign_completed(const std::string& campaign_id) {
|
||||
std::vector<std::string> completed = utils::split(preferences::get("completed_campaigns"));
|
||||
|
||||
|
||||
return std::find(completed.begin(), completed.end(), campaign_id) != completed.end();
|
||||
}
|
||||
|
||||
|
|
|
@ -178,7 +178,7 @@ void write_players(game_state& gamestate, config& cfg, const bool use_snapshot,
|
|||
} else {
|
||||
source = &gamestate.starting_pos;
|
||||
}
|
||||
|
||||
|
||||
if (merge_side) {
|
||||
//merge sides/players from starting pos with the scenario cfg
|
||||
std::vector<std::string> tags;
|
||||
|
@ -603,7 +603,7 @@ void game_state::build_team(const config& side_cfg,
|
|||
side_cfg["controller"] == "human_ai" ||
|
||||
utils::string_bool(side_cfg["persistent"])) {
|
||||
player_exists = true;
|
||||
|
||||
|
||||
//if we have a snapshot, level contains team information
|
||||
//else, we look for [side] or [player] (deprecated) tags in starting_pos
|
||||
if (snapshot) {
|
||||
|
@ -652,7 +652,7 @@ void game_state::build_team(const config& side_cfg,
|
|||
}
|
||||
} catch (config::error&) {
|
||||
ERR_NG << "player tag for " << save_id << " does not have gold information\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LOG_NG << "set gold to '" << ngold << "'\n";
|
||||
|
@ -686,7 +686,7 @@ void game_state::build_team(const config& side_cfg,
|
|||
// If this side tag describes the leader of the side
|
||||
if(!utils::string_bool(side_cfg["no_leader"]) && side_cfg["controller"] != "null") {
|
||||
unit new_unit(&units, side_cfg, true);
|
||||
|
||||
|
||||
if (player_cfg != NULL) {
|
||||
for(std::vector<unit>::iterator it = teams.back().recall_list().begin();
|
||||
it != teams.back().recall_list().end(); ++it) {
|
||||
|
|
|
@ -36,7 +36,7 @@ struct tmessage_implementation
|
|||
{
|
||||
/**
|
||||
* Initialiazes a button.
|
||||
*
|
||||
*
|
||||
* @param window The window that contains the button.
|
||||
* @param button_status The button status to modify.
|
||||
* @param id The id of the button.
|
||||
|
|
|
@ -156,20 +156,20 @@ void show_message(CVideo& video, const std::string& title,
|
|||
* upon.
|
||||
* @param title The title of the dialog.
|
||||
* @param message The message to show in the dialog.
|
||||
* @param button_style The style of the button(s) shown.
|
||||
* @param button_style The style of the button(s) shown.
|
||||
* @param message_markup_mode The markup mode used for the title.
|
||||
* @param title_markup_mod The markup mode used for the title.
|
||||
*
|
||||
* @returns The retval of the dialog shown.
|
||||
*
|
||||
* @returns The retval of the dialog shown.
|
||||
*/
|
||||
int show_message(CVideo& video, const std::string& title,
|
||||
const std::string& message, const tmessage::tbutton_style button_style,
|
||||
const tcontrol::tmarkup_mode message_markup_mode = tcontrol::NO_MARKUP,
|
||||
const tcontrol::tmarkup_mode title_markup_mode = tcontrol::NO_MARKUP);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Shows an error message to the user.
|
||||
*
|
||||
*
|
||||
* @param video The video which contains the surface to draw
|
||||
* upon.
|
||||
* @param message The message to show in the dialog.
|
||||
|
|
|
@ -44,7 +44,7 @@ private:
|
|||
/** Hold the tips of the day. */
|
||||
config tips_;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Updates the tip of day widget.
|
||||
*
|
||||
* @param previous Show the previous tip, else shows the next
|
||||
|
|
|
@ -97,7 +97,7 @@ public:
|
|||
|
||||
/***** ***** ***** ***** Easy close handling ***** ***** ***** *****/
|
||||
|
||||
/**
|
||||
/**
|
||||
* Inherited from twidget.
|
||||
*
|
||||
* The default behavious is that a widget blocks easy close, if not it
|
||||
|
|
|
@ -29,7 +29,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Wrapper for set_label.
|
||||
*
|
||||
* Some people considered this function missing and confusing so added
|
||||
|
@ -42,7 +42,7 @@ public:
|
|||
set_label(label);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Wrapper for label.
|
||||
*
|
||||
* Some people considered this function missing and confusing so added
|
||||
|
|
|
@ -38,7 +38,7 @@ public:
|
|||
state_(ENABLED),
|
||||
text_(),
|
||||
selection_start_(0),
|
||||
selection_length_(0),
|
||||
selection_length_(0),
|
||||
key_press_callback_() {
|
||||
}
|
||||
|
||||
|
@ -402,7 +402,7 @@ protected:
|
|||
virtual void handle_key_default(
|
||||
bool& handled, SDLKey key, SDLMod modifier, Uint16 unicode);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Key press callback.
|
||||
*
|
||||
* This callback is called in key_press before the other functions. The
|
||||
|
@ -416,7 +416,7 @@ protected:
|
|||
*/
|
||||
boost::function< bool (twidget*, SDLKey, SDLMod, Uint16) > key_press_callback_;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Text changed callback.
|
||||
*
|
||||
* This callback is called in key_press after the key_press event has been
|
||||
|
|
|
@ -93,7 +93,7 @@ struct bad_lexical_cast {};
|
|||
namespace implementation {
|
||||
|
||||
/**
|
||||
* Base class for the conversion.
|
||||
* Base class for the conversion.
|
||||
*
|
||||
* Since functions can't be partially specialized we use a class, which can be
|
||||
* partially specialized for the conversion.
|
||||
|
|
|
@ -357,7 +357,7 @@ marked_route mouse_handler::get_route(unit_map::const_iterator un, map_location
|
|||
// maybe reserve head and tail and reinitialize it each time ?
|
||||
waypoints_.push_front(un->first);
|
||||
waypoints_.push_back(go_to);
|
||||
|
||||
|
||||
std::list<map_location>::const_iterator wsrc = waypoints_.begin(),
|
||||
wdst = ++waypoints_.begin();
|
||||
|
||||
|
@ -711,8 +711,8 @@ bool mouse_handler::attack_enemy_(unit_map::iterator attacker, unit_map::iterato
|
|||
|
||||
gui().draw();
|
||||
//@TODO: change ToD to be location specific for the defender
|
||||
recorder.add_attack(attacker_loc, defender_loc, att.attack_num, def.attack_num,
|
||||
attacker->second.type_id(), defender->second.type_id(), att.level,
|
||||
recorder.add_attack(attacker_loc, defender_loc, att.attack_num, def.attack_num,
|
||||
attacker->second.type_id(), defender->second.type_id(), att.level,
|
||||
def.level, resources::tod_manager->turn(), resources::tod_manager->get_time_of_day());
|
||||
rand_rng::invalidate_seed();
|
||||
if (rand_rng::has_valid_seed()) { //means SRNG is disabled
|
||||
|
|
|
@ -1039,7 +1039,7 @@ bool play_controller::in_context_menu(hotkey::HOTKEY_COMMAND command) const
|
|||
// Enable recruit/recall on castle/keep tiles
|
||||
for(unit_map::const_iterator leader = units_.begin();
|
||||
leader != units_.end();leader++) {
|
||||
if (leader->second.can_recruit() &&
|
||||
if (leader->second.can_recruit() &&
|
||||
static_cast<int>(leader->second.side()) == player_number_ &&
|
||||
can_recruit_on(map_, leader->first, mouse_handler_.get_last_hex()))
|
||||
return true;
|
||||
|
|
|
@ -179,7 +179,7 @@ void playsingle_controller::continue_move(){
|
|||
}
|
||||
|
||||
void playsingle_controller::add_waypoint(){
|
||||
if (!browse_)
|
||||
if (!browse_)
|
||||
mouse_handler_.add_waypoint(mouse_handler_.get_last_hex());
|
||||
}
|
||||
|
||||
|
@ -364,7 +364,7 @@ LEVEL_RESULT playsingle_controller::play_scenario(
|
|||
utils::string_bool(end_cfg["bonus"], true),
|
||||
false
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Avoid autosaving after loading, but still
|
||||
|
@ -488,7 +488,7 @@ LEVEL_RESULT playsingle_controller::play_scenario(
|
|||
gamestate_.snapshot = config();
|
||||
store_recalls();
|
||||
store_gold(end_level);
|
||||
|
||||
|
||||
return VICTORY;
|
||||
}
|
||||
} // end catch
|
||||
|
@ -907,12 +907,12 @@ void playsingle_controller::store_gold(end_level_exception& end_level, const boo
|
|||
title = _("Victory");
|
||||
report << font::BOLD_TEXT << _("You have emerged victorious!") << "\n~\n";
|
||||
}
|
||||
|
||||
|
||||
int persistent_teams = 0;
|
||||
for(std::vector<team>::iterator j=teams_.begin(); j!=teams_.end(); ++j) {
|
||||
if (j->persistent()) persistent_teams++;
|
||||
}
|
||||
|
||||
|
||||
if (persistent_teams > 0 &&
|
||||
(has_next_scenario ||
|
||||
gamestate_.classification().campaign_type == "test")) {
|
||||
|
|
|
@ -971,7 +971,7 @@ bool do_replay_handle(int side_num, const std::string &do_untill)
|
|||
if(current_team.recall_list().empty()) {
|
||||
replay::throw_error("illegal recall\n");
|
||||
}
|
||||
|
||||
|
||||
sort_units(current_team.recall_list());
|
||||
|
||||
const std::string& recall_num = child["value"];
|
||||
|
@ -1059,7 +1059,7 @@ bool do_replay_handle(int side_num, const std::string &do_untill)
|
|||
replay::throw_error(errbuf.str());
|
||||
}
|
||||
|
||||
bool show_move = preferences::show_ai_moves() || !(current_team.is_ai() || current_team.is_network_ai());
|
||||
bool show_move = preferences::show_ai_moves() || !(current_team.is_ai() || current_team.is_network_ai());
|
||||
::move_unit(NULL, steps, NULL, NULL, show_move, NULL, true, true, true);
|
||||
|
||||
//NOTE: The AI fire sighetd event whem moving in the FoV of team 1
|
||||
|
|
|
@ -68,7 +68,7 @@ public:
|
|||
void add_log_data(const std::string &key, const std::string &var);
|
||||
void add_log_data(const std::string &category, const std::string &key, const std::string &var);
|
||||
void add_log_data(const std::string &category, const std::string &key, const config& c);
|
||||
|
||||
|
||||
/**
|
||||
* Mark an expected advancement adding it to the queue
|
||||
*/
|
||||
|
|
|
@ -30,13 +30,13 @@ private:
|
|||
const network::manager net_manager_;
|
||||
network::server_manager server_;
|
||||
wesnothd::ban_manager ban_manager_;
|
||||
|
||||
|
||||
struct connection_log {
|
||||
connection_log(std::string _nick, std::string _ip, time_t _log_off) :
|
||||
nick(_nick), ip(_ip), log_off(_log_off) {}
|
||||
std::string nick, ip;
|
||||
time_t log_off;
|
||||
|
||||
|
||||
bool operator==(const connection_log& c) {
|
||||
// log off time does not matter to find ip-nick pairs
|
||||
return c.nick == nick && c.ip == ip;
|
||||
|
|
|
@ -42,10 +42,10 @@ class user_handler {
|
|||
{
|
||||
}
|
||||
|
||||
virtual ~user_handler()
|
||||
{
|
||||
virtual ~user_handler()
|
||||
{
|
||||
if(mailer_) {
|
||||
delete mailer_;
|
||||
delete mailer_;
|
||||
mailer_ = NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -409,7 +409,7 @@ void part_ui::render_story_box()
|
|||
}
|
||||
|
||||
SDL_Rect update_area = { 0, fix_text_y, screen_area().w, fix_text_h };
|
||||
|
||||
|
||||
/* do */ {
|
||||
// this should kill the tiniest flickering caused
|
||||
// by the buttons being hidden and unhidden in this scope.
|
||||
|
|
|
@ -173,7 +173,7 @@ team::team_info::team_info(const config& cfg) :
|
|||
controller = AI;
|
||||
persistent = false;
|
||||
}
|
||||
|
||||
|
||||
//override persistence flag if it is explicitly defined in the config
|
||||
persistent = utils::string_bool(cfg["persistent"], persistent);
|
||||
|
||||
|
|
|
@ -21,13 +21,13 @@ namespace test_utils {
|
|||
|
||||
/**
|
||||
* Gets a fake test display.
|
||||
*
|
||||
*
|
||||
* The width and height parameter are ignored if either of them is less
|
||||
* than zero.
|
||||
*
|
||||
* @param width The width of the display.
|
||||
* @param height The height of the dislay.
|
||||
*
|
||||
*
|
||||
* @returns The display.
|
||||
*/
|
||||
game_display& get_fake_display(
|
||||
|
|
|
@ -155,7 +155,7 @@ public:
|
|||
* @param markedup Should the text be rendered with pango
|
||||
* markup. If the markup is invalid it's
|
||||
* rendered as text without markup.
|
||||
*
|
||||
*
|
||||
* @returns The status, if rendered as markup and the
|
||||
* markup contains errors, false is returned
|
||||
* else true.
|
||||
|
|
|
@ -83,7 +83,7 @@ class tod_manager : public savegame_config
|
|||
* empty one to remove all local time areas.
|
||||
*/
|
||||
void remove_time_area(const std::string& id);
|
||||
|
||||
|
||||
void next_time_of_day();
|
||||
const std::vector<time_of_day> times() const {return times_;}
|
||||
|
||||
|
|
|
@ -861,7 +861,7 @@ const std::map<std::string,std::string> unit::get_states() const
|
|||
if (get_state(i->second)) {
|
||||
all_states.insert(make_pair(i->first, "yes" ));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return all_states;
|
||||
}
|
||||
|
|
|
@ -694,7 +694,7 @@ bool unit_animation::particule::need_minimal_update() const
|
|||
{
|
||||
if(get_current_frame_begin_time() != last_frame_begin_time_ ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -280,7 +280,7 @@ void upload_log::read_replay()
|
|||
cfg.add_child("attack",c.child("attack"));
|
||||
cfg.add_child("results",c2.child("results"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -318,7 +318,7 @@ upload_log::~upload_log()
|
|||
#endif
|
||||
|
||||
std::ostream *out = ostream_file(filename_);
|
||||
|
||||
|
||||
if(uploader_settings::new_uploader) {
|
||||
boost::iostreams::filtering_stream<boost::iostreams::output> filter;
|
||||
filter.push(boost::iostreams::gzip_compressor());
|
||||
|
@ -365,7 +365,7 @@ void upload_log::start(game_state &state, const team &team,
|
|||
int side_number,
|
||||
const unit_map &units,
|
||||
const t_string &turn,
|
||||
int num_turns,
|
||||
int num_turns,
|
||||
const std::string map_data)
|
||||
{
|
||||
std::vector<const unit*> all_units;
|
||||
|
|
|
@ -539,7 +539,7 @@ variant variant::operator-(const variant& v) const
|
|||
if(type_ == TYPE_DECIMAL || v.type_ == TYPE_DECIMAL) {
|
||||
return variant( as_decimal() - v.as_decimal() , DECIMAL_VARIANT);
|
||||
}
|
||||
|
||||
|
||||
return variant(as_int() - v.as_int());
|
||||
}
|
||||
|
||||
|
@ -624,7 +624,7 @@ variant variant::operator^(const variant& v) const
|
|||
|
||||
if( res > 0.5 )
|
||||
i++;
|
||||
|
||||
|
||||
return variant( i , variant::DECIMAL_VARIANT);
|
||||
}
|
||||
|
||||
|
@ -771,7 +771,7 @@ variant variant::list_elements_add(const variant& v) const
|
|||
v.must_be(TYPE_LIST);
|
||||
|
||||
if( num_elements() != v.num_elements() )
|
||||
throw type_error("Operator '.+' requires two lists of the same length");
|
||||
throw type_error("Operator '.+' requires two lists of the same length");
|
||||
|
||||
std::vector< variant > res;
|
||||
res.reserve(num_elements());
|
||||
|
@ -789,7 +789,7 @@ variant variant::list_elements_sub(const variant& v) const
|
|||
v.must_be(TYPE_LIST);
|
||||
|
||||
if( num_elements() != v.num_elements() )
|
||||
throw type_error("Operator '.-' requires two lists of the same length");
|
||||
throw type_error("Operator '.-' requires two lists of the same length");
|
||||
|
||||
std::vector< variant > res;
|
||||
res.reserve(num_elements());
|
||||
|
@ -807,7 +807,7 @@ variant variant::list_elements_mul(const variant& v) const
|
|||
v.must_be(TYPE_LIST);
|
||||
|
||||
if( num_elements() != v.num_elements() )
|
||||
throw type_error("Operator '.*' requires two lists of the same length");
|
||||
throw type_error("Operator '.*' requires two lists of the same length");
|
||||
|
||||
std::vector< variant > res;
|
||||
res.reserve(num_elements());
|
||||
|
@ -825,7 +825,7 @@ variant variant::list_elements_div(const variant& v) const
|
|||
v.must_be(TYPE_LIST);
|
||||
|
||||
if( num_elements() != v.num_elements() )
|
||||
throw type_error("Operator './' requires two lists of the same length");
|
||||
throw type_error("Operator './' requires two lists of the same length");
|
||||
|
||||
std::vector< variant > res;
|
||||
res.reserve(num_elements());
|
||||
|
@ -1042,7 +1042,7 @@ std::string variant::to_debug_string(std::vector<const game_logic::formula_calla
|
|||
}
|
||||
|
||||
s << fractional;
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
case TYPE_LIST: {
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
|
||||
enum TYPE { TYPE_NULL, TYPE_INT, TYPE_DECIMAL, TYPE_CALLABLE, TYPE_LIST, TYPE_STRING, TYPE_MAP };
|
||||
|
||||
enum DECIMAL_VARIANT_TYPE { DECIMAL_VARIANT };
|
||||
enum DECIMAL_VARIANT_TYPE { DECIMAL_VARIANT };
|
||||
|
||||
variant();
|
||||
explicit variant(int n);
|
||||
|
@ -67,7 +67,7 @@ public:
|
|||
bool is_decimal() const { return type_ == TYPE_DECIMAL; }
|
||||
bool is_map() const { return type_ == TYPE_MAP; }
|
||||
int as_int() const { if(type_ == TYPE_NULL) { return 0; } must_be(TYPE_INT); return int_value_; }
|
||||
|
||||
|
||||
//this function returns variant's internal representation of decimal number:
|
||||
//for example number 1.234 is represented as 1234
|
||||
int as_decimal() const;
|
||||
|
@ -102,7 +102,7 @@ public:
|
|||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
variant operator+(const variant&) const;
|
||||
variant operator-(const variant&) const;
|
||||
variant operator*(const variant&) const;
|
||||
|
|
Loading…
Add table
Reference in a new issue