diff options
author | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-03-12 13:24:16 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-03-12 21:23:10 +0100 |
commit | 306ad2effe4d0897453e61ad787e01dc47c33076 (patch) | |
tree | 75b8b291af55e80d01d9eb85afd7d465233a1a57 /src/configuration.h | |
parent | 66599a9896e0cf69b58c0a73152aba4750d87af2 (diff) | |
download | mana-306ad2effe4d0897453e61ad787e01dc47c33076.tar.gz mana-306ad2effe4d0897453e61ad787e01dc47c33076.tar.bz2 mana-306ad2effe4d0897453e61ad787e01dc47c33076.tar.xz mana-306ad2effe4d0897453e61ad787e01dc47c33076.zip |
General code cleanups
* Use default member initializers
* Use range-based for loops
* Avoid needless pointer references for ShopItem::mDuplicates
* Removed type aliases that are only used once or twice
* Removed more unused includes
* Removed some unused functions
* Removed superfluous .c_str()
* Rely on default copy and assignment operators for Vector class
* Use std::unique_ptr in some places
* Removed duplicated mPlayerMoney updating in SellDialog
* Removed duplicated Game::handleInput call
* Removed unused SDLInput::mMouseInWindow
* Removed remnant of manual widget positioning in HelpWindow
* Removed superfluous initialization of static pointers
Diffstat (limited to 'src/configuration.h')
-rw-r--r-- | src/configuration.h | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/configuration.h b/src/configuration.h index 5864829e..81806ad9 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -65,7 +65,7 @@ class ConfigurationListManager virtual CONT readConfigItem(ConfigurationObject *obj, CONT container) = 0; - virtual ~ConfigurationListManager() {} + virtual ~ConfigurationListManager() = default; }; /** @@ -127,8 +127,8 @@ class ConfigurationObject ConfigurationListManager<T, CONT> *manager) { auto *nextobj = new ConfigurationObject; - deleteList(name); - ConfigurationList *list = &(mContainerOptions[name]); + std::list<ConfigurationObject *> &list = mContainerOptions[name]; + deleteList(list); for (IT it = begin; it != end; it++) { @@ -137,7 +137,7 @@ class ConfigurationObject { // wrote something assert (wrobj == nextobj); nextobj = new ConfigurationObject; - list->push_back(wrobj); + list.push_back(wrobj); } else { @@ -174,13 +174,10 @@ class ConfigurationObject virtual void initFromXML(xmlNodePtr node); virtual void writeToXML(xmlTextWriterPtr writer); - void deleteList(const std::string &name); + void deleteList(std::list<ConfigurationObject *> &list); - using Options = std::map<std::string, std::string>; - Options mOptions; - - using ConfigurationList = std::list<ConfigurationObject *>; - std::map<std::string, ConfigurationList> mContainerOptions; + std::map<std::string, std::string> mOptions; + std::map<std::string, std::list<ConfigurationObject *>> mContainerOptions; }; /** |