| 5813 | } |
| 5814 | |
| 5815 | void Engine::AddLevelPathToRecentLevels(const Path& level_path) { |
| 5816 | std::vector<std::string> level_history; |
| 5817 | level_history.push_back(level_path.GetFullPath()); |
| 5818 | |
| 5819 | for (int i = 0; i < kMaxLevelHistory; ++i) { |
| 5820 | const int kConfigKeyNameSize = 128; |
| 5821 | char configKeyName[kConfigKeyNameSize]; |
| 5822 | FormatString(configKeyName, kConfigKeyNameSize, "level_history%d", i + 1); |
| 5823 | |
| 5824 | if (config.HasKey(configKeyName) && config[configKeyName].str() != level_path.GetFullPathStr() && config[configKeyName].str() != "") { |
| 5825 | level_history.push_back(config[configKeyName].str()); |
| 5826 | } |
| 5827 | } |
| 5828 | |
| 5829 | for (int i = 0; i < kMaxLevelHistory; ++i) { |
| 5830 | const int kConfigKeyNameSize = 128; |
| 5831 | char configKeyName[kConfigKeyNameSize]; |
| 5832 | FormatString(configKeyName, kConfigKeyNameSize, "level_history%d", i + 1); |
| 5833 | |
| 5834 | if (i < (int)level_history.size()) { |
| 5835 | config.GetRef(configKeyName) = level_history[i]; |
| 5836 | } else { |
| 5837 | config.GetRef(configKeyName) = ""; |
| 5838 | } |
| 5839 | } |
| 5840 | |
| 5841 | config.Save(GetConfigPath()); |
| 5842 | } |
| 5843 | |
| 5844 | void Engine::GetAvatarIds(std::vector<ObjectID>& avatars) { |
| 5845 | scenegraph_->GetPlayerCharacterIDs(&num_avatars, avatar_ids, kMaxAvatars); |
no test coverage detected