| 42 | } |
| 43 | |
| 44 | void Menu_Log::initializeLogEntries() |
| 45 | { |
| 46 | if (!m_MenuHandle.isValid()) |
| 47 | return; |
| 48 | |
| 49 | MenuItemTypes::MenuItemListbox* listbox_running; |
| 50 | MenuItemTypes::MenuItemListbox* listbox_failed; |
| 51 | MenuItemTypes::MenuItemListbox* listbox_old; |
| 52 | MenuItemTypes::MenuItemListbox* listbox_info; |
| 53 | |
| 54 | // Find listboxes |
| 55 | for (auto& item : m_Items) |
| 56 | if (item.second->getItemScriptData().instanceSymbol == getItemScriptData("MENU_ITEM_LIST_MISSIONS_ACT").instanceSymbol) |
| 57 | listbox_running = dynamic_cast<MenuItemTypes::MenuItemListbox*>(item.second); |
| 58 | else if (item.second->getItemScriptData().instanceSymbol == getItemScriptData("MENU_ITEM_LIST_MISSIONS_FAILED").instanceSymbol) |
| 59 | listbox_failed = dynamic_cast<MenuItemTypes::MenuItemListbox*>(item.second); |
| 60 | else if (item.second->getItemScriptData().instanceSymbol == getItemScriptData("MENU_ITEM_LIST_MISSIONS_OLD").instanceSymbol) |
| 61 | listbox_old = dynamic_cast<MenuItemTypes::MenuItemListbox*>(item.second); |
| 62 | else if (item.second->getItemScriptData().instanceSymbol == getItemScriptData("MENU_ITEM_LIST_LOG").instanceSymbol) |
| 63 | listbox_info = dynamic_cast<MenuItemTypes::MenuItemListbox*>(item.second); |
| 64 | |
| 65 | // Set topic entries to listboxes |
| 66 | const std::map<std::string, Daedalus::GameState::LogTopic>& log = m_Engine.getSession().getLogManager().getPlayerLog(); |
| 67 | for (auto& entry : log) |
| 68 | { |
| 69 | if (entry.second.section == Daedalus::GameState::LogTopic::ESection::LT_Mission) |
| 70 | { |
| 71 | switch (entry.second.status) |
| 72 | { |
| 73 | case Daedalus::GameState::LogTopic::ELogStatus::LS_Running: |
| 74 | listbox_running->addTopic(entry.first, entry.second); |
| 75 | break; |
| 76 | case Daedalus::GameState::LogTopic::ELogStatus::LS_Failed: |
| 77 | listbox_failed->addTopic(entry.first, entry.second); |
| 78 | break; |
| 79 | case Daedalus::GameState::LogTopic::ELogStatus::LS_Obsolete: |
| 80 | LogInfo() << "Found mission with status LS_Obsolete. This is current not supported!"; |
| 81 | break; |
| 82 | case Daedalus::GameState::LogTopic::ELogStatus::LS_Success: |
| 83 | listbox_old->addTopic(entry.first, entry.second); |
| 84 | break; |
| 85 | } |
| 86 | } |
| 87 | else if (entry.second.section == Daedalus::GameState::LogTopic::ESection::LT_Note) |
| 88 | { |
| 89 | listbox_info->addTopic(entry.first, entry.second); |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | // Make actual mission listbox visible |
| 94 | listbox_running->setHidden(false); |
| 95 | } |
| 96 | |
| 97 | MenuItem* UI::Menu_Log::findMenuItem(const std::string& instance) |
| 98 | { |