mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-12 01:48:14 +01:00
refactor(sonar): use try_emplace for map insertion (cpp:S6030)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -9762,7 +9762,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
|||||||
if (issection("Param.", inputline))
|
if (issection("Param.", inputline))
|
||||||
{
|
{
|
||||||
startBPT = false;
|
startBPT = false;
|
||||||
fizlines.emplace("Param", inputline);
|
fizlines.try_emplace("Param", inputline);
|
||||||
LoadFIZ_Param(inputline);
|
LoadFIZ_Param(inputline);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -9770,7 +9770,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
|||||||
if (issection("Load:", inputline))
|
if (issection("Load:", inputline))
|
||||||
{
|
{
|
||||||
startBPT = false;
|
startBPT = false;
|
||||||
fizlines.emplace("Load", inputline);
|
fizlines.try_emplace("Load", inputline);
|
||||||
LoadFIZ_Load(inputline);
|
LoadFIZ_Load(inputline);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -9778,7 +9778,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
|||||||
if (issection("Dimensions:", inputline))
|
if (issection("Dimensions:", inputline))
|
||||||
{
|
{
|
||||||
startBPT = false;
|
startBPT = false;
|
||||||
fizlines.emplace("Dimensions", inputline);
|
fizlines.try_emplace("Dimensions", inputline);
|
||||||
LoadFIZ_Dimensions(inputline);
|
LoadFIZ_Dimensions(inputline);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -9786,7 +9786,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
|||||||
if (issection("Wheels:", inputline))
|
if (issection("Wheels:", inputline))
|
||||||
{
|
{
|
||||||
startBPT = false;
|
startBPT = false;
|
||||||
fizlines.emplace("Wheels", inputline);
|
fizlines.try_emplace("Wheels", inputline);
|
||||||
LoadFIZ_Wheels(inputline);
|
LoadFIZ_Wheels(inputline);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -9794,7 +9794,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
|||||||
if (issection("Brake:", inputline))
|
if (issection("Brake:", inputline))
|
||||||
{
|
{
|
||||||
startBPT = false;
|
startBPT = false;
|
||||||
fizlines.emplace("Brake", inputline);
|
fizlines.try_emplace("Brake", inputline);
|
||||||
LoadFIZ_Brake(inputline);
|
LoadFIZ_Brake(inputline);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -9803,7 +9803,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
|||||||
{
|
{
|
||||||
|
|
||||||
startBPT = false;
|
startBPT = false;
|
||||||
fizlines.emplace("Doors", inputline);
|
fizlines.try_emplace("Doors", inputline);
|
||||||
LoadFIZ_Doors(inputline);
|
LoadFIZ_Doors(inputline);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -9812,7 +9812,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
|||||||
{
|
{
|
||||||
|
|
||||||
startBPT = false;
|
startBPT = false;
|
||||||
fizlines.emplace("BuffCoupl", inputline);
|
fizlines.try_emplace("BuffCoupl", inputline);
|
||||||
LoadFIZ_BuffCoupl(inputline, 0);
|
LoadFIZ_BuffCoupl(inputline, 0);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -9821,7 +9821,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
|||||||
{
|
{
|
||||||
|
|
||||||
startBPT = false;
|
startBPT = false;
|
||||||
fizlines.emplace("BuffCoupl1", inputline);
|
fizlines.try_emplace("BuffCoupl1", inputline);
|
||||||
LoadFIZ_BuffCoupl(inputline, 1);
|
LoadFIZ_BuffCoupl(inputline, 1);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -9830,7 +9830,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
|||||||
{
|
{
|
||||||
|
|
||||||
startBPT = false;
|
startBPT = false;
|
||||||
fizlines.emplace("BuffCoupl2", inputline);
|
fizlines.try_emplace("BuffCoupl2", inputline);
|
||||||
LoadFIZ_BuffCoupl(inputline, 2);
|
LoadFIZ_BuffCoupl(inputline, 2);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -9839,7 +9839,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
|||||||
{
|
{
|
||||||
|
|
||||||
startBPT = false;
|
startBPT = false;
|
||||||
fizlines.emplace("TurboPos", inputline);
|
fizlines.try_emplace("TurboPos", inputline);
|
||||||
LoadFIZ_TurboPos(inputline);
|
LoadFIZ_TurboPos(inputline);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -9849,7 +9849,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
|||||||
|
|
||||||
startBPT = true;
|
startBPT = true;
|
||||||
LISTLINE = 0;
|
LISTLINE = 0;
|
||||||
fizlines.emplace("Cntrl", inputline);
|
fizlines.try_emplace("Cntrl", inputline);
|
||||||
LoadFIZ_Cntrl(inputline);
|
LoadFIZ_Cntrl(inputline);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -9857,7 +9857,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
|||||||
if (issection("Headlights:", inputline))
|
if (issection("Headlights:", inputline))
|
||||||
{
|
{
|
||||||
startBPT = false;
|
startBPT = false;
|
||||||
fizlines.emplace("Headlights", inputline);
|
fizlines.try_emplace("Headlights", inputline);
|
||||||
LoadFIZ_Headlights(inputline);
|
LoadFIZ_Headlights(inputline);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -9867,7 +9867,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
|||||||
|
|
||||||
startBPT = false;
|
startBPT = false;
|
||||||
LISTLINE = 0;
|
LISTLINE = 0;
|
||||||
fizlines.emplace("Blending", inputline);
|
fizlines.try_emplace("Blending", inputline);
|
||||||
LoadFIZ_Blending(inputline);
|
LoadFIZ_Blending(inputline);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -9877,7 +9877,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
|||||||
|
|
||||||
startBPT = false;
|
startBPT = false;
|
||||||
LISTLINE = 0;
|
LISTLINE = 0;
|
||||||
fizlines.emplace("DCEMUED", inputline);
|
fizlines.try_emplace("DCEMUED", inputline);
|
||||||
LoadFIZ_DCEMUED(inputline);
|
LoadFIZ_DCEMUED(inputline);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -9887,7 +9887,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
|||||||
|
|
||||||
startBPT = false;
|
startBPT = false;
|
||||||
LISTLINE = 0;
|
LISTLINE = 0;
|
||||||
fizlines.emplace("SpringBrake", inputline);
|
fizlines.try_emplace("SpringBrake", inputline);
|
||||||
LoadFIZ_SpringBrake(inputline);
|
LoadFIZ_SpringBrake(inputline);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -9896,7 +9896,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
|||||||
{
|
{
|
||||||
|
|
||||||
startBPT = false;
|
startBPT = false;
|
||||||
fizlines.emplace("Light", inputline);
|
fizlines.try_emplace("Light", inputline);
|
||||||
LoadFIZ_Light(inputline);
|
LoadFIZ_Light(inputline);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -9904,7 +9904,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
|||||||
if (issection("Security:", inputline))
|
if (issection("Security:", inputline))
|
||||||
{
|
{
|
||||||
startBPT = false;
|
startBPT = false;
|
||||||
fizlines.emplace("Security", inputline);
|
fizlines.try_emplace("Security", inputline);
|
||||||
SecuritySystem.load(inputline, Vmax);
|
SecuritySystem.load(inputline, Vmax);
|
||||||
extract_value(EmergencyBrakeWarningSignal, "EmergencyBrakeWarningSignal", inputline, "");
|
extract_value(EmergencyBrakeWarningSignal, "EmergencyBrakeWarningSignal", inputline, "");
|
||||||
continue;
|
continue;
|
||||||
@@ -9914,7 +9914,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
|||||||
{
|
{
|
||||||
|
|
||||||
startBPT = false;
|
startBPT = false;
|
||||||
fizlines.emplace("Clima", inputline);
|
fizlines.try_emplace("Clima", inputline);
|
||||||
LoadFIZ_Clima(inputline);
|
LoadFIZ_Clima(inputline);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -9922,7 +9922,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
|||||||
if (issection("Power:", inputline))
|
if (issection("Power:", inputline))
|
||||||
{
|
{
|
||||||
startBPT = false;
|
startBPT = false;
|
||||||
fizlines.emplace("Power", inputline);
|
fizlines.try_emplace("Power", inputline);
|
||||||
LoadFIZ_Power(inputline);
|
LoadFIZ_Power(inputline);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -9930,7 +9930,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
|||||||
if (issection("SpeedControl:", inputline))
|
if (issection("SpeedControl:", inputline))
|
||||||
{
|
{
|
||||||
startBPT = false;
|
startBPT = false;
|
||||||
fizlines.emplace("SpeedControl", inputline);
|
fizlines.try_emplace("SpeedControl", inputline);
|
||||||
LoadFIZ_SpeedControl(inputline);
|
LoadFIZ_SpeedControl(inputline);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -9938,7 +9938,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
|||||||
if (issection("Engine:", inputline))
|
if (issection("Engine:", inputline))
|
||||||
{
|
{
|
||||||
startBPT = false;
|
startBPT = false;
|
||||||
fizlines.emplace("Engine", inputline);
|
fizlines.try_emplace("Engine", inputline);
|
||||||
LoadFIZ_Engine(inputline);
|
LoadFIZ_Engine(inputline);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -9946,7 +9946,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
|||||||
if (issection("Switches:", inputline))
|
if (issection("Switches:", inputline))
|
||||||
{
|
{
|
||||||
startBPT = false;
|
startBPT = false;
|
||||||
fizlines.emplace("Switches", inputline);
|
fizlines.try_emplace("Switches", inputline);
|
||||||
LoadFIZ_Switches(inputline);
|
LoadFIZ_Switches(inputline);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -9956,7 +9956,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
|||||||
startBPT = false;
|
startBPT = false;
|
||||||
startMPT = true;
|
startMPT = true;
|
||||||
LISTLINE = 0;
|
LISTLINE = 0;
|
||||||
fizlines.emplace("MotorParamTable", inputline);
|
fizlines.try_emplace("MotorParamTable", inputline);
|
||||||
LoadFIZ_MotorParamTable(inputline);
|
LoadFIZ_MotorParamTable(inputline);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -9972,7 +9972,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
|||||||
if (issection("Circuit:", inputline))
|
if (issection("Circuit:", inputline))
|
||||||
{
|
{
|
||||||
startBPT = false;
|
startBPT = false;
|
||||||
fizlines.emplace("Circuit", inputline);
|
fizlines.try_emplace("Circuit", inputline);
|
||||||
LoadFIZ_Circuit(inputline);
|
LoadFIZ_Circuit(inputline);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -9980,7 +9980,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
|||||||
if (issection("AI:", inputline))
|
if (issection("AI:", inputline))
|
||||||
{
|
{
|
||||||
startBPT = false;
|
startBPT = false;
|
||||||
fizlines.emplace("AI", inputline);
|
fizlines.try_emplace("AI", inputline);
|
||||||
LoadFIZ_AI(inputline);
|
LoadFIZ_AI(inputline);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -9988,7 +9988,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
|||||||
if (issection("RList:", inputline))
|
if (issection("RList:", inputline))
|
||||||
{
|
{
|
||||||
startBPT = false;
|
startBPT = false;
|
||||||
fizlines.emplace("RList", inputline);
|
fizlines.try_emplace("RList", inputline);
|
||||||
startRLIST = true;
|
startRLIST = true;
|
||||||
LISTLINE = 0;
|
LISTLINE = 0;
|
||||||
LoadFIZ_RList(inputline);
|
LoadFIZ_RList(inputline);
|
||||||
@@ -9998,7 +9998,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
|||||||
if (issection("UCList:", inputline))
|
if (issection("UCList:", inputline))
|
||||||
{
|
{
|
||||||
startBPT = false;
|
startBPT = false;
|
||||||
fizlines.emplace("UCList", inputline);
|
fizlines.try_emplace("UCList", inputline);
|
||||||
startUCLIST = true;
|
startUCLIST = true;
|
||||||
LISTLINE = 0;
|
LISTLINE = 0;
|
||||||
LoadFIZ_UCList(inputline);
|
LoadFIZ_UCList(inputline);
|
||||||
@@ -10008,7 +10008,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
|||||||
if (issection("DList:", inputline))
|
if (issection("DList:", inputline))
|
||||||
{
|
{
|
||||||
startBPT = false;
|
startBPT = false;
|
||||||
fizlines.emplace("DList", inputline);
|
fizlines.try_emplace("DList", inputline);
|
||||||
startDLIST = true;
|
startDLIST = true;
|
||||||
LISTLINE = 0;
|
LISTLINE = 0;
|
||||||
LoadFIZ_DList(inputline);
|
LoadFIZ_DList(inputline);
|
||||||
@@ -10018,7 +10018,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
|||||||
if (issection("DMList:", inputline))
|
if (issection("DMList:", inputline))
|
||||||
{
|
{
|
||||||
startBPT = false;
|
startBPT = false;
|
||||||
fizlines.emplace("DMList", inputline);
|
fizlines.try_emplace("DMList", inputline);
|
||||||
startDIZELMOMENTUMLIST = true;
|
startDIZELMOMENTUMLIST = true;
|
||||||
LISTLINE = 0;
|
LISTLINE = 0;
|
||||||
continue;
|
continue;
|
||||||
@@ -10027,7 +10027,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
|||||||
if (issection("HTCList:", inputline))
|
if (issection("HTCList:", inputline))
|
||||||
{
|
{
|
||||||
startBPT = false;
|
startBPT = false;
|
||||||
fizlines.emplace("HTCList", inputline);
|
fizlines.try_emplace("HTCList", inputline);
|
||||||
startHYDROTCLIST = true;
|
startHYDROTCLIST = true;
|
||||||
LISTLINE = 0;
|
LISTLINE = 0;
|
||||||
continue;
|
continue;
|
||||||
@@ -10036,7 +10036,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
|||||||
if (issection("PmaxList:", inputline))
|
if (issection("PmaxList:", inputline))
|
||||||
{
|
{
|
||||||
startBPT = false;
|
startBPT = false;
|
||||||
fizlines.emplace("PmaxList", inputline);
|
fizlines.try_emplace("PmaxList", inputline);
|
||||||
startPMAXLIST = true;
|
startPMAXLIST = true;
|
||||||
LISTLINE = 0;
|
LISTLINE = 0;
|
||||||
continue;
|
continue;
|
||||||
@@ -10045,7 +10045,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
|||||||
if (issection("V2NList:", inputline))
|
if (issection("V2NList:", inputline))
|
||||||
{
|
{
|
||||||
startBPT = false;
|
startBPT = false;
|
||||||
fizlines.emplace("V2NList", inputline);
|
fizlines.try_emplace("V2NList", inputline);
|
||||||
startDIZELV2NMAXLIST = true;
|
startDIZELV2NMAXLIST = true;
|
||||||
LISTLINE = 0;
|
LISTLINE = 0;
|
||||||
continue;
|
continue;
|
||||||
@@ -10081,7 +10081,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
|||||||
if (issection("WiperList:", inputline))
|
if (issection("WiperList:", inputline))
|
||||||
{
|
{
|
||||||
startBPT = false;
|
startBPT = false;
|
||||||
fizlines.emplace("WiperList", inputline);
|
fizlines.try_emplace("WiperList", inputline);
|
||||||
startWiperList = true;
|
startWiperList = true;
|
||||||
LISTLINE = 0;
|
LISTLINE = 0;
|
||||||
LoadFIZ_WiperList(inputline);
|
LoadFIZ_WiperList(inputline);
|
||||||
@@ -10094,7 +10094,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
|||||||
dimPositions.clear(); // uzywamy customowej listy
|
dimPositions.clear(); // uzywamy customowej listy
|
||||||
startBPT = false;
|
startBPT = false;
|
||||||
startDimmerList = true;
|
startDimmerList = true;
|
||||||
fizlines.emplace("DimmerList", inputline);
|
fizlines.try_emplace("DimmerList", inputline);
|
||||||
LoadFIZ_DimmerList(inputline);
|
LoadFIZ_DimmerList(inputline);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -10102,7 +10102,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
|||||||
if (issection("LightsList:", inputline))
|
if (issection("LightsList:", inputline))
|
||||||
{
|
{
|
||||||
startBPT = false;
|
startBPT = false;
|
||||||
fizlines.emplace("LightsList", inputline);
|
fizlines.try_emplace("LightsList", inputline);
|
||||||
startLIGHTSLIST = true;
|
startLIGHTSLIST = true;
|
||||||
LISTLINE = 0;
|
LISTLINE = 0;
|
||||||
LoadFIZ_LightsList(inputline);
|
LoadFIZ_LightsList(inputline);
|
||||||
@@ -10112,7 +10112,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
|||||||
if (issection("CompressorList:", inputline))
|
if (issection("CompressorList:", inputline))
|
||||||
{
|
{
|
||||||
startBPT = false;
|
startBPT = false;
|
||||||
fizlines.emplace("CompressorList", inputline);
|
fizlines.try_emplace("CompressorList", inputline);
|
||||||
startCOMPRESSORLIST = true;
|
startCOMPRESSORLIST = true;
|
||||||
LISTLINE = 0;
|
LISTLINE = 0;
|
||||||
LoadFIZ_CompressorList(inputline);
|
LoadFIZ_CompressorList(inputline);
|
||||||
|
|||||||
@@ -228,7 +228,7 @@ void gl::shader::parse_texture_entries(std::string &str)
|
|||||||
else if (conf.id >= gl::MAX_TEXTURES)
|
else if (conf.id >= gl::MAX_TEXTURES)
|
||||||
log_error("invalid texture binding: " + std::to_string(conf.id));
|
log_error("invalid texture binding: " + std::to_string(conf.id));
|
||||||
else
|
else
|
||||||
texture_conf.emplace(std::make_pair(name, conf));
|
texture_conf.try_emplace(name, conf);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
log_error("invalid argument count to #texture");
|
log_error("invalid argument count to #texture");
|
||||||
@@ -289,7 +289,7 @@ void gl::shader::parse_param_entries(std::string &str)
|
|||||||
else if (conf.offset + conf.size > 4)
|
else if (conf.offset + conf.size > 4)
|
||||||
log_error("invalid size: " + std::to_string(conf.size));
|
log_error("invalid size: " + std::to_string(conf.size));
|
||||||
else
|
else
|
||||||
param_conf.emplace(std::make_pair(name, conf));
|
param_conf.try_emplace(name, conf);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
log_error("invalid argument count to #param");
|
log_error("invalid argument count to #param");
|
||||||
@@ -379,9 +379,9 @@ gl::program::program(std::vector<std::reference_wrapper<const gl::shader>> shade
|
|||||||
void gl::program::attach(const gl::shader &s)
|
void gl::program::attach(const gl::shader &s)
|
||||||
{
|
{
|
||||||
for (auto it : s.texture_conf)
|
for (auto it : s.texture_conf)
|
||||||
texture_conf.emplace(std::make_pair(it.first, std::move(it.second)));
|
texture_conf.try_emplace(it.first, std::move(it.second));
|
||||||
for (auto it : s.param_conf)
|
for (auto it : s.param_conf)
|
||||||
param_conf.emplace(std::make_pair(it.first, std::move(it.second)));
|
param_conf.try_emplace(it.first, std::move(it.second));
|
||||||
glAttachShader(*this, *s);
|
glAttachShader(*this, *s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -799,7 +799,7 @@ void command_queue::update()
|
|||||||
for (auto c : m_active_continuous)
|
for (auto c : m_active_continuous)
|
||||||
{
|
{
|
||||||
command_data data({c.first, GLFW_REPEAT, 0.0, 0.0, delta, false, glm::vec3()}); // todo: improve
|
command_data data({c.first, GLFW_REPEAT, 0.0, 0.0, delta, false, glm::vec3()}); // todo: improve
|
||||||
auto lookup = m_commands.emplace( c.second, commanddata_sequence() );
|
auto lookup = m_commands.try_emplace( c.second, commanddata_sequence() );
|
||||||
// recipient stack was either located or created, so we can add to it quite safely
|
// recipient stack was either located or created, so we can add to it quite safely
|
||||||
lookup.first->second.emplace_back( data );
|
lookup.first->second.emplace_back( data );
|
||||||
}
|
}
|
||||||
@@ -809,7 +809,7 @@ void command_queue::update()
|
|||||||
void
|
void
|
||||||
command_queue::push( command_data const &Command, uint32_t const Recipient ) {
|
command_queue::push( command_data const &Command, uint32_t const Recipient ) {
|
||||||
if (is_network_target(Recipient)) {
|
if (is_network_target(Recipient)) {
|
||||||
auto lookup = m_intercept_queue.emplace(Recipient, commanddata_sequence());
|
auto lookup = m_intercept_queue.try_emplace(Recipient, commanddata_sequence());
|
||||||
lookup.first->second.emplace_back(Command);
|
lookup.first->second.emplace_back(Command);
|
||||||
} else {
|
} else {
|
||||||
push_direct(Command, Recipient);
|
push_direct(Command, Recipient);
|
||||||
@@ -827,7 +827,7 @@ void command_queue::push_direct(const command_data &Command, const uint32_t Reci
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto lookup = m_commands.emplace( Recipient, commanddata_sequence() );
|
auto lookup = m_commands.try_emplace( Recipient, commanddata_sequence() );
|
||||||
// recipient stack was either located or created, so we can add to it quite safely
|
// recipient stack was either located or created, so we can add to it quite safely
|
||||||
lookup.first->second.emplace_back( Command );
|
lookup.first->second.emplace_back( Command );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ drivermouse_input::recall_bindings() {
|
|||||||
std::unordered_map<std::string, user_command> nametocommandmap;
|
std::unordered_map<std::string, user_command> nametocommandmap;
|
||||||
std::size_t commandid = 0;
|
std::size_t commandid = 0;
|
||||||
for( auto const &description : simulation::Commands_descriptions ) {
|
for( auto const &description : simulation::Commands_descriptions ) {
|
||||||
nametocommandmap.emplace(
|
nametocommandmap.try_emplace(
|
||||||
description.name,
|
description.name,
|
||||||
static_cast<user_command>( commandid ) );
|
static_cast<user_command>( commandid ) );
|
||||||
++commandid;
|
++commandid;
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ gamepad_input::recall_bindings() {
|
|||||||
std::unordered_map<std::string, user_command> nametocommandmap;
|
std::unordered_map<std::string, user_command> nametocommandmap;
|
||||||
std::size_t commandid = 0;
|
std::size_t commandid = 0;
|
||||||
for( auto const &description : simulation::Commands_descriptions ) {
|
for( auto const &description : simulation::Commands_descriptions ) {
|
||||||
nametocommandmap.emplace(
|
nametocommandmap.try_emplace(
|
||||||
description.name,
|
description.name,
|
||||||
static_cast<user_command>( commandid ) );
|
static_cast<user_command>( commandid ) );
|
||||||
++commandid;
|
++commandid;
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ keyboard_input::recall_bindings() {
|
|||||||
std::unordered_map<std::string, user_command> nametocommandmap;
|
std::unordered_map<std::string, user_command> nametocommandmap;
|
||||||
std::size_t commandid = 0;
|
std::size_t commandid = 0;
|
||||||
for( auto const &description : simulation::Commands_descriptions ) {
|
for( auto const &description : simulation::Commands_descriptions ) {
|
||||||
nametocommandmap.emplace(
|
nametocommandmap.try_emplace(
|
||||||
description.name,
|
description.name,
|
||||||
static_cast<user_command>( commandid ) );
|
static_cast<user_command>( commandid ) );
|
||||||
++commandid;
|
++commandid;
|
||||||
@@ -155,7 +155,7 @@ keyboard_input::recall_bindings() {
|
|||||||
std::unordered_map<std::string, int> nametokeymap;
|
std::unordered_map<std::string, int> nametokeymap;
|
||||||
|
|
||||||
for (const std::pair<int, std::string> &key : keytonamemap) {
|
for (const std::pair<int, std::string> &key : keytonamemap) {
|
||||||
nametokeymap.emplace(key.second, key.first);
|
nametokeymap.try_emplace(key.second, key.first);
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: to simplify things we expect one entry per line, and whole entry in one line
|
// NOTE: to simplify things we expect one entry per line, and whole entry in one line
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ void ui::vehicles_bank::parse_category_entry(const std::string ¶m)
|
|||||||
std::string mini;
|
std::string mini;
|
||||||
std::getline(stream, mini, ',');
|
std::getline(stream, mini, ',');
|
||||||
|
|
||||||
category_icons.emplace(ctx_type, "textures/mini/" + ToLower(mini) + ".bmp");
|
category_icons.try_emplace(ctx_type, "textures/mini/" + ToLower(mini) + ".bmp");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ui::vehicles_bank::parse_controllable_entry(const std::string &target, const std::string ¶m)
|
void ui::vehicles_bank::parse_controllable_entry(const std::string &target, const std::string ¶m)
|
||||||
@@ -123,7 +123,7 @@ void ui::vehicles_bank::parse_texture_info(const std::string &target, const std:
|
|||||||
set.meta = meta;
|
set.meta = meta;
|
||||||
|
|
||||||
if (!mini.empty())
|
if (!mini.empty())
|
||||||
group_icons.emplace(mini, std::move(deferred_image("textures/mini/" + ToLower(mini) + ".bmp")));
|
group_icons.try_emplace(mini, std::move(deferred_image("textures/mini/" + ToLower(mini) + ".bmp")));
|
||||||
|
|
||||||
if (!miniplus.empty())
|
if (!miniplus.empty())
|
||||||
set.mini = std::move(deferred_image("textures/mini/" + ToLower(miniplus) + ".bmp"));
|
set.mini = std::move(deferred_image("textures/mini/" + ToLower(miniplus) + ".bmp"));
|
||||||
@@ -261,7 +261,7 @@ std::shared_ptr<ui::vehicle_desc> ui::vehicles_bank::get_vehicle(const std::stri
|
|||||||
auto desc = std::make_shared<vehicle_desc>();
|
auto desc = std::make_shared<vehicle_desc>();
|
||||||
desc->type = ctx_type;
|
desc->type = ctx_type;
|
||||||
desc->path = path;
|
desc->path = path;
|
||||||
vehicles.emplace(path, desc);
|
vehicles.try_emplace(path, desc);
|
||||||
return desc;
|
return desc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,11 +47,11 @@ TModelsManager::LoadModel(std::string const &Name, std::string const &virtualNam
|
|||||||
m_models.emplace_back();
|
m_models.emplace_back();
|
||||||
auto model = m_models.back().LoadModel( Name, dynamic );
|
auto model = m_models.back().LoadModel( Name, dynamic );
|
||||||
if( model != nullptr ) {
|
if( model != nullptr ) {
|
||||||
m_modelsmap.emplace( virtualName, m_models.size() - 1 );
|
m_modelsmap.try_emplace( virtualName, m_models.size() - 1 );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_models.pop_back();
|
m_models.pop_back();
|
||||||
m_modelsmap.emplace( virtualName, null_handle );
|
m_modelsmap.try_emplace( virtualName, null_handle );
|
||||||
}
|
}
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
@@ -113,7 +113,7 @@ TModelsManager::GetModel(std::string const &Name, bool const Dynamic, bool const
|
|||||||
ErrorLog( "Bad file: failed to locate 3d model file \"" + filename + "\"", logtype::file );
|
ErrorLog( "Bad file: failed to locate 3d model file \"" + filename + "\"", logtype::file );
|
||||||
}
|
}
|
||||||
// ...and link it with the error model slot
|
// ...and link it with the error model slot
|
||||||
m_modelsmap.emplace( filename + postfix, null_handle );
|
m_modelsmap.try_emplace( filename + postfix, null_handle );
|
||||||
}
|
}
|
||||||
Global.asCurrentTexturePath = buftp; // odtworzenie ścieżki do tekstur
|
Global.asCurrentTexturePath = buftp; // odtworzenie ścieżki do tekstur
|
||||||
return model; // NULL jeśli błąd
|
return model; // NULL jeśli błąd
|
||||||
|
|||||||
@@ -211,7 +211,7 @@ void network::tcp::client::handle_accept(const asio::error_code &err) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
network::tcp::asio_manager::asio_manager() {
|
network::tcp::asio_manager::asio_manager() {
|
||||||
backend_list().emplace("tcp", this);
|
backend_list().try_emplace("tcp", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<network::server> network::tcp::asio_manager::create_server(std::shared_ptr<std::fstream> backbuffer, const std::string &conf) {
|
std::shared_ptr<network::server> network::tcp::asio_manager::create_server(std::shared_ptr<std::fstream> backbuffer, const std::string &conf) {
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ void network::request_command::deserialize(std::istream &stream)
|
|||||||
sequence.emplace_back(data);
|
sequence.emplace_back(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
commands.emplace(recipient, sequence);
|
commands.try_emplace(recipient, sequence);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ void network::server::handle_message(std::shared_ptr<connection> conn, const mes
|
|||||||
const auto& cmd = dynamic_cast<const request_command&>(msg);
|
const auto& cmd = dynamic_cast<const request_command&>(msg);
|
||||||
|
|
||||||
for (auto const &kv : cmd.commands)
|
for (auto const &kv : cmd.commands)
|
||||||
client_commands_queue.emplace(kv);
|
client_commands_queue.try_emplace(kv.first, kv.second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -479,7 +479,7 @@ particle_manager::find( std::string const &Template ) {
|
|||||||
// if deserialization didn't fail finish source setup...
|
// if deserialization didn't fail finish source setup...
|
||||||
source.m_opacitymodifier.bind( &Global.SmokeFidelity );
|
source.m_opacitymodifier.bind( &Global.SmokeFidelity );
|
||||||
// ...then cache the source as template for future instances
|
// ...then cache the source as template for future instances
|
||||||
m_sourcetemplates.emplace( templatename, source );
|
m_sourcetemplates.try_emplace( templatename, source );
|
||||||
// should be 'safe enough' to return lookup result directly afterwards
|
// should be 'safe enough' to return lookup result directly afterwards
|
||||||
return &( m_sourcetemplates.find( templatename )->second );
|
return &( m_sourcetemplates.find( templatename )->second );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -526,7 +526,7 @@ auto python_taskqueue::fetch_renderer(std::string const Renderer) -> PyObject *
|
|||||||
}
|
}
|
||||||
release_lock();
|
release_lock();
|
||||||
// cache the failures as well so we don't try again on subsequent requests
|
// cache the failures as well so we don't try again on subsequent requests
|
||||||
m_renderers.emplace(Renderer, renderer);
|
m_renderers.try_emplace(Renderer, renderer);
|
||||||
return renderer;
|
return renderer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -205,7 +205,7 @@ uart_input::recall_bindings() {
|
|||||||
std::unordered_map<std::string, user_command> nametocommandmap;
|
std::unordered_map<std::string, user_command> nametocommandmap;
|
||||||
std::size_t commandid = 0;
|
std::size_t commandid = 0;
|
||||||
for( auto const &description : simulation::Commands_descriptions ) {
|
for( auto const &description : simulation::Commands_descriptions ) {
|
||||||
nametocommandmap.emplace(
|
nametocommandmap.try_emplace(
|
||||||
description.name,
|
description.name,
|
||||||
static_cast<user_command>( commandid ) );
|
static_cast<user_command>( commandid ) );
|
||||||
++commandid;
|
++commandid;
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ TGauge::Load_mapping( cParser &Input, TGauge::scratch_data &Scratchpad ) {
|
|||||||
auto const indexstart { key.find_first_of( "-1234567890" ) };
|
auto const indexstart { key.find_first_of( "-1234567890" ) };
|
||||||
auto const indexend { key.find_first_not_of( "-1234567890", indexstart ) };
|
auto const indexend { key.find_first_not_of( "-1234567890", indexstart ) };
|
||||||
if( indexstart != std::string::npos ) {
|
if( indexstart != std::string::npos ) {
|
||||||
m_soundfxvalues.emplace(
|
m_soundfxvalues.try_emplace(
|
||||||
std::stoi( key.substr( indexstart, indexend - indexstart ) ),
|
std::stoi( key.substr( indexstart, indexend - indexstart ) ),
|
||||||
sound_source( m_soundtemplate ).deserialize( Input, sound_type::single ) );
|
sound_source( m_soundtemplate ).deserialize( Input, sound_type::single ) );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,11 +52,11 @@ void control_mapper::insert(TGauge const &Gauge, std::string const &Label)
|
|||||||
|
|
||||||
if (Gauge.SubModel != nullptr)
|
if (Gauge.SubModel != nullptr)
|
||||||
{
|
{
|
||||||
m_controlnames.emplace(Gauge.SubModel, Label);
|
m_controlnames.try_emplace(Gauge.SubModel, Label);
|
||||||
}
|
}
|
||||||
if (Gauge.SubModelOn != nullptr)
|
if (Gauge.SubModelOn != nullptr)
|
||||||
{
|
{
|
||||||
m_controlnames.emplace(Gauge.SubModelOn, Label);
|
m_controlnames.try_emplace(Gauge.SubModelOn, Label);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_names.emplace(Label);
|
m_names.emplace(Label);
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ map::sorted_object_list map::objects::find_in_range(glm::vec3 from, float distan
|
|||||||
float dist = glm::distance2(entry_location, search_point);
|
float dist = glm::distance2(entry_location, search_point);
|
||||||
if (dist < max_distance2)
|
if (dist < max_distance2)
|
||||||
{
|
{
|
||||||
items.emplace(dist, entry);
|
items.try_emplace(dist, entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ map::sorted_object_list map::objects::find_in_range(glm::vec3 from, float distan
|
|||||||
auto entry = std::make_shared<map::vehicle>();
|
auto entry = std::make_shared<map::vehicle>();
|
||||||
entry->dynobj = dynobj;
|
entry->dynobj = dynobj;
|
||||||
entry->name = dynobj->name();
|
entry->name = dynobj->name();
|
||||||
items.emplace(dist, std::move(entry));
|
items.try_emplace(dist, std::move(entry));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user