MCPcopy Create free account
hub / github.com/Norbyte/bg3se / InputLoop

Method InputLoop

BG3Extender/Extender/Shared/Console.cpp:201–254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

199}
200
201void DebugConsole::InputLoop()
202{
203 std::string line;
204 while (consoleRunning_) {
205 UpdateConsoleSize();
206
207 inputEnabled_ = true;
208 if (serverContext_) {
209 std::cout << "S";
210 } else {
211 std::cout << "C";
212 }
213
214 if (multiLineMode_) {
215 std::cout << " -->> ";
216 } else {
217 std::cout << " >> ";
218 }
219
220 std::cout.flush();
221 std::getline(std::cin, line);
222
223 if (std::cin.fail() || std::cin.eof()) {
224 std::cin.clear();
225 multiLineMode_ = false;
226 multiLineCommand_.clear();
227 std::cout << std::endl;
228 }
229
230 inputEnabled_ = false;
231
232 if (!multiLineMode_) {
233 if (line == "exit") {
234 break;
235 }
236
237 if (line == "--[[") {
238 multiLineMode_ = true;
239 multiLineCommand_.clear();
240 continue;
241 }
242
243 HandleCommand(line);
244 } else {
245 if (line == "]]--") {
246 multiLineMode_ = false;
247 HandleCommand(multiLineCommand_);
248 } else {
249 multiLineCommand_ += line;
250 multiLineCommand_ += '\n';
251 }
252 }
253 }
254}
255
256void DebugConsole::UpdateConsoleSize()
257{

Callers

nothing calls this directly

Calls 1

clearMethod · 0.45

Tested by

no test coverage detected