MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / FormatMissionParam

Function FormatMissionParam

engine/Poseidon/Network/NetworkServer.cpp:522–543  ·  view source on GitHub ↗

"Title: " for a mission parameter, or "" when the mission has no such parameter. Falls back to the numeric value when no label matches.

Source from the content-addressed store, hash-verified

520 if (_state >= NGSPrepareSide)
521 {
522 mission = _missionHeader.name;
523 }
524 _server->UpdateSessionDescription(_state, mission);
525}
526
527static bool service_registration_callback(MasterServerServiceRegistration& out, void* userdata)
528{
529 return ((NetworkServer*)userdata)->FillMasterServerServiceRegistration(out);
530}
531
532// Null-safe RString -> std::string (an empty RString may cast to nullptr).
533static std::string ToStdString(const RString& value)
534{
535 return value.GetLength() > 0 ? std::string((const char*)value) : std::string();
536}
537
538// "Title: <selected value's label>" for a mission parameter, or "" when the mission
539// has no such parameter. Falls back to the numeric value when no label matches.
540static std::string FormatMissionParam(const RString& title, const AutoArray<float>& values,
541 const AutoArray<RString>& texts, float selected)
542{
543 if (title.GetLength() <= 0)
544 {
545 return std::string();
546 }

Calls 4

ToStdStringFunction · 0.85
FormatFunction · 0.50
GetLengthMethod · 0.45
SizeMethod · 0.45

Tested by

no test coverage detected