summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Steinbrink <B.Steinbrink@gmx.de>2005-08-26 11:49:38 +0000
committerBjörn Steinbrink <B.Steinbrink@gmx.de>2005-08-26 11:49:38 +0000
commitf483df8a94ef57a3c305797ac13cdd4be0cd376c (patch)
tree6fff9f55c8356f4dd33fde4d60960a5c80642dbe
parent8a55458d6b6bbd12da3fc3a927a05be626a710d8 (diff)
downloadmana-f483df8a94ef57a3c305797ac13cdd4be0cd376c.tar.gz
mana-f483df8a94ef57a3c305797ac13cdd4be0cd376c.tar.bz2
mana-f483df8a94ef57a3c305797ac13cdd4be0cd376c.tar.xz
mana-f483df8a94ef57a3c305797ac13cdd4be0cd376c.zip
Remove dependency on math.h
-rw-r--r--ChangeLog1
-rw-r--r--src/configuration.cpp17
2 files changed, 4 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index 52a4ab92..74473254 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
2005-08-26 Björn Steinbrink <B.Steinbrink@gmx.de>
+ * src/configuration.cpp: Remove dependency on math.h.
* src/openglgraphics.cpp: Remove useless code.
* src/openglgraphics.cpp: Use glTranslatef instead of glTranslated.
Remove some useless code.
diff --git a/src/configuration.cpp b/src/configuration.cpp
index 0b43418f..f961c084 100644
--- a/src/configuration.cpp
+++ b/src/configuration.cpp
@@ -24,7 +24,6 @@
#include "configuration.h"
-#include <math.h>
#include <sstream>
#include <libxml/xmlwriter.h>
@@ -136,30 +135,20 @@ void Configuration::setValue(const std::string &key, std::string value)
void Configuration::setValue(const std::string &key, float value)
{
std::stringstream ss;
- if (value == floor(value)) {
- ss << (int)value;
- } else {
- ss << value;
- }
+ ss << ((value == (int)value) ? (int)value : value);
setValue(key, ss.str());
}
std::string Configuration::getValue(const std::string &key, std::string deflt)
{
std::map<std::string, std::string>::iterator iter = options.find(key);
- if (iter != options.end()) {
- return (*iter).second;
- }
- return deflt;
+ return ((iter != options.end()) ? (*iter).second : deflt);
}
float Configuration::getValue(const std::string &key, float deflt)
{
std::map<std::string, std::string>::iterator iter = options.find(key);
- if (iter != options.end()) {
- return atof((*iter).second.c_str());
- }
- return deflt;
+ return (iter != options.end()) ? atof((*iter).second.c_str()) : deflt;
}
void Configuration::addListener(