Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 Source/Activities/AssemblyEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ void AssemblyEditor::Draw(BITMAP* pTargetBitmap, const Vector& targetPos) {
EditorActivity::Draw(pTargetBitmap, targetPos);
}

BunkerAssembly* AssemblyEditor::BuildAssembly(std::string saveAsName) {
BunkerAssembly* AssemblyEditor::BuildAssembly(const std::string& saveAsName) {
// Create new bunker assembly to save
BunkerAssembly* pBA = new BunkerAssembly();
pBA->Create(m_pEditorGUI->GetCurrentAssemblyScheme());
Expand Down
2 changes: 1 addition & 1 deletion Source/Activities/AssemblyEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ namespace RTE {
/// it's pointer. Owhership IS transfered.
/// @param saveAsName New assembly name.
/// @return Built BunkerAssembly
BunkerAssembly* BuildAssembly(std::string saveAsName);
BunkerAssembly* BuildAssembly(const std::string& saveAsName);

/// Saves the current BunkerAssembly to an appropriate ini file, and asks user if they want to overwrite first if a BunkerAssembly of this name exists.
/// @param saveAsName The name of the new BunkerAssembly to be saved.
Expand Down
4 changes: 2 additions & 2 deletions Source/Activities/GAScripted.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ namespace RTE {
/// @return An error return value signaling sucess or any particular failure.
/// Anything below 0 is an error signal.
int Create(std::string scriptPath, std::string scriptClassName) {
m_ScriptPath = scriptPath;
m_LuaClassName = scriptClassName;
m_ScriptPath = std::move(scriptPath);
m_LuaClassName = std::move(scriptClassName);
return Create();
};

Expand Down
11 changes: 6 additions & 5 deletions Source/Activities/GATutorial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ GATutorial::~GATutorial() {
Destroy(true);
}

GATutorial::TutStep::TutStep(std::string text, int stepDuration, std::string screensPath, int frameCount, int frameDuration) {
m_Text = text;
m_Duration = stepDuration;
m_FrameDuration = frameDuration;
GATutorial::TutStep::TutStep(std::string text, int stepDuration, const std::string& screensPath, int frameCount, int frameDuration) :
m_Text(std::move(text)),
m_Duration(stepDuration),
m_FrameDuration(frameDuration)
{

if (!screensPath.empty()) {
ContentFile(screensPath.c_str()).GetAsAnimation(m_pScreens, frameCount);
Expand Down Expand Up @@ -677,7 +678,7 @@ void GATutorial::DrawGUI(BITMAP* pTargetBitmap, const Vector& targetPos, int whi
int timePhase = (int)m_AreaTimer.GetElapsedRealTimeMS() % 1200;
revealText = revealText + (timePhase > 900 ? "..." : (timePhase > 600 ? ".. " : (timePhase > 300 ? ". " : " ")));
}
g_FrameMan.GetSmallFont()->DrawAligned(&pBitmapInt, screenTextPos.m_X, screenTextPos.m_Y, revealText.c_str(), GUIFont::Centre);
g_FrameMan.GetSmallFont()->DrawAligned(&pBitmapInt, screenTextPos.m_X, screenTextPos.m_Y, revealText, GUIFont::Centre);
}
}

Expand Down
2 changes: 1 addition & 1 deletion Source/Activities/GATutorial.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ namespace RTE {
// The duration of one frame
int m_FrameDuration;

TutStep(std::string text, int stepDuration, std::string screensPath = "", int frameCount = 1, int frameDuration = 250);
TutStep(std::string text, int stepDuration, const std::string& screensPath = "", int frameCount = 1, int frameDuration = 250);
};

// Member variables
Expand Down
14 changes: 7 additions & 7 deletions Source/Activities/GameActivity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ void GameActivity::Destroy(bool notInherited) {
Clear();
}

void GameActivity::SetTeamTech(int team, std::string tech) {
void GameActivity::SetTeamTech(int team, const std::string& tech) {
if (team >= Teams::TeamOne && team < Teams::MaxTeamCount) {
if (tech == "-All-" || tech == "-Random-")
m_TeamTech[team] = tech;
Expand Down Expand Up @@ -388,7 +388,7 @@ void GameActivity::SwitchToPrevActor(int player, int team, Actor* pSkip) {
}
}

void GameActivity::AddObjectivePoint(std::string description, Vector objPos, int whichTeam, ObjectiveArrowDir arrowDir) {
void GameActivity::AddObjectivePoint(const std::string& description, Vector objPos, int whichTeam, ObjectiveArrowDir arrowDir) {
m_Objectives.push_back(ObjectivePoint(description, objPos, whichTeam, arrowDir));
}

Expand Down Expand Up @@ -468,7 +468,7 @@ int GameActivity::SetOverridePurchaseList(const Loadout* pLoadout, int player) {
return finalListCost;
}

int GameActivity::SetOverridePurchaseList(std::string loadoutName, int player) {
int GameActivity::SetOverridePurchaseList(const std::string& loadoutName, int player) {
// Find out the native module of this player
int nativeModule = 0;
MetaPlayer* pMetaPlayer = g_MetaMan.GetMetaPlayerOfInGamePlayer(player);
Expand Down Expand Up @@ -664,7 +664,7 @@ void GameActivity::SetupPlayers() {

int GameActivity::Start() {
// Set the split screen config before the Scene (and it SceneLayers, specifially) are loaded
int humanCount = GetHumanCount();
uint8_t humanCount = GetHumanCount();
// Depending on the resolution aspect ratio, split first horizontally (if wide screen)
if (((float)g_WindowMan.GetResX() / (float)g_WindowMan.GetResY()) >= 1.6)
g_FrameMan.ResetSplitScreens(humanCount > 1, humanCount > 2);
Expand Down Expand Up @@ -2474,14 +2474,14 @@ void GameActivity::ObjectivePoint::Draw(BITMAP* pTargetBitmap, BITMAP* pArrowBit
}
}

std::string& GameActivity::GetNetworkPlayerName(int player) {
const std::string& GameActivity::GetNetworkPlayerName(int player) {
if (player >= Players::PlayerOne && player < Players::MaxPlayerCount)
return m_NetworkPlayerNames[player];
else
return m_NetworkPlayerNames[0];
}

void GameActivity::SetNetworkPlayerName(int player, std::string name) {
void GameActivity::SetNetworkPlayerName(int player, const std::string& name) {
if (player >= Players::PlayerOne && player < Players::MaxPlayerCount)
m_NetworkPlayerNames[player] = name;
m_NetworkPlayerNames[player] = std::move(name);
}
23 changes: 12 additions & 11 deletions Source/Activities/GameActivity.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ namespace RTE {
/// @param objPos The very short description of what the objective is (three short words max)
/// @param whichTeam The absolute scene coordiante position of the objective. (default: Teams::TeamOne)
/// @param arrowDir The desired direction of the arrow when the point is on screen. (default: ARROWDOWN)
void AddObjectivePoint(std::string description, Vector objPos, int whichTeam = Teams::TeamOne, ObjectiveArrowDir arrowDir = ARROWDOWN);
void AddObjectivePoint(const std::string& description, Vector objPos, int whichTeam = Teams::TeamOne, ObjectiveArrowDir arrowDir = ARROWDOWN);

/// Sorts all objective points according to their positions on the Y axis.
void YSortObjectivePoints();
Expand All @@ -265,7 +265,7 @@ namespace RTE {
/// @param loadoutName The name of the Loadout preset to set the override purchase list to
/// represent.
/// @return The new total value of what's in the override purchase list.
int SetOverridePurchaseList(std::string loadoutName, int player);
int SetOverridePurchaseList(const std::string& loadoutName, int player);

/// Clears all items from a specific player's override purchase list.
/// @param m_PurchaseOverride[player].clear( Which player's override purchase list to clear.
Expand Down Expand Up @@ -352,7 +352,7 @@ namespace RTE {

/// Sets tech module name for specified team. Module must set must be loaded.
/// @param team Team to set module, module name, for example Dummy.rte
void SetTeamTech(int team, std::string tech);
void SetTeamTech(int team, const std::string& tech);

/// Indicates whether a specific team is assigned a CPU player in the current game.
/// @param team Which team index to check.
Expand Down Expand Up @@ -448,11 +448,11 @@ namespace RTE {
/// Returns network player name
/// @param player Player
/// @return Network player name
std::string& GetNetworkPlayerName(int player);
const std::string& GetNetworkPlayerName(int player);

/// Sets network player name
/// @param player Player number, player name
void SetNetworkPlayerName(int player, std::string name);
void SetNetworkPlayerName(int player, const std::string& name);

/// Protected member variable and method declarations
protected:
Expand All @@ -470,12 +470,13 @@ namespace RTE {
m_Team = Teams::NoTeam;
m_ArrowDir = ARROWDOWN;
}
ObjectivePoint(const std::string& desc, const Vector& pos, int team = -1, ObjectiveArrowDir arrowDir = ARROWDOWN) {
m_Description = desc;
m_ScenePos = pos;
m_Team = (Teams)team;
m_ArrowDir = arrowDir;
}

ObjectivePoint(std::string desc, const Vector& pos, int team = -1, ObjectiveArrowDir arrowDir = ARROWDOWN) :
m_Description(std::move(desc)),
m_ScenePos(pos),
m_Team((Teams)team),
m_ArrowDir(arrowDir)
{}

/// Simply draws this' arrow relative to a point on a bitmap.
/// @param pTargetBitmap A pointer to the BITMAP to draw on.
Expand Down
4 changes: 2 additions & 2 deletions Source/Entities/AHuman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ bool AHuman::EquipFirearm(bool doEquip) {
return false;
}

bool AHuman::EquipDeviceInGroup(std::string group, bool doEquip) {
bool AHuman::EquipDeviceInGroup(const std::string& group, bool doEquip) {
if (!(m_pFGArm && m_pFGArm->IsAttached())) {
return false;
}
Expand Down Expand Up @@ -748,7 +748,7 @@ bool AHuman::EquipDeviceInGroup(std::string group, bool doEquip) {
return false;
}

bool AHuman::EquipLoadedFirearmInGroup(std::string group, std::string excludeGroup, bool doEquip) {
bool AHuman::EquipLoadedFirearmInGroup(const std::string& group, const std::string& excludeGroup, bool doEquip) {
if (!(m_pFGArm && m_pFGArm->IsAttached())) {
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions Source/Entities/AHuman.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ namespace RTE {
/// @param doEquip Whether to actually equip any matching item found in the inventory, (default: true)
/// or just report that it's there or not.
/// @return Whether a firearm was successfully switched to, or already held.
bool EquipDeviceInGroup(std::string group, bool doEquip = true);
bool EquipDeviceInGroup(const std::string& group, bool doEquip = true);

/// Switches the currently held device (if any) to the first loaded HDFirearm
/// of the specified group in the inventory. If no such weapon is in the
Expand All @@ -253,7 +253,7 @@ namespace RTE {
/// @param doEquip Whether to actually equip any matching item found in the inventory, (default: true)
/// or just report that it's there or not.
/// @return Whether a firearm was successfully switched to, or already held.
bool EquipLoadedFirearmInGroup(std::string group, std::string exludeGroup, bool doEquip = true);
bool EquipLoadedFirearmInGroup(const std::string& group, const std::string& exludeGroup, bool doEquip = true);

/// Switches the equipped HeldDevice (if any) to the first found device with the specified preset name in the inventory.
/// If the equipped HeldDevice is of that module and preset name, nothing happens.
Expand Down
4 changes: 2 additions & 2 deletions Source/Entities/Activity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -467,8 +467,8 @@ void Activity::ClearPlayers(bool resetFunds) {
m_PlayerCount = m_TeamCount = 0;
}

int Activity::GetHumanCount() const {
int humans = 0;
uint8_t Activity::GetHumanCount() const {
uint8_t humans = 0;
for (int player = Players::PlayerOne; player < Players::MaxPlayerCount; ++player) {
if (m_IsActive[player] && m_IsHuman[player]) {
humans++;
Expand Down
8 changes: 4 additions & 4 deletions Source/Entities/Activity.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ namespace RTE {

/// Gets the user-friendly description of this Activity.
/// @return A string with the user-friendly description of this Activity.
std::string GetDescription() const { return m_Description; }
const std::string& GetDescription() const { return m_Description; }

/// Gets the max number of players supported by this Activity.
/// @return The max number of players supported by this Activity.
Expand All @@ -156,11 +156,11 @@ namespace RTE {

/// Gets the name of the current scene.
/// @return A string with the instance name of the scene.
std::string GetSceneName() const { return m_SceneName; }
const std::string& GetSceneName() const { return m_SceneName; }

/// Sets the name of the scene this is associated with.
/// @param sceneName The new name of the scene to load next game.
void SetSceneName(const std::string sceneName) { m_SceneName = sceneName; }
void SetSceneName(std::string sceneName) { m_SceneName = std::move(sceneName); }

/// Gets whether craft must be considered orbited if they reach the map border on non-wrapped maps.
/// @return Whether craft are considered orbited when at the border of a non-wrapping map.
Expand Down Expand Up @@ -228,7 +228,7 @@ namespace RTE {

/// Gets the total number of human players in the current Activity.
/// @return The total number of players in the current Activity.
int GetHumanCount() const;
uint8_t GetHumanCount() const;

/// Indicates whether a specific player is human in the current game, ie not an AI player and has a screen etc.
/// @param player Which player index to check.
Expand Down
2 changes: 1 addition & 1 deletion Source/Entities/BunkerAssembly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ int BunkerAssembly::ReadProperty(const std::string_view& propName, Reader& reade
} else {
// Do not allow to define assemblies prior to corresponding assembly scheme
char s[256];
std::snprintf(s, sizeof(s), "Required BunkerAssemblyScheme '%s%' not found when trying to load BunkerAssembly '%s'! BunkerAssemblySchemes MUST be defined before dependent BunkerAssmeblies.", parentScheme.c_str(), m_PresetName.c_str());
std::snprintf(s, sizeof(s), "Required BunkerAssemblyScheme '%s' not found when trying to load BunkerAssembly '%s'! BunkerAssemblySchemes MUST be defined before dependent BunkerAssmeblies.", parentScheme.c_str(), m_PresetName.c_str());
RTEAbort(s);
}
});
Expand Down
6 changes: 3 additions & 3 deletions Source/Entities/BunkerAssembly.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ namespace RTE {

/// Description:
/// Return value:
std::string GetParentAssemblySchemeName() const { return m_ParentAssemblyScheme; }
const std::string& GetParentAssemblySchemeName() const { return m_ParentAssemblyScheme; }

/// Indicates whether this' current graphical representation overlaps
/// a point in absolute scene coordinates.
Expand Down Expand Up @@ -97,11 +97,11 @@ namespace RTE {

/// Gets the name of an assembly symmetric to this one.
/// @return Symmetric assembly name.
std::string GetSymmetricAssemblyName() const { return m_SymmetricAssembly; };
const std::string& GetSymmetricAssemblyName() const { return m_SymmetricAssembly; };

/// Sets the name of an assembly symmetric to this one.
/// @param newSymmetricAssembly Symmetric assembly name.
void SetSymmetricAssemblyName(std::string newSymmetricAssembly) { m_SymmetricAssembly = newSymmetricAssembly; };
void SetSymmetricAssemblyName(std::string newSymmetricAssembly) { m_SymmetricAssembly = std::move(newSymmetricAssembly); };

/// Draws this TerrainObject's current graphical representation to a
/// BITMAP of choice.
Expand Down
4 changes: 2 additions & 2 deletions Source/Entities/BunkerAssemblyScheme.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,11 @@ namespace RTE {

/// Gets the name of the scheme symmetric to this one.
/// @return Symmetric scheme name.
std::string GetSymmetricSchemeName() const { return m_SymmetricScheme; }
const std::string& GetSymmetricSchemeName() const { return m_SymmetricScheme; }

/// Gets the name of group to which assemblies linked with this scheme must be added.
/// @return Assembly group name.
std::string GetAssemblyGroup() const { return m_AssemblyGroup; }
const std::string& GetAssemblyGroup() const { return m_AssemblyGroup; }

/// Returns the limit of these schemes per scene. 0 - no limit.
/// @return Scheme limit.
Expand Down
2 changes: 1 addition & 1 deletion Source/Entities/Deployment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ int Deployment::Create() {
}

int Deployment::Create(std::string loadoutName, const Icon& icon, float spawnRadius) {
m_LoadoutName = loadoutName;
m_LoadoutName = std::move(loadoutName);
m_Icon = icon;
m_SpawnRadius = spawnRadius;
m_WalkRadius = 250;
Expand Down
2 changes: 1 addition & 1 deletion Source/Entities/Deployment.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ namespace RTE {

/// Gets a bitmap showing a good identifyable icon of this.
/// @return The Icon that represents this graphically.
Icon GetIcon() { return m_Icon; }
const Icon& GetIcon() { return m_Icon; }

/// Gets the radius around this deployment that gets checked if another
/// actor/item of the same type and name already exists and will block
Expand Down
2 changes: 1 addition & 1 deletion Source/Entities/HDFirearm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ std::string HDFirearm::GetNextMagazineName() const {
return m_pMagazineReference->GetPresetName();
}

bool HDFirearm::SetNextMagazineName(std::string magName) {
bool HDFirearm::SetNextMagazineName(const std::string& magName) {
const Magazine* pNewMag = dynamic_cast<const Magazine*>(g_PresetMan.GetEntityPreset("Magazine", magName));
if (pNewMag) {
m_pMagazineReference = pNewMag;
Expand Down
2 changes: 1 addition & 1 deletion Source/Entities/HDFirearm.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ namespace RTE {
/// this gun. This changes all future mags that will be reloaded.
/// @param magName The preset name of the new Magazine to load into this from now on.
/// @return Whether the specified magazine was found and successfully prepared.
bool SetNextMagazineName(std::string magName);
bool SetNextMagazineName(const std::string& magName);

/// Gets the number of rounds still in the loaded magazine. Negative value
/// means infinite ammo.
Expand Down
4 changes: 2 additions & 2 deletions Source/Entities/Icon.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ namespace RTE {

/// Gets the array of 8-bit bitmaps of this Icon, as many as GetFrameCount says. Neither the array nor the BITMAPs are transferred ownership!
/// @return The BITMAPs in 8bpp of this Icon.
std::vector<BITMAP*> GetBitmaps8() const { return m_BitmapsIndexed; }
const std::vector<BITMAP*>& GetBitmaps8() const { return m_BitmapsIndexed; }

/// Gets the array of 32-bit bitmaps of this Icon, as many as GetFrameCount says. Neither the array nor the BITMAPs are transferred ownership!
/// @return The BITMAPs in 32bpp of this Icon.
std::vector<BITMAP*> GetBitmaps32() const { return m_BitmapsTrueColor; }
const std::vector<BITMAP*>& GetBitmaps32() const { return m_BitmapsTrueColor; }
#pragma endregion

#pragma region Operator Overloads
Expand Down
2 changes: 1 addition & 1 deletion Source/Entities/MOSParticle.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace RTE {
/// @param lifetime The amount of time in ms this MOSParticle will exist. 0 means unlimited.
/// @return An error return value signaling success or any particular failure. Anything below 0 is an error signal.
int Create(ContentFile spriteFile, const int frameCount = 1, const float mass = 1, const Vector& position = Vector(0, 0), const Vector& velocity = Vector(0, 0), const unsigned long lifetime = 0) {
MOSprite::Create(spriteFile, frameCount, mass, position, velocity, lifetime);
MOSprite::Create(std::move(spriteFile), frameCount, mass, position, velocity, lifetime);
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion Source/Entities/MOSRotating.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ int MOSRotating::Create(ContentFile spriteFile,
const Vector& position,
const Vector& velocity,
const unsigned long lifetime) {
MOSprite::Create(spriteFile, frameCount, mass, position, velocity, lifetime);
MOSprite::Create(std::move(spriteFile), frameCount, mass, position, velocity, lifetime);

if (!m_pFlipBitmap && m_aSprite[0]) {
m_pFlipBitmap = create_bitmap_ex(8, m_aSprite[0]->w, m_aSprite[0]->h);
Expand Down
Loading