| 328 | } |
| 329 | |
| 330 | void 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; |
nothing calls this directly
no test coverage detected