MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / DedicatedHandleKeyInput

Function DedicatedHandleKeyInput

src/video/dedicated_v.cpp:173–192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

171#endif
172
173static void DedicatedHandleKeyInput()
174{
175 if (!InputWaiting()) return;
176
177 if (_exit_game) return;
178
179 std::string input_line;
180#if defined(UNIX)
181 if (!std::getline(std::cin, input_line)) return;
182#else
183 /* Handle console input, and signal console thread, it can accept input again */
184 std::swap(input_line, _win_console_thread_buffer);
185 SetEvent(_hWaitForInputHandling);
186#endif
187
188 /* Remove any trailing \r or \n, and ensure the string is valid. */
189 auto p = input_line.find_last_not_of("\r\n");
190 if (p != std::string::npos) p++;
191 IConsoleCmdExec(StrMakeValid(input_line.substr(0, p)));
192}
193
194void VideoDriver_Dedicated::MainLoop()
195{

Callers 1

MainLoopMethod · 0.85

Calls 5

InputWaitingFunction · 0.85
swapFunction · 0.85
IConsoleCmdExecFunction · 0.85
substrMethod · 0.80
StrMakeValidFunction · 0.50

Tested by

no test coverage detected