Commit 7788514f authored by Gerhard Stein's avatar Gerhard Stein

Forwarding boost property tree should improve the compilation process

parent 061e6d8a
#include "inventory.h"
#include <boost/property_tree/ptree.hpp>
void stInventory::serialize(boost::property_tree::ptree &node)
{
node.put("score", score);
node.put("extralifeat", extralifeat);
node.put("charges", charges);
node.put("lives", lives);
node.put("HasPogo", HasPogo);
node.put("HasCardYellow", HasCardYellow);
node.put("HasCardRed", HasCardRed);
node.put("HasCardGreen", HasCardGreen);
node.put("HasCardBlue", HasCardBlue);
node.put("HasJoystick",HasJoystick);
node.put("HasWiskey",HasWiskey);
node.put("HasBattery",HasBattery);
node.put("HasVacuum",HasVacuum);
node.put("canlooseitem1", canlooseitem[0]);
node.put("canlooseitem2", canlooseitem[1]);
node.put("canlooseitem3", canlooseitem[2]);
node.put("canlooseitem4", canlooseitem[3]);
}
void stInventory::deserialize(boost::property_tree::ptree &node)
{
score = node.get<unsigned long>("score", 0);
extralifeat = node.get<unsigned long>("extralifeat", 0);
charges = node.get<int>("charges", 0);
lives = node.get<signed char>("lives", 0);
HasPogo = node.get<bool>("HasPogo", false);
HasCardYellow = node.get<unsigned char>("HasCardYellow", 0);
HasCardRed = node.get<unsigned char>("HasCardRed", 0);
HasCardGreen = node.get<unsigned char>("HasCardGreen", 0);
HasCardBlue = node.get<unsigned char>("HasCardBlue", 0);
HasJoystick = node.get<bool>("HasJoystick", false);
HasWiskey = node.get<bool>("HasWiskey", false);
HasBattery = node.get<bool>("HasBattery", false);
HasVacuum = node.get<bool>("HasVacuum", false);
canlooseitem[0] = node.get<bool>("canlooseitem1", false);
canlooseitem[1] = node.get<bool>("canlooseitem2", false);
canlooseitem[2] = node.get<bool>("canlooseitem3", false);
canlooseitem[3] = node.get<bool>("canlooseitem4", false);
}
......@@ -7,7 +7,7 @@
#ifndef inventory_h
#define inventory_h
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/ptree_fwd.hpp>
struct stInventory
{
......@@ -29,54 +29,9 @@ struct stInventory
bool canlooseitem[4] = {0,0,0,0};
void serialize(boost::property_tree::ptree &node)
{
node.put("score", score);
node.put("extralifeat", extralifeat);
void serialize(boost::property_tree::ptree &node);
node.put("charges", charges);
node.put("lives", lives);
node.put("HasPogo", HasPogo);
node.put("HasCardYellow", HasCardYellow);
node.put("HasCardRed", HasCardRed);
node.put("HasCardGreen", HasCardGreen);
node.put("HasCardBlue", HasCardBlue);
node.put("HasJoystick",HasJoystick);
node.put("HasWiskey",HasWiskey);
node.put("HasBattery",HasBattery);
node.put("HasVacuum",HasVacuum);
node.put("canlooseitem1", canlooseitem[0]);
node.put("canlooseitem2", canlooseitem[1]);
node.put("canlooseitem3", canlooseitem[2]);
node.put("canlooseitem4", canlooseitem[3]);
}
void deserialize(boost::property_tree::ptree &node)
{
score = node.get<unsigned long>("score", 0);
extralifeat = node.get<unsigned long>("extralifeat", 0);
charges = node.get<int>("charges", 0);
lives = node.get<signed char>("lives", 0);
HasPogo = node.get<bool>("HasPogo", false);
HasCardYellow = node.get<unsigned char>("HasCardYellow", 0);
HasCardRed = node.get<unsigned char>("HasCardRed", 0);
HasCardGreen = node.get<unsigned char>("HasCardGreen", 0);
HasCardBlue = node.get<unsigned char>("HasCardBlue", 0);
HasJoystick = node.get<bool>("HasJoystick", false);
HasWiskey = node.get<bool>("HasWiskey", false);
HasBattery = node.get<bool>("HasBattery", false);
HasVacuum = node.get<bool>("HasVacuum", false);
canlooseitem[0] = node.get<bool>("canlooseitem1", false);
canlooseitem[1] = node.get<bool>("canlooseitem2", false);
canlooseitem[2] = node.get<bool>("canlooseitem3", false);
canlooseitem[3] = node.get<bool>("canlooseitem4", false);
}
void deserialize(boost::property_tree::ptree &node);
};
......
......@@ -11,7 +11,6 @@
#define CWORLDMAP_H_
#include "../CMapPlayGalaxy.h"
#include <boost/property_tree/ptree.hpp>
namespace galaxy {
......
#include "Autogun.h"
#include "CPlayerBase.h"
#include <boost/property_tree/ptree.hpp>
namespace galaxy
{
......@@ -59,6 +61,28 @@ CGalaxySpriteObject(pmap, foeID, x, y, sprVar)
performCollisions();
}
void AutoShot::deserialize(boost::property_tree::ptree &node)
{
mTimer = node.get("<xmlattr>.timer", mTimer);
auto &posNode = node.put("pos", "");
m_Pos.x = posNode.get<Uint32>("<xmlattr>.x", m_Pos.x);
m_Pos.y = posNode.get<Uint32>("<xmlattr>.y", m_Pos.y);
auto &originNode = node.put("origin", "");
origin.x = originNode.get<Uint32>("<xmlattr>.x", origin.x);
origin.y = originNode.get<Uint32>("<xmlattr>.y", origin.y);
}
void AutoShot::serialize(boost::property_tree::ptree &node)
{
node.put("<xmlattr>.timer", mTimer);
auto &posNode = node.put("pos", "");
posNode.put("<xmlattr>.x", m_Pos.x);
posNode.put("<xmlattr>.y", m_Pos.y);
auto &originNode = node.put("origin", "");
originNode.put("<xmlattr>.x", origin.x);
originNode.put("<xmlattr>.y", origin.y);
}
void AutoShot::waiting()
{
const int ep = gBehaviorEngine.getEpisode();
......
......@@ -18,27 +18,9 @@ public:
void getTouchedBy(CSpriteObject &theObject);
void deserialize(boost::property_tree::ptree &node)
{
mTimer = node.get("<xmlattr>.timer", mTimer);
auto &posNode = node.put("pos", "");
m_Pos.x = posNode.get<Uint32>("<xmlattr>.x", m_Pos.x);
m_Pos.y = posNode.get<Uint32>("<xmlattr>.y", m_Pos.y);
auto &originNode = node.put("origin", "");
origin.x = originNode.get<Uint32>("<xmlattr>.x", origin.x);
origin.y = originNode.get<Uint32>("<xmlattr>.y", origin.y);
}
void serialize(boost::property_tree::ptree &node)
{
node.put("<xmlattr>.timer", mTimer);
auto &posNode = node.put("pos", "");
posNode.put("<xmlattr>.x", m_Pos.x);
posNode.put("<xmlattr>.y", m_Pos.y);
auto &originNode = node.put("origin", "");
originNode.put("<xmlattr>.x", origin.x);
originNode.put("<xmlattr>.y", origin.y);
}
void deserialize(boost::property_tree::ptree &node);
void serialize(boost::property_tree::ptree &node);
private:
......
......@@ -8,6 +8,7 @@
#include "CFlag.h"
#include "sdl/audio/Audio.h"
#include <boost/property_tree/ptree.hpp>
namespace galaxy {
......@@ -63,6 +64,20 @@ m_baseframe(0)
}
void CFlag::serialize(boost::property_tree::ptree &node)
{
auto &posNode = node.put("position", "");
posNode.put("<xmlattr>.x", m_Pos.x);
posNode.put("<xmlattr>.y", m_Pos.y);
}
void CFlag::deserialize(boost::property_tree::ptree &node)
{
auto &posNode = node.put("position", "");
m_Pos.x = posNode.get<Uint32>("<xmlattr>.x", m_Pos.x);
m_Pos.y = posNode.get<Uint32>("<xmlattr>.y", m_Pos.y);
}
void CFlag::deserialize(CSaveGameController &savedGame)
{
savedGame.decodeData(m_Pos.x);
......
......@@ -34,18 +34,9 @@ namespace galaxy {
void serialize(CSaveGameController &savedGame);
void serialize(boost::property_tree::ptree &node)
{
auto &posNode = node.put("position", "");
posNode.put("<xmlattr>.x", m_Pos.x);
posNode.put("<xmlattr>.y", m_Pos.y);
}
void deserialize(boost::property_tree::ptree &node)
{
auto &posNode = node.put("position", "");
m_Pos.x = posNode.get<Uint32>("<xmlattr>.x", m_Pos.x);
m_Pos.y = posNode.get<Uint32>("<xmlattr>.y", m_Pos.y);
}
void serialize(boost::property_tree::ptree &node);
void deserialize(boost::property_tree::ptree &node);
void getTouchedBy(CSpriteObject &theObject);
......
......@@ -7,7 +7,6 @@
#ifndef CMOVETARGET_H
#define CMOVETARGET_H
//#include <base/utils/CVec.h>
#include "engine/core/direction.h"
#include "engine/core/CMap.h"
......
......@@ -18,6 +18,8 @@
#include <base/GsTimer.h>
#include <base/GsLogging.h>
#include <boost/property_tree/ptree.hpp>
#include "../dialog/CMessageBoxBitmapGalaxy.h"
......
......@@ -23,6 +23,8 @@
#include <array>
#include <boost/property_tree/ptree.hpp>
#include "engine/core/CBehaviorEngine.h"
const int TIME_TO_WAVE = 400;
......@@ -85,6 +87,27 @@ serialize(CSaveGameController &savedGame)
savedGame.encodeData(mUsedGrapplingHook);
}
void
CPlayerWM::
serialize(boost::property_tree::ptree &node)
{
node.put("usedGrapplingHook", mUsedGrapplingHook);
const bool swimming = isSwimming();
node.put("isSwimming", swimming);
}
void
CPlayerWM::
deserialize(boost::property_tree::ptree &node)
{
mUsedGrapplingHook = node.get<bool>("usedGrapplingHook", false);
bool swimming;
swimming = node.get<bool>("isSwimming",false);
makeHimSwim(swimming);
}
/**
* Before Keen rides on the foot we get the location where to ride
*/
......
......@@ -49,24 +49,10 @@ public:
void pumpEvent(const CEvent *evPtr);
void deserialize(CSaveGameController &savedGame);
void serialize(CSaveGameController &savedGame);
void serialize(boost::property_tree::ptree &node)
{
node.put("usedGrapplingHook", mUsedGrapplingHook);
const bool swimming = isSwimming();
node.put("isSwimming", swimming);
}
void deserialize(boost::property_tree::ptree &node)
{
mUsedGrapplingHook = node.get<bool>("usedGrapplingHook", false);
bool swimming;
swimming = node.get<bool>("isSwimming",false);
makeHimSwim(swimming);
}
void serialize(boost::property_tree::ptree &node);
void deserialize(boost::property_tree::ptree &node);
void process();
void processMoving();
......
......@@ -7,6 +7,8 @@
#include "CVarPlatform.h"
#include <boost/property_tree/ptree.hpp>
namespace galaxy {
......@@ -51,6 +53,25 @@ serialize(CSaveGameController &savedGame)
savedGame.encodeData(target.y);
}
void
CVarPlatform::
serialize(boost::property_tree::ptree &node)
{
auto &posNode = node.put("target", "");
posNode.put("<xmlattr>.x", target.x);
posNode.put("<xmlattr>.y", target.y);
}
void
CVarPlatform::
deserialize(boost::property_tree::ptree &node)
{
auto &posNode = node.get_child("target");
target.x = posNode.get<int>("<xmlattr>.x");
target.y = posNode.get<int>("<xmlattr>.y");
}
void CVarPlatform::process()
{
......
......@@ -11,12 +11,11 @@
#include "../CMoveTarget.h"
#include "CPlatform.h"
//#include <base/utils/CVec.h>
#include <boost/property_tree/ptree.hpp>
namespace galaxy {
#include <boost/property_tree/ptree_fwd.hpp>
namespace galaxy
{
class CVarPlatform : public CPlatform, public CMoveTarget
{
......@@ -32,25 +31,12 @@ public:
void serialize(CSaveGameController &savedGame);
void serialize(boost::property_tree::ptree &node)
{
auto &posNode = node.put("target", "");
posNode.put("<xmlattr>.x", target.x);
posNode.put("<xmlattr>.y", target.y);
}
void deserialize(boost::property_tree::ptree &node)
{
auto &posNode = node.get_child("target");
target.x = posNode.get<int>("<xmlattr>.x");
target.y = posNode.get<int>("<xmlattr>.y");
}
void serialize(boost::property_tree::ptree &node);
void deserialize(boost::property_tree::ptree &node);
};
};
}
#endif /* CVARPLATFORM_H_ */
......@@ -41,6 +41,22 @@ serialize(CSaveGameController &savedGame)
}
void
CGrabbiter::serialize(boost::property_tree::ptree &node)
{
auto &posNode = node.put("pos", "");
posNode.put("<xmlattr>.x", m_Pos.x);
posNode.put("<xmlattr>.y", m_Pos.y);
}
void
CGrabbiter::deserialize(boost::property_tree::ptree &node)
{
auto &posNode = node.put("pos", "");
m_Pos.x = posNode.get<Uint32>("<xmlattr>.x", m_Pos.x);
m_Pos.y = posNode.get<Uint32>("<xmlattr>.y", m_Pos.y);
}
void CGrabbiter::processHungry()
{
......
......@@ -3,6 +3,8 @@
#include "../../common/ai/CStunnable.h"
#include <boost/property_tree/ptree.hpp>
namespace galaxy
{
......@@ -11,23 +13,11 @@ class CGrabbiter : public CStunnable
public:
CGrabbiter(CMap *pmap, const Uint16 foeID, const Uint32 x, const Uint32 y);
void deserialize(CSaveGameController &savedGame) override;
void deserialize(CSaveGameController &savedGame) override;
void serialize(CSaveGameController &savedGame) override;
void serialize(boost::property_tree::ptree &node) override
{
auto &posNode = node.put("pos", "");
posNode.put("<xmlattr>.x", m_Pos.x);
posNode.put("<xmlattr>.y", m_Pos.y);
}
void deserialize(boost::property_tree::ptree &node) override
{
auto &posNode = node.put("pos", "");
m_Pos.x = posNode.get<Uint32>("<xmlattr>.x", m_Pos.x);
m_Pos.y = posNode.get<Uint32>("<xmlattr>.y", m_Pos.y);
}
void serialize(boost::property_tree::ptree &node) override;
void deserialize(boost::property_tree::ptree &node) override;
void processHungry();
......
......@@ -2,6 +2,7 @@
#include "../../common/ai/CPlayerBase.h"
#include "../../common/dialog/CMessageBoxBitmapGalaxy.h"
#include <boost/property_tree/ptree.hpp>
namespace galaxy
{
......@@ -64,6 +65,34 @@ serialize(CSaveGameController &savedGame)
}
void
CRocket::
serialize(boost::property_tree::ptree &node)
{
auto &posNode = node.put("pos","");
posNode.put("<xmlattr>.x", m_Pos.x);
posNode.put("<xmlattr>.y", m_Pos.y);
auto &targetNode = node.put("target","");
targetNode.put("<xmlattr>.x", target.x);
targetNode.put("<xmlattr>.y", target.y);
}
void
CRocket::
deserialize(boost::property_tree::ptree &node)
{
auto &posNode = node.put("pos", "");
m_Pos.x = posNode.get<Uint32>("<xmlattr>.x", m_Pos.x);
m_Pos.y = posNode.get<Uint32>("<xmlattr>.y", m_Pos.y);
auto &targetNode = node.put("target","");
target.x = targetNode.get<int>("<xmlattr>.x", target.x);
target.y = targetNode.get<int>("<xmlattr>.y", target.y);
}
void CRocket::processSitting()
{
......
......@@ -18,27 +18,9 @@ public:
void serialize(CSaveGameController &savedGame);
void serialize(boost::property_tree::ptree &node)
{
auto &posNode = node.put("pos","");
posNode.put("<xmlattr>.x", m_Pos.x);
posNode.put("<xmlattr>.y", m_Pos.y);
void serialize(boost::property_tree::ptree &node);
auto &targetNode = node.put("target","");
targetNode.put("<xmlattr>.x", target.x);
targetNode.put("<xmlattr>.y", target.y);
}
void deserialize(boost::property_tree::ptree &node)
{
auto &posNode = node.put("pos", "");
m_Pos.x = posNode.get<Uint32>("<xmlattr>.x", m_Pos.x);
m_Pos.y = posNode.get<Uint32>("<xmlattr>.y", m_Pos.y);
auto &targetNode = node.put("target","");
target.x = targetNode.get<int>("<xmlattr>.x", target.x);
target.y = targetNode.get<int>("<xmlattr>.y", target.y);
}
void deserialize(boost::property_tree::ptree &node);
/**
......
......@@ -2,6 +2,8 @@
#include "../../common/ai/CPlayerBase.h"
#include <boost/property_tree/ptree.hpp>
/*
$1B9EW #Keen throw rope
$1BBCW #Keen throw rope
......@@ -36,6 +38,16 @@ mTimer(0)
}
void
CRope::
serialize(boost::property_tree::ptree &node)
{
auto &posNode = node.put("pos", "");
posNode.put("<xmlattr>.x", m_Pos.x);
posNode.put("<xmlattr>.y", m_Pos.y);
}
void
CRope::
deserialize(CSaveGameController &savedGame)
......
......@@ -20,12 +20,7 @@ public:
void serialize(CSaveGameController &savedGame);
void serialize(boost::property_tree::ptree &node)
{
auto &posNode = node.put("pos", "");
posNode.put("<xmlattr>.x", m_Pos.x);
posNode.put("<xmlattr>.y", m_Pos.y);
}
void serialize(boost::property_tree::ptree &node);
void getTouchedBy(CSpriteObject &theObject);
......
......@@ -82,9 +82,9 @@ bool CAudioGalaxy::readPCSpeakerSoundintoWaveForm(CSoundSlot &soundslot,
void CAudioGalaxy::setupAudioMap()
{
// Preparation which might help wehn some patches are applied
byte *ptr = gKeenFiles.exeFile.getRawData();
//byte *ptr = gKeenFiles.exeFile.getRawData();
auto episode = gBehaviorEngine.getEpisode();
size_t holder = 0;
//size_t holder = 0;
// Episode 4
sndSlotMapGalaxy[4][SOUND_KEEN_WALK] = 0;
......
......@@ -11,6 +11,7 @@
#include "ItemsGalaxy.h"
#include "engine/core/CBehaviorEngine.h"
#include <boost/property_tree/ptree.hpp>
void stItemGalaxy::reset()
{
......
......@@ -10,8 +10,7 @@
#ifndef ITEMSGALAXY_H_
#define ITEMSGALAXY_H_
//#include "engine/core/CBehaviorEngine.h"
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/ptree_fwd.hpp>
#include <string>
struct stItemGalaxy
......
......@@ -30,6 +30,8 @@
#include <fileio/KeenFiles.h>
#include <algorithm>
namespace vorticon
{
......
......@@ -10,6 +10,7 @@
#include "../CVorticonMapLoader.h"
#include <base/utils/Base64.h>
#include <boost/property_tree/ptree.hpp>
///////////////////////////
// Game State Management //
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment