MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / remove

Function remove

src/OpenLoco/src/MessageManager.cpp:452–472  ·  view source on GitHub ↗

0x00428DAB

Source from the content-addressed store, hash-verified

450
451 // 0x00428DAB
452 static void remove(const MessageId id)
453 {
454 if (getGameState().activeMessageIndex != MessageId::null)
455 {
456 if (id == getGameState().activeMessageIndex)
457 {
458 clearActiveMessage();
459 }
460 else if (enumValue(id) < enumValue(getGameState().activeMessageIndex))
461 {
462 getGameState().activeMessageIndex = static_cast<MessageId>(enumValue(getGameState().activeMessageIndex) - 1);
463 }
464 }
465 setNumMessages(getNumMessages() - 1);
466 // Move element to end of array (this seems excessive you could just move to end of numMessages)
467 if (enumValue(id) < Limits::kMaxMessages - 1)
468 {
469 std::rotate(get(id), get(id) + 1, std::end(rawMessages()));
470 }
471 Ui::WindowManager::invalidate(Ui::WindowType::messages);
472 }
473
474 // 0x0042851C
475 void removeAllSubjectRefs(const uint16_t subject, MessageItemArgumentType type)

Callers 9

postFunction · 0.70
updateDailyFunction · 0.70
exitCleanlyFunction · 0.70
autosaveCleanFunction · 0.70
cleanupLogFilesFunction · 0.70
processFileForDeleteFunction · 0.50
unloadBufferFunction · 0.50
TESTFunction · 0.50

Calls 8

clearActiveMessageFunction · 0.85
enumValueFunction · 0.85
setNumMessagesFunction · 0.85
getNumMessagesFunction · 0.85
endFunction · 0.85
getFunction · 0.70
invalidateFunction · 0.70
rotateFunction · 0.50

Tested by 1

TESTFunction · 0.40