summaryrefslogtreecommitdiff
path: root/src/player.cpp
diff options
context:
space:
mode:
authorShadowNinja <shadowninja@minetest.net>2014-09-11 18:22:05 -0400
committerShadowNinja <shadowninja@minetest.net>2014-09-21 14:39:35 -0400
commit6bc4cad0eddd7a7cf593ca1471599e2d75727379 (patch)
treed05d5f039648d18f49fc0cf56132b2e9a5c88e09 /src/player.cpp
parent2ae5d3f3abc7ac5ee96c4dfc7eeead045fdc775e (diff)
downloadminetest-6bc4cad0eddd7a7cf593ca1471599e2d75727379.tar.gz
minetest-6bc4cad0eddd7a7cf593ca1471599e2d75727379.tar.bz2
minetest-6bc4cad0eddd7a7cf593ca1471599e2d75727379.zip
Split settings into seperate source and header files
This also cleans up settings a bit
Diffstat (limited to 'src/player.cpp')
-rw-r--r--src/player.cpp22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/player.cpp b/src/player.cpp
index 40d403952..8e5f56199 100644
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -18,12 +18,16 @@ with this program; if not, write to the Free Software Foundation, Inc.,
*/
#include "player.h"
+
+#include <fstream>
+#include "util/numeric.h"
#include "hud.h"
#include "constants.h"
#include "gamedef.h"
#include "settings.h"
#include "content_sao.h"
-#include "util/numeric.h"
+#include "filesys.h"
+#include "log.h"
Player::Player(IGameDef *gamedef):
touching_ground(false),
@@ -195,18 +199,10 @@ void Player::serialize(std::ostream &os)
void Player::deSerialize(std::istream &is, std::string playername)
{
Settings args;
-
- for(;;)
- {
- if(is.eof())
- throw SerializationError
- (("Player::deSerialize(): PlayerArgsEnd of player \"" + playername + "\" not found").c_str());
- std::string line;
- std::getline(is, line);
- std::string trimmedline = trim(line);
- if(trimmedline == "PlayerArgsEnd")
- break;
- args.parseConfigLine(line);
+
+ if (!args.parseConfigLines(is, "PlayerArgsEnd")) {
+ throw SerializationError("PlayerArgsEnd of player " +
+ playername + " not found!");
}
//args.getS32("version"); // Version field value not used