CVarPlatform.h 1.32 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
/*
 * CVarPlatform.h
 *
 *  Created on: Sep 6, 2012
 *      Author: gerstrong
 */

#ifndef CVARPLATFORM_H_
#define CVARPLATFORM_H_

#include "CPlatform.h"
12
#include <engine/galaxy/common/ai/CMoveTarget.h>
13 14
#include "CVec.h"

Gerhard Stein's avatar
Gerhard Stein committed
15 16
#include <boost/property_tree/ptree.hpp>

17 18 19
namespace galaxy {


20
class CVarPlatform : public CPlatform, public CMoveTarget
21 22
{
public:
Gerhard Stein's avatar
Gerhard Stein committed
23 24 25
    CVarPlatform(CMap *pmap, const Uint16 foeID, Uint32 x, Uint32 y,
                 const direction_t horidir,
                 const direction_t vertdir,
26
                 const int actionOffset, const int sprVar);
Gerhard Stein's avatar
Gerhard Stein committed
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48

    void process();

    void deserialize(CSaveGameController &savedGame)
    {
        savedGame.decodeData(target.x);
        savedGame.decodeData(target.y);
    }

    void serialize(CSaveGameController &savedGame)
    {
        savedGame.encodeData(target.x);
        savedGame.encodeData(target.y);
    }

    void serialize(boost::property_tree::ptree &node)
    {
        auto &posNode = node.put("target", "");
        posNode.put("<xmlattr>.x", target.x);
        posNode.put("<xmlattr>.y", target.y);
    }

49 50 51 52 53 54 55
    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");
    }

Gerhard Stein's avatar
Gerhard Stein committed
56

57
	
58 59 60 61 62 63
};

};

#endif /* CVARPLATFORM_H_ */