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

Function ParseTriggerTime

apps/cwr/Game/GameApplication.cpp:442–451  ·  view source on GitHub ↗

Parse the trigger portion of a spec token (everything before the first ':'). "700" → {frame=700, timeMs=-1}; "2.5s" → {frame=-1, timeMs=2500}.

Source from the content-addressed store, hash-verified

440// Parse the trigger portion of a spec token (everything before the first ':').
441// "700" → {frame=700, timeMs=-1}; "2.5s" → {frame=-1, timeMs=2500}.
442static TimedTrigger ParseTriggerTime(const std::string& spec, size_t colonPos)
443{
444 std::string timeStr = spec.substr(0, colonPos);
445 if (!timeStr.empty() && (timeStr.back() == 's' || timeStr.back() == 'S'))
446 {
447 float secs = std::stof(timeStr.substr(0, timeStr.size() - 1));
448 return {-1, static_cast<int>(secs * 1000.0f), false};
449 }
450 return {std::stoi(timeStr), -1, false};
451}
452
453// Returns true once per trigger, when either frame or elapsed time matches.
454static bool TriggerReady(TimedTrigger& t, int frame, uint32_t elapsedMs)

Callers 3

ParseAutoKeysFunction · 0.85
ParseAutoScreenshotsFunction · 0.85
RunMainLoopMethod · 0.85

Calls 2

sizeMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected