diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2007-06-02 18:12:48 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2007-06-02 18:12:48 +0000 |
| commit | c9afda3ab74614fb36986f96b7972c082f275eca (patch) | |
| tree | 1b7c0b31950597d6ed562d94158dd3f8701496da /pokemod/Ini.cpp | |
| parent | f71140fae5218ee9839ffcd4ec83abfded5124f4 (diff) | |
| download | sigen-c9afda3ab74614fb36986f96b7972c082f275eca.tar.gz sigen-c9afda3ab74614fb36986f96b7972c082f275eca.tar.xz sigen-c9afda3ab74614fb36986f96b7972c082f275eca.zip | |
Finished off all PokeMod classes, added move validations, fixed up some GUI, various other fixes
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@18 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemod/Ini.cpp')
| -rw-r--r-- | pokemod/Ini.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/pokemod/Ini.cpp b/pokemod/Ini.cpp index 30a7dbfc..af99da47 100644 --- a/pokemod/Ini.cpp +++ b/pokemod/Ini.cpp @@ -23,9 +23,9 @@ #include "Ini.h"
-PokeGen::PokeMod::Ini::Ini(const String &n)
+PokeGen::PokeMod::Ini::Ini(const String &n) :
+ name(n)
{
- name = n;
}
PokeGen::PokeMod::Ini::Ini(std::ifstream &file)
@@ -57,6 +57,11 @@ void PokeGen::PokeMod::Ini::AddField(const String &n, const unsigned v) fields[n] = String("%u", v);
}
+void PokeGen::PokeMod::Ini::AddField(const String &n, const unsigned char v)
+{
+ fields[n] = String("%x", v);
+}
+
void PokeGen::PokeMod::Ini::AddField(const String &n, const char *v)
{
fields[n] = v;
@@ -108,6 +113,19 @@ void PokeGen::PokeMod::Ini::GetValue(const String &field, unsigned &val, const u val = ((UINT_MAX < temp) || *end) ? def : temp;
}
+void PokeGen::PokeMod::Ini::GetValue(const String &field, unsigned char &val, const unsigned char def)
+{
+ if (!fields.count(field))
+ {
+ val = def;
+ return;
+ }
+ unsigned long temp;
+ char *end;
+ temp = std::strtoul(fields[field], &end, 10);
+ val = ((UCHAR_MAX < temp) || *end) ? def : temp;
+}
+
void PokeGen::PokeMod::Ini::GetValue(const String &field, String &val, const String &def)
{
if (!fields.count(field))
|
