From 968bb5f960811bbbc89c66dc2923f7e510d4420b Mon Sep 17 00:00:00 2001 From: Misa Date: Fri, 12 Feb 2021 12:43:06 -0800 Subject: [PATCH] De-duplicate loading to use LOAD_ARRAY_RENAME() This now means every XML array loading is done with common, re-duplicated code. The only exceptions to this are special cases other than the the majority of cases; the majority being a simple matter of reading an array of integers and putting it into another array. Seems like the only reason I hadn't caught the tag until now was because I was focused on de-duplicating all the array loads in Game::loadstats() and below, forgetting about Game::loadcustomlevelstats(). --- desktop_version/src/Game.cpp | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/desktop_version/src/Game.cpp b/desktop_version/src/Game.cpp index 4712bf4c..28250408 100644 --- a/desktop_version/src/Game.cpp +++ b/desktop_version/src/Game.cpp @@ -540,18 +540,7 @@ void Game::loadcustomlevelstats() pText = ""; } - if (pKey == "customlevelscore") - { - std::string TextString = (pText); - if(TextString.length()) - { - std::vector values = split(TextString,','); - for(size_t i = 0; i < values.size(); i++) - { - customlevelscores.push_back(help.Int(values[i].c_str())); - } - } - } + LOAD_ARRAY_RENAME(customlevelscore, customlevelscores) if (pKey == "customlevelstats") {