diff options
author | Nils Dagsson Moskopp <nils@dieweltistgarnichtso.net> | 2011-07-31 20:04:04 +0200 |
---|---|---|
committer | Nils Dagsson Moskopp <nils@dieweltistgarnichtso.net> | 2011-07-31 20:04:04 +0200 |
commit | 7ece67727dcc1ff7a6634e4b911eeb82ed3eaf45 (patch) | |
tree | b06cf63fb0c8d01f03c1fb84faa936197029e03f /src/player.cpp | |
parent | 831003156c77c811e7f1fcb65811d1d099587442 (diff) | |
parent | 303351de6d2cb54af27198207ba6c8cef49ecf1a (diff) | |
download | minetest-7ece67727dcc1ff7a6634e4b911eeb82ed3eaf45.tar.gz minetest-7ece67727dcc1ff7a6634e4b911eeb82ed3eaf45.tar.bz2 minetest-7ece67727dcc1ff7a6634e4b911eeb82ed3eaf45.zip |
Merge remote-tracking branch 'origin/upstream'
Diffstat (limited to 'src/player.cpp')
-rw-r--r-- | src/player.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/player.cpp b/src/player.cpp index d52d6b88f..c43276ef1 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -29,6 +29,7 @@ Player::Player(): in_water(false), in_water_stable(false), swimming_up(false), + inventory_backup(NULL), craftresult_is_preview(true), hp(20), peer_id(PEER_ID_INEXISTENT), @@ -43,6 +44,7 @@ Player::Player(): Player::~Player() { + delete inventory_backup; } void Player::resetInventory() @@ -106,8 +108,13 @@ void Player::serialize(std::ostream &os) args.writeLines(os); os<<"PlayerArgsEnd\n"; - - inventory.serialize(os); + + // If actual inventory is backed up due to creative mode, save it + // instead of the dummy creative mode inventory + if(inventory_backup) + inventory_backup->serialize(os); + else + inventory.serialize(os); } void Player::deSerialize(std::istream &is) |