Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

Commit

Permalink
sailors: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
espkk committed Jun 8, 2022
1 parent 09aac3a commit bce742d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions src/libs/sailors/src/sailors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ void ShipWalk::DeleteMan(int Index)
// UN//GUARD_SAILORS
};
//------------------------------------------------------------------------------------
bool ShipWalk::Init(entid_t _shipID, int editorMode, const char *shipType, std::vector<std::string> &shipManModels)
bool ShipWalk::Init(entid_t _shipID, int editorMode, const char *shipType, std::vector<std::string> &&shipManModels)
{
crewCount = 0;
bHide = false;
Expand Down Expand Up @@ -806,7 +806,7 @@ bool ShipWalk::Init(entid_t _shipID, int editorMode, const char *shipType, std::
SetMastBroken(((iNumMasts - 1) - i) + 1); // ??? The masts are opposite ???
}

if (std::size(shipManModels) > 0)
if (!shipManModels.empty())
{
shipManModels_ = std::move(shipManModels);
}
Expand Down Expand Up @@ -1164,18 +1164,20 @@ uint64_t Sailors::ProcessMessage(MESSAGE &message)

if (pvd != nullptr)
{
const int nq = pvd->GetElementsNum();
const char *pstr;
const auto nq = pvd->GetElementsNum();
shipManModels.reserve(nq);

for (auto i = 0; i < nq; i++)
{
const char *pstr;
pvd->Get(pstr, i);
shipManModels.push_back(pstr);
}
}
}

shipWalk.emplace_back();
if (shipWalk[shipsCount].Init(shipID, editorMode, c.c_str(), shipManModels))
if (shipWalk[shipsCount].Init(shipID, editorMode, c.c_str(), std::move(shipManModels)))
{
shipsCount++;

Expand Down
2 changes: 1 addition & 1 deletion src/libs/sailors/src/sailors.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class ShipWalk
void CreateNewMan(SailorsPoints &sailorsPoints);
void DeleteMan(int Index);

bool Init(entid_t _shipID, int editorMode, const char *shipType, std::vector<std::string> &shipManModels);
bool Init(entid_t _shipID, int editorMode, const char *shipType, std::vector<std::string> &&shipManModels);
void CheckPosition(uint32_t &dltTime);
void SetMastBroken(int iMastIndex);
void OnHullHit(const CVECTOR &v);
Expand Down

0 comments on commit bce742d

Please sign in to comment.