MCPcopy Create free account
hub / github.com/crossuo/crossuo / InsertInContent

Method InsertInContent

src/Gumps/GumpBook.cpp:330–538  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

328}
329
330void CGumpBook::InsertInContent(const Keycode key, bool isCharPress)
331{
332 int page = Page;
333
334 if (page >= 0 && page <= PageCount)
335 {
336 bool isSecondEntry = false;
337 CGUITextEntry *entry = GetEntry(page);
338
339 if (entry == nullptr)
340 {
341 return;
342 }
343
344 if (g_EntryPointer != &entry->m_Entry)
345 {
346 entry = GetEntry(page + 1);
347
348 if (entry != nullptr && page < PageCount - 1 && g_EntryPointer == &entry->m_Entry)
349 {
350 isSecondEntry = true;
351 page++;
352 }
353 else
354 {
355 return;
356 }
357 }
358
359 if (isCharPress)
360 {
361 if (!Unicode && key >= 0x0100)
362 {
363 return;
364 }
365
366 if (g_EntryPointer->Insert(checked_cast<char16_t>(key)))
367 {
368 int linesCount = 0;
369 int maxLinesCount = 8;
370
371 if (!Unicode)
372 {
373 linesCount = g_EntryPointer->GetLinesCountA(4);
374 }
375 else
376 {
377 linesCount = g_EntryPointer->GetLinesCountW(1);
378 }
379
380 if (linesCount > maxLinesCount)
381 {
382 int newPage = page + 1;
383
384 bool pageLimitExceeded = false;
385 if (newPage > PageCount)
386 {
387 pageLimitExceeded = true;

Callers

nothing calls this directly

Calls 14

GetLinesCountAMethod · 0.80
GetLinesCountWMethod · 0.80
PosMethod · 0.80
GetInfoWMethod · 0.80
GetTextWMethod · 0.80
GetInfoAMethod · 0.80
RemoveSequenceMethod · 0.80
LengthMethod · 0.80
SetPosMethod · 0.80
InsertMethod · 0.45
GetTextAMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected