MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / AddLevelPathToRecentLevels

Method AddLevelPathToRecentLevels

Source/Main/engine.cpp:5815–5842  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5813}
5814
5815void 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
5844void Engine::GetAvatarIds(std::vector<ObjectID>& avatars) {
5845 scenegraph_->GetPlayerCharacterIDs(&num_avatars, avatar_ids, kMaxAvatars);

Callers 1

SaveLevelMethod · 0.80

Calls 10

FormatStringFunction · 0.85
GetConfigPathFunction · 0.85
GetFullPathMethod · 0.80
HasKeyMethod · 0.80
GetFullPathStrMethod · 0.80
push_backMethod · 0.45
strMethod · 0.45
sizeMethod · 0.45
GetRefMethod · 0.45
SaveMethod · 0.45

Tested by

no test coverage detected