From 47b64b63fabea0f35346934d5bede99f9816add5 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Fri, 11 Oct 2013 10:12:36 +0200 Subject: Added GetIniItemSet() function. It reads a block / item description from the specified INI file value and returns as cItem; stores and uses the default if value doesn't exist. --- source/BlockID.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'source/BlockID.cpp') diff --git a/source/BlockID.cpp b/source/BlockID.cpp index d91524de5..0c1cb3265 100644 --- a/source/BlockID.cpp +++ b/source/BlockID.cpp @@ -518,6 +518,21 @@ eDamageType StringToDamageType(const AString & a_DamageTypeString) +cItem GetIniItemSet(cIniFile & a_IniFile, const char * a_Section, const char * a_Key, const char * a_Default) +{ + AString ItemStr = a_IniFile.GetValueSet(a_Section, a_Key, a_Default); + cItem res; + if (!StringToItem(ItemStr, res)) + { + res.Empty(); + } + return res; +} + + + + + // This is actually just some code that needs to run at program startup, so it is wrapped into a global var's constructor: class cBlockPropertiesInitializer { -- cgit v1.2.3