Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion code/actions/BuiltinActionDefinition.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class BuiltinActionDefinition : public ActionDefinition {
// This should have been caught earlier
Assertion(paramIter != parameterExpressions.cend(), "Could not find built-in parameter!");

return std::unique_ptr<Action>(new TAction(paramIter->second.template asTyped<ActionValueType>()));
return std::make_unique<TAction>(paramIter->second.template asTyped<ActionValueType>());
}
};

Expand Down
4 changes: 2 additions & 2 deletions code/actions/expression/ActionExpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ActionExpression ActionExpression::parseFromTable(ValueType expectedReturnType,

stuff_string(expressionText, F_NAME);

ExpressionParser parser(expressionText);
ExpressionParser parser(std::move(expressionText));

auto expression = parser.parse(context);

Expand All @@ -45,7 +45,7 @@ ActionExpression ActionExpression::parseFromTable(ValueType expectedReturnType,
}

// Everything is valid
return ActionExpression(expression);
return ActionExpression(std::move(expression));
}

Value ActionExpression::execute(const ProgramVariables& variables) const
Expand Down
2 changes: 1 addition & 1 deletion code/actions/expression/ProgramVariables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace expression {

ProgramVariablesDefinition& ProgramVariablesDefinition::addScope(const SCP_string& name)
{
auto scope = std::unique_ptr<ProgramVariablesDefinition>(new ProgramVariablesDefinition());
auto scope = std::make_unique<ProgramVariablesDefinition>();

auto scopePtr = scope.get();

Expand Down
2 changes: 1 addition & 1 deletion code/actions/types/MoveToSubmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ ActionResult MoveToSubmodel::execute(ProgramLocals& locals) const

std::unique_ptr<Action> MoveToSubmodel::clone() const
{
return std::unique_ptr<Action>(new MoveToSubmodel(*this));
return std::make_unique<MoveToSubmodel>(*this);
}

} // namespace types
Expand Down
2 changes: 1 addition & 1 deletion code/actions/types/ParticleEffectAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ ActionResult ParticleEffectAction::execute(ProgramLocals& locals) const

std::unique_ptr<Action> ParticleEffectAction::clone() const
{
return std::unique_ptr<Action>(new ParticleEffectAction(*this));
return std::make_unique<ParticleEffectAction>(*this);
}

} // namespace types
Expand Down
2 changes: 1 addition & 1 deletion code/actions/types/PlaySoundAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ ActionResult PlaySoundAction::execute(ProgramLocals& locals) const
}
std::unique_ptr<Action> PlaySoundAction::clone() const
{
return std::unique_ptr<Action>(new PlaySoundAction(*this));
return std::make_unique<PlaySoundAction>(*this);
}
} // namespace types
} // namespace actions
2 changes: 1 addition & 1 deletion code/actions/types/SetDirectionAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ ActionResult SetDirectionAction::execute(ProgramLocals& locals) const

std::unique_ptr<Action> SetDirectionAction::clone() const
{
return std::unique_ptr<Action>(new SetDirectionAction(*this));
return std::make_unique<SetDirectionAction>(*this);
}

} // namespace types
Expand Down
2 changes: 1 addition & 1 deletion code/actions/types/SetPositionAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ ActionResult SetPositionAction::execute(ProgramLocals& locals) const

std::unique_ptr<Action> SetPositionAction::clone() const
{
return std::unique_ptr<Action>(new SetPositionAction(*this));
return std::make_unique<SetPositionAction>(*this);
}

} // namespace types
Expand Down
2 changes: 1 addition & 1 deletion code/actions/types/WaitAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ ActionResult WaitAction::execute(actions::ProgramLocals& locals) const
}
std::unique_ptr<Action> WaitAction::clone() const
{
return std::unique_ptr<Action>(new WaitAction(*this));
return std::make_unique<WaitAction>(*this);
}

} // namespace types
Expand Down
6 changes: 3 additions & 3 deletions code/asteroid/asteroid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2225,7 +2225,7 @@ static void asteroid_parse_section()
}
return;
}
asteroid_list.push_back(asteroid_t);
asteroid_list.push_back(std::move(asteroid_t));
asteroid_p = &asteroid_list[asteroid_list.size() - 1];

}
Expand Down Expand Up @@ -2323,7 +2323,7 @@ static void asteroid_parse_section()
thisType.type_name.c_str(),
asteroid_p->name);
} else {
asteroid_p->subtypes.push_back(thisType);
asteroid_p->subtypes.push_back(std::move(thisType));
}
}
}
Expand Down Expand Up @@ -2612,7 +2612,7 @@ static void verify_asteroid_splits()
}

// Replace splits with only valid splits
Asteroid_info[i].split_info = splits_t;
Asteroid_info[i].split_info = std::move(splits_t);
}
}

Expand Down
10 changes: 5 additions & 5 deletions code/cfile/cfilesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ void cf_build_pack_list( cf_root *root )
s_root.roottype = CF_ROOTTYPE_PACK;
s_root.cf_type = i;

temp_roots_sort.push_back(s_root);
temp_roots_sort.push_back(std::move(s_root));
}
}

Expand Down Expand Up @@ -1083,7 +1083,7 @@ void cf_search_root_pack(int root_index)
file.pathtype = path_type;
file.offset = find.offset;

files.push_back(file);
files.push_back(std::move(file));

//mprintf(( "Found pack file '%s'\n", find.filename ));
}
Expand Down Expand Up @@ -1356,7 +1356,7 @@ CFileLocation cf_find_file_location(const char* filespec, int pathtype, uint32_t
fclose(fp);

res.offset = 0;
res.full_name = longname;
res.full_name = std::move(longname);
res.name_ext = filespec;

return res;
Expand Down Expand Up @@ -1549,8 +1549,8 @@ CFileLocationExt cf_find_file_location_ext(const char *filename, const int ext_n
fclose(fp);

res.offset = 0;
res.full_name = longname;
res.name_ext = filespec_ext;
res.full_name = std::move(longname);
res.name_ext = std::move(filespec_ext);

return res;
}
Expand Down
4 changes: 2 additions & 2 deletions code/cheats_table/cheats_table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ void parse_cheat_table(const char* filename) {
}

if (shipSpawn) {
std::unique_ptr<CustomCheat> shipCheat(new SpawnShipCheat(code, msg, requireCheats, shipClass, shipName));
std::unique_ptr<CustomCheat> shipCheat(new SpawnShipCheat(code, std::move(msg), requireCheats, std::move(shipClass), std::move(shipName)));

if(customCheats.count(code) == 1) {
Warning(LOCATION, "A cheat for code '%s' already exists. It will be replaced.", code.c_str());
Expand All @@ -144,7 +144,7 @@ void parse_cheat_table(const char* filename) {
customCheats.emplace(code, std::move(shipCheat));
}
} else {
std::unique_ptr<CustomCheat> cheat(new CustomCheat(code, msg, requireCheats));
std::unique_ptr<CustomCheat> cheat(new CustomCheat(code, std::move(msg), requireCheats));

if(customCheats.count(code) == 1) {
Warning(LOCATION, "A cheat for code '%s' already exists. It will be replaced.", code.c_str());
Expand Down
2 changes: 1 addition & 1 deletion code/cheats_table/cheats_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class SpawnShipCheat : public CustomCheat {
SCP_string shipName;
public:

SpawnShipCheat(SCP_string cheat_code, SCP_string cheat_msg, bool require_cheats_enabled, SCP_string class_name, SCP_string ship_name) : CustomCheat(cheat_code, cheat_msg, require_cheats_enabled),
SpawnShipCheat(SCP_string cheat_code, SCP_string cheat_msg, bool require_cheats_enabled, SCP_string class_name, SCP_string ship_name) : CustomCheat(std::move(cheat_code), std::move(cheat_msg), require_cheats_enabled),
shipClassName(std::move(class_name)),
shipName(std::move(ship_name)) { }

Expand Down
2 changes: 1 addition & 1 deletion code/cmdline/cmdline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1322,7 +1322,7 @@ static void handle_unix_modlist(char **modlist, size_t *len)

for (char *cur_mod = strtok(*modlist, ","); cur_mod != NULL; cur_mod = strtok(NULL, ",")) {
SCP_string path = get_real_mod_path(cur_mod);
mod_paths.push_back(path);
mod_paths.push_back(std::move(path));
}

// create new char[] to replace modlist
Expand Down
2 changes: 1 addition & 1 deletion code/cutscene/movie.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ bool play(const char* filename, bool via_tech_room = false)
{
auto paramList = scripting::hook_param_list(scripting::hook_param("Filename", 's', filename), scripting::hook_param("ViaTechRoom", 'b', via_tech_room));
bool skip = scripting::hooks::OnMovieAboutToPlay->isOverride(paramList);
scripting::hooks::OnMovieAboutToPlay->run(paramList);
scripting::hooks::OnMovieAboutToPlay->run(std::move(paramList));
if (skip)
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion code/debugconsole/console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ void dc_putc(char c)
*/
temp_str = line_str->substr(lastwhite);
line_str->resize(lastwhite);
dc_buffer.push_back(temp_str);
dc_buffer.push_back(std::move(temp_str));
line_str = &dc_buffer.back();

if ((dc_buffer.size() > DROWS) && (dc_scroll_y < SCROLL_Y_MAX)) {
Expand Down
2 changes: 1 addition & 1 deletion code/gamehelp/gameplayhelp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ SCP_vector<gameplay_help_section> gameplay_help_init_text()

}

complete_help_text.push_back(thisHelp);
complete_help_text.push_back(std::move(thisHelp));
}

return complete_help_text;
Expand Down
4 changes: 2 additions & 2 deletions code/globalincs/vmallocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ class SCP_unordered_set : public std::unordered_set<Key, Hash, KeyEqual, std::al

template <typename T, typename... Args>
typename std::enable_if<!std::is_array<T>::value, std::unique_ptr<T>>::type make_unique(Args&&... args) {
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
return std::make_unique<T>(std::forward<Args>(args)...);
}
template <typename T, typename... Args>
typename std::enable_if<std::is_array<T>::value, std::unique_ptr<T>>::type make_unique(std::size_t n) {
Expand All @@ -196,7 +196,7 @@ typename std::enable_if<std::is_array<T>::value, std::unique_ptr<T>>::type make_

template <typename T, typename... Args>
typename std::enable_if<!std::is_array<T>::value, std::shared_ptr<T>>::type make_shared(Args&&... args) {
return std::shared_ptr<T>(new T(std::forward<Args>(args)...));
return std::make_shared<T>(std::forward<Args>(args)...);
}
template <typename T, typename... Args>
typename std::enable_if<std::is_array<T>::value, std::shared_ptr<T>>::type make_shared(std::size_t n) {
Expand Down
4 changes: 2 additions & 2 deletions code/graphics/2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3063,9 +3063,9 @@ SCP_vector<DisplayData> gr_enumerate_displays()
display.video_modes.push_back(videoMode);
}

data.push_back(display);
data.push_back(std::move(display));
}

SDL_QuitSubSystem(SDL_INIT_VIDEO);

return data;
Expand Down
2 changes: 1 addition & 1 deletion code/graphics/opengl/ShaderProgram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ void opengl::ShaderUniforms::setTextureUniform(const SCP_string& name, const int
new_bind.name = name;
new_bind.value = texture_unit;

_uniforms.push_back(new_bind);
_uniforms.push_back(std::move(new_bind));

_uniform_lookup[name] = _uniforms.size() - 1;
}
Expand Down
2 changes: 1 addition & 1 deletion code/graphics/paths/PathRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace paths {
std::unique_ptr<PathRenderer> PathRenderer::s_instance;

bool PathRenderer::init() {
s_instance = std::unique_ptr<PathRenderer>(new PathRenderer());
s_instance = std::make_unique<PathRenderer>();

return true;
}
Expand Down
2 changes: 1 addition & 1 deletion code/graphics/post_processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ bool PostProcessingManager::parse_table()

// Post_effects index is used for flag checks, so we can't have more than 32
if (m_postEffects.size() < 32) {
m_postEffects.push_back(eff);
m_postEffects.push_back(std::move(eff));
} else if (!warned) {
mprintf(("WARNING: post_processing.tbl can only have a max of 32 effects! Ignoring extra...\n"));
warned = true;
Expand Down
4 changes: 2 additions & 2 deletions code/hud/hud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2523,7 +2523,7 @@ void HudGaugeDamage::render(float /*frametime*/, bool config)
by += fl2i(line_h * scale);
sy += fl2i(line_h * scale);

info_lines.push_back(info);
info_lines.push_back(std::move(info));

// Remove it from hud_subsys_list
if ( best_index < (num-i-1) ) {
Expand Down Expand Up @@ -2569,7 +2569,7 @@ void HudGaugeDamage::render(float /*frametime*/, bool config)
info.value_y = y + fl2i(hull_integ_offsets[1] * scale);

// Insert at the top since hull is always first
info_lines.insert(info_lines.begin(), info);
info_lines.insert(info_lines.begin(), std::move(info));
}

if (info_lines.empty()) {
Expand Down
2 changes: 1 addition & 1 deletion code/hud/hudartillery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ void ssm_create(object *target, const vec3d *start, size_t ssm_index, const ssm_
snd_play(gamesnd_get_game_sound(Ssm_info[ssm_index].sound_index));
}

Ssm_strikes.push_back(ssm);
Ssm_strikes.push_back(std::move(ssm));
}

// delete a finished ssm effect
Expand Down
2 changes: 1 addition & 1 deletion code/hud/hudconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ void hud_config_get_unique_huds()
}
}

HC_available_huds.push_back(newPair);
HC_available_huds.push_back(std::move(newPair));
seenHuds.insert(hudName);
}
}
Expand Down
10 changes: 5 additions & 5 deletions code/hud/hudmessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ void HudGaugeMessages::scrollMessages()
new_active_msg.target_y = new_active_msg.y;
}

active_messages.push_back(new_active_msg);
active_messages.push_back(std::move(new_active_msg));
}

Scroll_in_progress = false;
Expand Down Expand Up @@ -585,7 +585,7 @@ void hud_sourced_print(int source, const SCP_string &msg)
new_msg.source = source;
new_msg.x = 0;

HUD_msg_buffer.push_back(new_msg);
HUD_msg_buffer.push_back(std::move(new_msg));

// Invoke the scripting hook
if (OnHudMessageReceivedHook->isActive()) {
Expand All @@ -610,7 +610,7 @@ void hud_sourced_print(int source, const char *msg)
new_msg.source = source;
new_msg.x = 0;

HUD_msg_buffer.push_back(new_msg);
HUD_msg_buffer.push_back(std::move(new_msg));

// Invoke the scripting hook
if (OnHudMessageReceivedHook->isActive()) {
Expand Down Expand Up @@ -666,7 +666,7 @@ void hud_add_msg_to_scrollback(const char *text, int source, int t)
line_node newLine = {t, The_mission.HUD_timer_padding, source, 0, 1, w, ""};
newLine.text = text;

Msg_scrollback_vec.push_back(newLine);
Msg_scrollback_vec.push_back(std::move(newLine));
}

// how many lines to skip
Expand Down Expand Up @@ -886,7 +886,7 @@ void hud_initialize_scrollback_lines()
}
} else {
node_msg.y = height / 3;
Msg_scrollback_lines.push_back(node_msg);
Msg_scrollback_lines.push_back(std::move(node_msg));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion code/hud/hudparse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ void parse_hud_gauges_tbl(const char *filename)
preset.g = rgb[1];
preset.b = rgb[2];

HC_colors[i] = preset;
HC_colors[i] = std::move(preset);
if (optional_string("+Default")) {
HC_default_color = i;
}
Expand Down
2 changes: 1 addition & 1 deletion code/hud/hudsquadmsg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,7 @@ bool hud_squadmsg_run_order_issued_hook(int command, ship* sendingShip, ship* re
}
scripting::hooks::OnHudCommOrderIssued->run(
scripting::hooks::CommOrderConditions{sendingShip, targetObject, &recipient},
paramList);
std::move(paramList));
}

return isOverride;
Expand Down
2 changes: 1 addition & 1 deletion code/math/curve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ void parse_curve_table(const char* filename) {
if (index < 0) {
Curve curv = Curve(std::move(name));
curv.ParseData();
Curves.push_back(curv);
Curves.push_back(std::move(curv));
} else {
Curves[index].ParseData();
}
Expand Down
2 changes: 1 addition & 1 deletion code/menuui/credits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ void credits_parse_table(const char* filename)
}
}

Credit_text_parts.push_back(credits_text);
Credit_text_parts.push_back(std::move(credits_text));

Credits_parsed = true;
}
Expand Down
Loading
Loading