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

Function ConsoleRun

engine/Poseidon/Dev/Debug/DebugOverlay.cpp:750–784  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

748 s_console.scrollback.begin() + (s_console.scrollback.size() - 200));
749}
750
751void ConsoleRun(std::string_view line)
752{
753 while (!line.empty() && (line.front() == ' ' || line.front() == '\t'))
754 line.remove_prefix(1);
755 if (line.empty())
756 return;
757 ConsoleAppend(std::string("> ") + std::string(line));
758
759 const bool forceSqf = !line.empty() && line.front() == ':';
760 if (forceSqf)
761 line.remove_prefix(1);
762
763 if (!forceSqf)
764 {
765 std::string out;
766 if (DebugCommands::Run(line, out))
767 {
768 if (!out.empty())
769 ConsoleAppend(out);
770 return;
771 }
772 }
773
774 // SQF path. Mirrors the Evaluator/express.hpp idiom — runs in the
775 // current game state's evaluation context. No-op + error log when
776 // no world is up (e.g. main-menu, before mission load).
777 if (!GWorld || !GWorld->GetGameState())
778 {
779 ConsoleAppend("(no game state — SQF unavailable here)");
780 return;
781 }
782 GameValue result = GWorld->GetGameState()->EvaluateMultiple(std::string(line).c_str());
783 if (result.GetType() != GameNothing)
784 ConsoleAppend(std::string("= ") + (const char*)result.GetText());
785}
786} // namespace
787

Callers 1

DrawConsoleTabFunction · 0.85

Calls 7

ConsoleAppendFunction · 0.85
RunFunction · 0.85
EvaluateMultipleMethod · 0.80
emptyMethod · 0.45
GetGameStateMethod · 0.45
GetTypeMethod · 0.45
GetTextMethod · 0.45

Tested by

no test coverage detected