From bfa10f9990a8a045b03474d11af75984c12a856a Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Thu, 25 Dec 2008 12:13:56 +0000 Subject: Improved list_zone, list_ships Ship price and cargo size --- src/filesystem/inifile.cc | 12 ++++++++++++ src/filesystem/inifile.h | 2 ++ 2 files changed, 14 insertions(+) (limited to 'src/filesystem') diff --git a/src/filesystem/inifile.cc b/src/filesystem/inifile.cc index ddb1c63..96bfd55 100644 --- a/src/filesystem/inifile.cc +++ b/src/filesystem/inifile.cc @@ -161,6 +161,18 @@ bool IniFile::got_key_float(const char * keylabel, float & f) { } } +bool IniFile::got_key_long(const char * keylabel, long & l) { + if (last_read_was_key && (key_current.compare(keylabel) == 0 )) { + std::istringstream is(value_current); + if (!(is >> l)) { + l = 0; + } + return true; + } else { + return false; + } +} + bool IniFile::got_key(const char * keylabel) { return (last_read_was_key && (key_current.compare(keylabel) == 0 )); } diff --git a/src/filesystem/inifile.h b/src/filesystem/inifile.h index f118f7b..f064bc7 100644 --- a/src/filesystem/inifile.h +++ b/src/filesystem/inifile.h @@ -72,6 +72,8 @@ public: bool got_key_angle(const char * keylabel, float & f); + bool got_key_long(const char * keylabel, long & l); + bool got_key_vector3f(const char * keylabel, math::Vector3f & v); bool got_key_bool(const char * keylabel, bool & b); -- cgit v1.2.3