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

Function TriTypeText

engine/Poseidon/Game/Commands/GameStateExtTest.cpp:1165–1183  ·  view source on GitHub ↗

triTypeText "utf8" — type UTF-8 text through the real input dispatch (World::DoChar), the same entry SDL's TEXT_INPUT events feed. Unlike triSendText (which calls OnChar directly on a control), this routes through the focus + display char path a real keystroke takes — warning box, chat, user dialog, the editor map and its child dialogs — so it reproduces "field is focused but typed text never lan

Source from the content-addressed store, hash-verified

1163 int consumed = DecodeUtf8Codepoint(p, &codepoint);
1164 if (consumed <= 0)
1165 break;
1166 ctrl->OnChar(codepoint, 1, 0);
1167 p += consumed;
1168 }
1169 return GameValue(true);
1170}
1171
1172/// triSendText "utf8" — send UTF-8 text to the focused control. Returns true.
1173GameValue TriSendText(const GameState* state, GameValuePar arg)
1174{
1175 if (arg.GetType() != GameString)
1176 return GameValue(false);
1177
1178 auto* display = GetActiveDisplayForSQF();
1179 if (!display)
1180 return GameValue(false);
1181
1182 GameStringType text = static_cast<GameStringType>(arg);
1183 const char* utf8 = (const char*)text;
1184 LOG_INFO(Core, "[tri] triSendText focused \"{}\"", utf8 ? utf8 : "");
1185 return TriSendTextImpl(display->GetFocused(), utf8);
1186}

Callers

nothing calls this directly

Calls 4

DecodeUtf8CodepointFunction · 0.85
GameValueClass · 0.50
GetTypeMethod · 0.45
DoCharMethod · 0.45

Tested by

no test coverage detected