Deployed std::make_unique and std::make_shared in more places
This commit is contained in:
parent
29c9f1d298
commit
cc2cc29376
19 changed files with 58 additions and 62 deletions
|
@ -715,18 +715,18 @@ int battle_context::choose_defender_weapon(const unit& attacker,
|
|||
for(i = 0; i < choices.size(); ++i) {
|
||||
const attack_type& def = defender.attacks()[choices[i]];
|
||||
|
||||
std::unique_ptr<battle_context_unit_stats> att_stats(new battle_context_unit_stats(
|
||||
attacker, attacker_loc, attacker_weapon, true, defender, defender_loc, def.shared_from_this(), units));
|
||||
auto att_stats = std::make_unique<battle_context_unit_stats>(
|
||||
attacker, attacker_loc, attacker_weapon, true, defender, defender_loc, def.shared_from_this(), units);
|
||||
|
||||
std::unique_ptr<battle_context_unit_stats> def_stats(new battle_context_unit_stats(
|
||||
defender, defender_loc, choices[i], false, attacker, attacker_loc, att.shared_from_this(), units));
|
||||
auto def_stats = std::make_unique<battle_context_unit_stats>(
|
||||
defender, defender_loc, choices[i], false, attacker, attacker_loc, att.shared_from_this(), units);
|
||||
|
||||
if(def_stats->disable) {
|
||||
continue;
|
||||
}
|
||||
|
||||
std::unique_ptr<combatant> att_comb(new combatant(*att_stats));
|
||||
std::unique_ptr<combatant> def_comb(new combatant(*def_stats, prev_def));
|
||||
auto att_comb = std::make_unique<combatant>(*att_stats);
|
||||
auto def_comb = std::make_unique<combatant>(*def_stats, prev_def);
|
||||
|
||||
att_comb->fight(*def_comb);
|
||||
|
||||
|
|
|
@ -332,7 +332,7 @@ addons_client::install_result addons_client::do_resolve_addon_dependencies(const
|
|||
result.outcome = install_outcome::success;
|
||||
result.wml_changed = false;
|
||||
|
||||
std::unique_ptr<cursor::setter> cursor_setter(new cursor::setter(cursor::WAIT));
|
||||
auto cursor_setter = std::make_unique<cursor::setter>(cursor::WAIT);
|
||||
|
||||
// TODO: We don't currently check for the need to upgrade. I'll probably
|
||||
// work on that when implementing dependency tiers later.
|
||||
|
|
|
@ -1097,7 +1097,7 @@ attack_result_ptr actions::execute_attack_action(side_number side,
|
|||
double aggression,
|
||||
const unit_advancements_aspect& advancements)
|
||||
{
|
||||
attack_result_ptr action(new attack_result(side, attacker_loc, defender_loc, attacker_weapon, aggression, advancements));
|
||||
auto action = std::make_unique<attack_result>(side, attacker_loc, defender_loc, attacker_weapon, aggression, advancements);
|
||||
execute_or_check(*action, execute);
|
||||
return action;
|
||||
}
|
||||
|
@ -1109,7 +1109,7 @@ move_result_ptr actions::execute_move_action(side_number side,
|
|||
bool remove_movement,
|
||||
bool unreach_is_ok)
|
||||
{
|
||||
move_result_ptr action(new move_result(side, from, to, remove_movement, unreach_is_ok));
|
||||
auto action = std::make_unique<move_result>(side, from, to, remove_movement, unreach_is_ok);
|
||||
execute_or_check(*action, execute);
|
||||
return action;
|
||||
}
|
||||
|
@ -1117,7 +1117,7 @@ move_result_ptr actions::execute_move_action(side_number side,
|
|||
recall_result_ptr actions::execute_recall_action(
|
||||
side_number side, bool execute, const std::string& unit_id, const map_location& where, const map_location& from)
|
||||
{
|
||||
recall_result_ptr action(new recall_result(side, unit_id, where, from));
|
||||
auto action = std::make_unique<recall_result>(side, unit_id, where, from);
|
||||
execute_or_check(*action, execute);
|
||||
return action;
|
||||
}
|
||||
|
@ -1128,7 +1128,7 @@ recruit_result_ptr actions::execute_recruit_action(side_number side,
|
|||
const map_location& where,
|
||||
const map_location& from)
|
||||
{
|
||||
recruit_result_ptr action(new recruit_result(side, unit_name, where, from));
|
||||
auto action = std::make_unique<recruit_result>(side, unit_name, where, from);
|
||||
execute_or_check(*action, execute);
|
||||
return action;
|
||||
}
|
||||
|
@ -1136,7 +1136,7 @@ recruit_result_ptr actions::execute_recruit_action(side_number side,
|
|||
stopunit_result_ptr actions::execute_stopunit_action(
|
||||
side_number side, bool execute, const map_location& unit_location, bool remove_movement, bool remove_attacks)
|
||||
{
|
||||
stopunit_result_ptr action(new stopunit_result(side, unit_location, remove_movement, remove_attacks));
|
||||
auto action = std::make_unique<stopunit_result>(side, unit_location, remove_movement, remove_attacks);
|
||||
execute_or_check(*action, execute);
|
||||
return action;
|
||||
}
|
||||
|
@ -1144,7 +1144,7 @@ stopunit_result_ptr actions::execute_stopunit_action(
|
|||
synced_command_result_ptr actions::execute_synced_command_action(
|
||||
side_number side, bool execute, const std::string& lua_code, const map_location& location)
|
||||
{
|
||||
synced_command_result_ptr action(new synced_command_result(side, lua_code, location));
|
||||
auto action = std::make_unique<synced_command_result>(side, lua_code, location);
|
||||
execute_or_check(*action, execute);
|
||||
return action;
|
||||
}
|
||||
|
|
|
@ -154,7 +154,7 @@ public:
|
|||
}
|
||||
|
||||
virtual engine_ptr get_new_instance( readonly_context &ai, const config &cfg ){
|
||||
engine_ptr e = engine_ptr(new ENGINE(ai,cfg));
|
||||
engine_ptr e = std::make_shared<ENGINE>(ai, cfg);
|
||||
if (!e->is_ok()) {
|
||||
return engine_ptr();
|
||||
}
|
||||
|
|
|
@ -206,7 +206,7 @@ public:
|
|||
}
|
||||
|
||||
virtual goal_ptr get_new_instance( readonly_context &context, const config &cfg ){
|
||||
goal_ptr a(new GOAL(context,cfg));
|
||||
goal_ptr a = std::make_shared<GOAL>(context, cfg);
|
||||
a->on_create();
|
||||
return a;
|
||||
}
|
||||
|
|
|
@ -130,7 +130,7 @@ public:
|
|||
}
|
||||
|
||||
virtual stage_ptr get_new_instance( ai_context &context, const config &cfg ){
|
||||
stage_ptr a(new STAGE(context,cfg));
|
||||
stage_ptr a = std::make_shared<STAGE>(context, cfg);
|
||||
a->on_create();
|
||||
return a;
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ std::shared_ptr<attacks_vector> aspect_attacks_base::analyze_targets() const
|
|||
const move_map& enemy_srcdst = get_enemy_srcdst();
|
||||
const move_map& enemy_dstsrc = get_enemy_dstsrc();
|
||||
|
||||
std::shared_ptr<attacks_vector> res(new attacks_vector());
|
||||
auto res = std::make_shared<attacks_vector>();
|
||||
unit_map& units_ = resources::gameboard->units();
|
||||
|
||||
std::vector<map_location> unit_locs;
|
||||
|
|
|
@ -1138,10 +1138,10 @@ void recruitment::simulate_attack(
|
|||
if (att_weapon.range() != def_weapon.range()) {
|
||||
continue;
|
||||
}
|
||||
std::shared_ptr<attack_simulation> simulation(new attack_simulation(
|
||||
auto simulation = std::make_shared<attack_simulation>(
|
||||
attacker, defender,
|
||||
attacker_defense, defender_defense,
|
||||
att_weapon.shared_from_this(), def_weapon.shared_from_this(), average_lawful_bonus_));
|
||||
att_weapon.shared_from_this(), def_weapon.shared_from_this(), average_lawful_bonus_);
|
||||
if (!best_def_response || simulation->better_result(best_def_response.get(), true)) {
|
||||
best_def_response = simulation;
|
||||
}
|
||||
|
@ -1830,7 +1830,7 @@ void recruitment_aspect::recalculate() const {
|
|||
}
|
||||
|
||||
void recruitment_aspect::create_job(std::vector<std::shared_ptr<recruit_job>> &jobs, const config &job) {
|
||||
std::shared_ptr<recruit_job> job_ptr(new recruit_job(
|
||||
jobs.emplace_back(std::make_shared<recruit_job>(
|
||||
utils::split(job["type"]),
|
||||
job["leader_id"], job["id"],
|
||||
job["number"].to_int(-1), job["importance"].to_int(1),
|
||||
|
@ -1838,16 +1838,14 @@ void recruitment_aspect::create_job(std::vector<std::shared_ptr<recruit_job>> &j
|
|||
job["blocker"].to_bool(true),
|
||||
job["pattern"].to_bool(true)
|
||||
));
|
||||
jobs.push_back(job_ptr);
|
||||
}
|
||||
|
||||
void recruitment_aspect::create_limit(std::vector<std::shared_ptr<recruit_limit>> &limits, const config &lim) {
|
||||
std::shared_ptr<recruit_limit> lim_ptr(new recruit_limit(
|
||||
limits.emplace_back(std::make_shared<recruit_limit>(
|
||||
utils::split(lim["type"]),
|
||||
lim["id"],
|
||||
lim["max"].to_int(0)
|
||||
));
|
||||
limits.push_back(lim_ptr);
|
||||
}
|
||||
|
||||
} // namespace default_recruitment
|
||||
|
|
|
@ -80,9 +80,9 @@ ca_ptr formula_ai::load_candidate_action_from_config(const config& rc_action)
|
|||
const t_string &type = rc_action["type"];
|
||||
|
||||
if( type == "movement") {
|
||||
new_ca = ca_ptr(new move_candidate_action(name, type, rc_action, &function_table_));
|
||||
new_ca = std::make_shared<move_candidate_action>(name, type, rc_action, &function_table_);
|
||||
} else if( type == "attack") {
|
||||
new_ca = ca_ptr(new attack_candidate_action(name, type, rc_action, &function_table_));
|
||||
new_ca = std::make_shared<attack_candidate_action>(name, type, rc_action, &function_table_);
|
||||
} else {
|
||||
ERR_AI << "Unknown candidate action type: " << type << std::endl;
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ void engine_fai::do_parse_candidate_action_from_config( rca_context &context, co
|
|||
DBG_AI_ENGINE_FAI << "config snippet contains: " << std::endl << cfg << std::endl;
|
||||
return;
|
||||
}
|
||||
candidate_action_ptr ca = candidate_action_ptr(new fai_candidate_action_wrapper(context,cfg,fai_ca,*formula_ai_));
|
||||
auto ca = std::make_shared<fai_candidate_action_wrapper>(context, cfg, fai_ca, *formula_ai_);
|
||||
*b = ca;
|
||||
|
||||
}
|
||||
|
|
|
@ -195,7 +195,7 @@ void editor_action_paste::extend(const editor_map& map, const std::set<map_locat
|
|||
editor_action_paste* editor_action_paste::perform(map_context& mc) const
|
||||
{
|
||||
map_fragment mf(mc.map(), paste_.get_offset_area(offset_));
|
||||
std::unique_ptr<editor_action_paste> undo(new editor_action_paste(mf));
|
||||
auto undo = std::make_unique<editor_action_paste>(mf);
|
||||
|
||||
perform_without_undo(mc);
|
||||
return undo.release();
|
||||
|
|
|
@ -897,7 +897,7 @@ filesystem::scoped_istream istream_file(const std::string& fname, bool treat_fai
|
|||
|
||||
if(fname.empty()) {
|
||||
ERR_FS << "Trying to open file with empty name.\n";
|
||||
filesystem::scoped_istream s(new fstream_t());
|
||||
auto s = std::make_unique<fstream_t>();
|
||||
s->clear(std::ios_base::failbit);
|
||||
return s;
|
||||
}
|
||||
|
@ -912,7 +912,7 @@ filesystem::scoped_istream istream_file(const std::string& fname, bool treat_fai
|
|||
ERR_FS << "Could not open '" << fname << "' for reading.\n";
|
||||
} else if(!is_filename_case_correct(fname, fd)) {
|
||||
ERR_FS << "Not opening '" << fname << "' due to case mismatch.\n";
|
||||
filesystem::scoped_istream s(new fstream_t());
|
||||
auto s = std::make_unique<fstream_t>();
|
||||
s->clear(std::ios_base::failbit);
|
||||
return s;
|
||||
}
|
||||
|
@ -923,7 +923,7 @@ filesystem::scoped_istream istream_file(const std::string& fname, bool treat_fai
|
|||
ERR_FS << "Could not open '" << fname << "' for reading.\n";
|
||||
}
|
||||
|
||||
filesystem::scoped_istream s(new fstream_t());
|
||||
auto s = std::make_unique<fstream_t>();
|
||||
s->clear(std::ios_base::failbit);
|
||||
return s;
|
||||
}
|
||||
|
|
|
@ -232,7 +232,7 @@ formula::formula(const std::string& text, function_symbol_table* symbols)
|
|||
if(!tokens.empty()) {
|
||||
expr_ = parse_expression(&tokens[0], &tokens[0] + tokens.size(), symbols_);
|
||||
} else {
|
||||
expr_ = expression_ptr(new null_expression());
|
||||
expr_ = std::make_shared<null_expression>();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -245,7 +245,7 @@ formula::formula(const tk::token* i1, const tk::token* i2, function_symbol_table
|
|||
if(i1 != i2) {
|
||||
expr_ = parse_expression(i1, i2, symbols);
|
||||
} else {
|
||||
expr_ = expression_ptr(new null_expression());
|
||||
expr_ = std::make_shared<null_expression>();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1296,13 +1296,13 @@ expression_ptr parse_expression(const tk::token* i1, const tk::token* i2, functi
|
|||
|
||||
symbols->add_function(formula_name,
|
||||
std::make_shared<user_formula_function>(
|
||||
formula_name, const_formula_ptr(new formula(beg, i1, symbols)),
|
||||
formula_name, std::make_shared<const formula>(beg, i1, symbols),
|
||||
formula::create_optional_formula(precond, symbols), args
|
||||
)
|
||||
);
|
||||
|
||||
if((i1 == i2) || (i1 == (i2-1))) {
|
||||
return expression_ptr(new function_list_expression(symbols));
|
||||
return std::make_shared<function_list_expression>(symbols);
|
||||
} else {
|
||||
return parse_expression((i1+1), i2, symbols);
|
||||
}
|
||||
|
@ -1337,7 +1337,7 @@ expression_ptr parse_expression(const tk::token* i1, const tk::token* i2, functi
|
|||
} else if((i2-1)->type == tk::TOKEN_RSQUARE) { //check if there is [ ] : either a list/map definition, or a operator
|
||||
// First, a special case for an empty map
|
||||
if(i2 - i1 == 3 && i1->type == tk::TOKEN_LSQUARE && (i1+1)->type == tk::TOKEN_POINTER) {
|
||||
return expression_ptr(new map_expression(std::vector<expression_ptr>()));
|
||||
return std::make_shared<map_expression>(std::vector<expression_ptr>());
|
||||
}
|
||||
|
||||
const tk::token* tok = i2-2;
|
||||
|
@ -1361,19 +1361,17 @@ expression_ptr parse_expression(const tk::token* i1, const tk::token* i2, functi
|
|||
|
||||
if( is_map ) {
|
||||
parse_set_args(i1+1, i2-1, &args, symbols);
|
||||
return expression_ptr(new map_expression(args));
|
||||
return std::make_shared<map_expression>(args);
|
||||
} else {
|
||||
parse_args(i1+1,i2-1,&args,symbols);
|
||||
return expression_ptr(new list_expression(args));
|
||||
return std::make_shared<list_expression>(args);
|
||||
}
|
||||
} else {
|
||||
// Execute operator [ ]
|
||||
try{
|
||||
return expression_ptr(
|
||||
new square_bracket_expression(
|
||||
parse_expression(i1, tok, symbols),
|
||||
parse_expression(tok + 1, i2 - 1, symbols)
|
||||
)
|
||||
return std::make_shared<square_bracket_expression>(
|
||||
parse_expression(i1, tok, symbols),
|
||||
parse_expression(tok + 1, i2 - 1, symbols)
|
||||
);
|
||||
} catch (const formula_error& e){
|
||||
throw formula_error( e.type, tokens_to_string(i1, i2-1), *i1->filename, i1->line_number );
|
||||
|
@ -1383,13 +1381,13 @@ expression_ptr parse_expression(const tk::token* i1, const tk::token* i2, functi
|
|||
} else if(i2 - i1 == 1) {
|
||||
if(i1->type == tk::TOKEN_KEYWORD) {
|
||||
if(std::string(i1->begin, i1->end) == "functions") {
|
||||
return expression_ptr(new function_list_expression(symbols));
|
||||
return std::make_shared<function_list_expression>(symbols);
|
||||
}
|
||||
} else if(i1->type == tk::TOKEN_IDENTIFIER) {
|
||||
return expression_ptr(new identifier_expression(std::string(i1->begin, i1->end)));
|
||||
return std::make_shared<identifier_expression>(std::string(i1->begin, i1->end));
|
||||
} else if(i1->type == tk::TOKEN_INTEGER) {
|
||||
int n = std::stoi(std::string(i1->begin, i1->end));
|
||||
return expression_ptr(new integer_expression(n));
|
||||
return std::make_shared<integer_expression>(n);
|
||||
} else if(i1->type == tk::TOKEN_DECIMAL) {
|
||||
tk::iterator dot = i1->begin;
|
||||
while(*dot != '.') {
|
||||
|
@ -1415,9 +1413,9 @@ expression_ptr parse_expression(const tk::token* i1, const tk::token* i2, functi
|
|||
++dot;
|
||||
}
|
||||
|
||||
return expression_ptr(new decimal_expression(n, f));
|
||||
return std::make_shared<decimal_expression>(n, f);
|
||||
} else if(i1->type == tk::TOKEN_STRING_LITERAL) {
|
||||
return expression_ptr(new string_expression(std::string(i1->begin + 1, i1->end - 1)));
|
||||
return std::make_shared<string_expression>(std::string(i1->begin + 1, i1->end - 1));
|
||||
}
|
||||
} else if(i1->type == tk::TOKEN_IDENTIFIER &&
|
||||
(i1+1)->type == tk::TOKEN_LPARENS &&
|
||||
|
@ -1476,7 +1474,7 @@ expression_ptr parse_expression(const tk::token* i1, const tk::token* i2, functi
|
|||
expr_table_ptr table(new expr_table());
|
||||
parse_where_clauses(op+1, i2, table, symbols);
|
||||
|
||||
return expression_ptr(new where_expression(parse_expression(i1, op, symbols), table));
|
||||
return std::make_shared<where_expression>(parse_expression(i1, op, symbols), table);
|
||||
}
|
||||
|
||||
return expression_ptr(
|
||||
|
|
|
@ -194,7 +194,7 @@ void wmi_manager::set_item(const std::string& id, const vconfig& menu_item)
|
|||
bool success;
|
||||
|
||||
// First, try to insert a brand new menu item.
|
||||
std::tie(iter, success) = wml_menu_items_.emplace(id, item_ptr(new wml_menu_item(id, menu_item)));
|
||||
std::tie(iter, success) = wml_menu_items_.emplace(id, std::make_shared<wml_menu_item>(id, menu_item));
|
||||
|
||||
// If an entry already exists, reset it.
|
||||
if(!success) {
|
||||
|
@ -218,7 +218,7 @@ void wmi_manager::set_menu_items(const config& cfg)
|
|||
const std::string& id = item["id"];
|
||||
bool success;
|
||||
|
||||
std::tie(std::ignore, success) = wml_menu_items_.emplace(id, item_ptr(new wml_menu_item(id, item)));
|
||||
std::tie(std::ignore, success) = wml_menu_items_.emplace(id, std::make_shared<wml_menu_item>(id, item));
|
||||
|
||||
if(!success) {
|
||||
WRN_NG << "duplicate menu item (" << id << ") while loading from config" << std::endl;
|
||||
|
|
|
@ -410,7 +410,7 @@ void enter_wait_mode(mp_workflow_helper_ptr helper, int game_id, bool observe)
|
|||
|
||||
statistics::fresh_stats();
|
||||
|
||||
std::unique_ptr<mp_campaign_info> campaign_info(new mp_campaign_info(*helper->connection));
|
||||
auto campaign_info = std::make_unique<mp_campaign_info>(*helper->connection);
|
||||
campaign_info->is_host = false;
|
||||
|
||||
if(helper->lobby_info->get_game_by_id(game_id)) {
|
||||
|
|
|
@ -141,14 +141,14 @@ void hotkey_base::save(config& item) const
|
|||
|
||||
hotkey_ptr create_hotkey(const std::string &id, const SDL_Event &event)
|
||||
{
|
||||
hotkey_ptr base = hotkey_ptr(new hotkey_void);
|
||||
hotkey_ptr base = std::make_shared<hotkey_void>();
|
||||
const hotkey_command& command = get_hotkey_command(id);
|
||||
unsigned mods = sdl_get_mods();
|
||||
|
||||
switch (event.type) {
|
||||
case SDL_KEYUP: {
|
||||
if (mods & KMOD_CTRL || mods & KMOD_ALT || mods & KMOD_GUI || CKey::is_uncomposable(event.key) || command.toggle) {
|
||||
hotkey_keyboard_ptr keyboard(new hotkey_keyboard());
|
||||
auto keyboard = std::make_shared<hotkey_keyboard>();
|
||||
base = std::dynamic_pointer_cast<hotkey_base>(keyboard);
|
||||
SDL_Keycode code;
|
||||
code = event.key.keysym.sym;
|
||||
|
@ -161,7 +161,7 @@ hotkey_ptr create_hotkey(const std::string &id, const SDL_Event &event)
|
|||
if(command.toggle) {
|
||||
return nullptr;
|
||||
}
|
||||
hotkey_keyboard_ptr keyboard(new hotkey_keyboard());
|
||||
auto keyboard = std::make_shared<hotkey_keyboard>();
|
||||
base = std::dynamic_pointer_cast<hotkey_base>(keyboard);
|
||||
std::string text = std::string(event.text.text);
|
||||
keyboard->set_text(text);
|
||||
|
@ -171,7 +171,7 @@ hotkey_ptr create_hotkey(const std::string &id, const SDL_Event &event)
|
|||
}
|
||||
break;
|
||||
case SDL_MOUSEBUTTONUP: {
|
||||
hotkey_mouse_ptr mouse(new hotkey_mouse());
|
||||
auto mouse = std::make_shared<hotkey_mouse>();
|
||||
base = std::dynamic_pointer_cast<hotkey_base>(mouse);
|
||||
mouse->set_button(event.button.button);
|
||||
break;
|
||||
|
@ -190,18 +190,18 @@ hotkey_ptr create_hotkey(const std::string &id, const SDL_Event &event)
|
|||
|
||||
hotkey_ptr load_from_config(const config& cfg)
|
||||
{
|
||||
hotkey_ptr base = hotkey_ptr(new hotkey_void());
|
||||
hotkey_ptr base = std::make_shared<hotkey_void>();
|
||||
|
||||
const std::string& mouse_cfg = cfg["mouse"];
|
||||
if (!mouse_cfg.empty()) {
|
||||
hotkey_mouse_ptr mouse(new hotkey_mouse());
|
||||
auto mouse = std::make_shared<hotkey_mouse>();
|
||||
base = std::dynamic_pointer_cast<hotkey_base>(mouse);
|
||||
mouse->set_button(cfg["button"].to_int());
|
||||
}
|
||||
|
||||
const std::string& key_cfg = cfg["key"];
|
||||
if (!key_cfg.empty()) {
|
||||
hotkey_keyboard_ptr keyboard(new hotkey_keyboard());
|
||||
auto keyboard = std::make_shared<hotkey_keyboard>();
|
||||
base = std::dynamic_pointer_cast<hotkey_base>(keyboard);
|
||||
|
||||
SDL_Keycode keycode = SDL_GetKeyFromName(key_cfg.c_str());
|
||||
|
|
|
@ -1120,7 +1120,7 @@ bool game::process_turn(simple_wml::document& data, const socket_ptr& user)
|
|||
continue;
|
||||
}
|
||||
|
||||
std::unique_ptr<simple_wml::document> message(new simple_wml::document);
|
||||
auto message = std::make_unique<simple_wml::document>();
|
||||
simple_wml::node& message_turn = message->root().add_child("turn");
|
||||
simple_wml::node& message_turn_command = message_turn.add_child("command");
|
||||
speak->copy_into(message_turn_command.add_child("speak"));
|
||||
|
|
|
@ -309,7 +309,7 @@ BOOST_AUTO_TEST_CASE( validate_get_random_int )
|
|||
|
||||
randomness::mt_rng mt_(cfg);
|
||||
|
||||
std::shared_ptr<randomness::rng> gen_ (new randomness::rng_deterministic(mt_));
|
||||
auto gen_ = std::make_shared<randomness::rng_deterministic>(mt_);
|
||||
|
||||
int val = gen_->get_random_int(0, validation_get_random_int_max);
|
||||
BOOST_CHECK_EQUAL ( val , validation_get_random_int_correct_answer );
|
||||
|
@ -317,7 +317,7 @@ BOOST_AUTO_TEST_CASE( validate_get_random_int )
|
|||
|
||||
BOOST_AUTO_TEST_CASE( validate_get_random_int2 )
|
||||
{
|
||||
std::shared_ptr<randomness::rng> gen_ (new randomness::synced_rng(validate_get_random_int_seed_generator));
|
||||
auto gen_ = std::make_shared<randomness::synced_rng>(validate_get_random_int_seed_generator);
|
||||
|
||||
for (int i = 0; i < validation_get_random_int_num_draws; i++) {
|
||||
gen_->next_random();
|
||||
|
|
|
@ -640,7 +640,7 @@ static int do_gameloop(const std::vector<std::string>& args)
|
|||
return finished;
|
||||
}
|
||||
|
||||
const std::unique_ptr<game_launcher> game(new game_launcher(cmdline_opts, args[0].c_str()));
|
||||
const auto game = std::make_unique<game_launcher>(cmdline_opts, args[0].c_str());
|
||||
const int start_ticks = SDL_GetTicks();
|
||||
|
||||
init_locale();
|
||||
|
|
Loading…
Add table
Reference in a new issue