Fixed some compilation issues
This commit is contained in:
parent
b789e3879d
commit
8b9c3b2de1
6 changed files with 86 additions and 12 deletions
|
@ -20,3 +20,15 @@ else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../system/debug/ -l
|
|||
else:unix: LIBS += -L$$OUT_PWD/../system/ -lpaysages_system
|
||||
INCLUDEPATH += $$PWD/../system
|
||||
DEPENDPATH += $$PWD/../system
|
||||
|
||||
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../basics/release/ -lpaysages_basics
|
||||
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../basics/debug/ -lpaysages_basics
|
||||
else:unix: LIBS += -L$$OUT_PWD/../basics/ -lpaysages_basics
|
||||
INCLUDEPATH += $$PWD/../basics
|
||||
DEPENDPATH += $$PWD/../basics
|
||||
|
||||
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../definition/release/ -lpaysages_definition
|
||||
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../definition/debug/ -lpaysages_definition
|
||||
else:unix: LIBS += -L$$OUT_PWD/../definition/ -lpaysages_definition
|
||||
INCLUDEPATH += $$PWD/../definition
|
||||
DEPENDPATH += $$PWD/../definition
|
||||
|
|
|
@ -3,4 +3,52 @@
|
|||
BaseDefinition::BaseDefinition(BaseDefinition* parent):
|
||||
parent(parent)
|
||||
{
|
||||
if (parent)
|
||||
{
|
||||
root = parent->root;
|
||||
}
|
||||
else
|
||||
{
|
||||
root = this;
|
||||
}
|
||||
}
|
||||
|
||||
BaseDefinition::~BaseDefinition()
|
||||
{
|
||||
QListIterator<BaseDefinition*> it(children);
|
||||
while (it.hasNext())
|
||||
{
|
||||
delete it.next();
|
||||
}
|
||||
}
|
||||
|
||||
void BaseDefinition::addChild(BaseDefinition* child)
|
||||
{
|
||||
if (not children.contains(child))
|
||||
{
|
||||
children.append(child);
|
||||
}
|
||||
}
|
||||
|
||||
void BaseDefinition::removeChild(BaseDefinition* child)
|
||||
{
|
||||
children.removeOne(child);
|
||||
}
|
||||
|
||||
void BaseDefinition::save(PackStream* pack)
|
||||
{
|
||||
QListIterator<BaseDefinition*> it(children);
|
||||
while (it.hasNext())
|
||||
{
|
||||
it.next()->save(pack);
|
||||
}
|
||||
}
|
||||
|
||||
void BaseDefinition::load(PackStream* pack)
|
||||
{
|
||||
QListIterator<BaseDefinition*> it(children);
|
||||
while (it.hasNext())
|
||||
{
|
||||
it.next()->load(pack);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
#define BASEDEFINITION_H
|
||||
|
||||
#include "definition_global.h"
|
||||
#include <QVector>
|
||||
|
||||
class PackStream;
|
||||
#include <QList>
|
||||
#include "PackStream.h" // TODO Delete when c++ migration is done
|
||||
|
||||
namespace paysages {
|
||||
namespace definition {
|
||||
|
@ -18,15 +18,17 @@ public:
|
|||
BaseDefinition(BaseDefinition* parent);
|
||||
virtual ~BaseDefinition();
|
||||
|
||||
void addChild(BaseDefinition* child);
|
||||
void removeChild(BaseDefinition* child);
|
||||
|
||||
virtual void save(PackStream* pack);
|
||||
virtual void load(PackStream* pack);
|
||||
|
||||
protected:
|
||||
void addChild(BaseDefinition* child);
|
||||
void removeChild(BaseDefinition* child);
|
||||
|
||||
private:
|
||||
BaseDefinition* parent;
|
||||
QVector<BaseDefinition*> children;
|
||||
BaseDefinition* root;
|
||||
QList<BaseDefinition*> children;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -162,3 +162,8 @@ else:unix: LIBS += -L$$OUT_PWD/../rendering/ -lpaysages_rendering
|
|||
INCLUDEPATH += $$PWD/../rendering
|
||||
DEPENDPATH += $$PWD/../rendering
|
||||
|
||||
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../definition/release/ -lpaysages_definition
|
||||
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../definition/debug/ -lpaysages_definition
|
||||
else:unix: LIBS += -L$$OUT_PWD/../definition/ -lpaysages_definition
|
||||
INCLUDEPATH += $$PWD/../definition
|
||||
DEPENDPATH += $$PWD/../definition
|
||||
|
|
|
@ -10,7 +10,8 @@ static SceneryCustomDataCallback _custom_save = NULL;
|
|||
static SceneryCustomDataCallback _custom_load = NULL;
|
||||
static void* _custom_data = NULL;
|
||||
|
||||
Scenery::Scenery()
|
||||
Scenery::Scenery():
|
||||
BaseDefinition(NULL)
|
||||
{
|
||||
atmosphere = (AtmosphereDefinition*)AtmosphereDefinitionClass.create();
|
||||
camera = cameraCreateDefinition();
|
||||
|
@ -32,6 +33,8 @@ Scenery::~Scenery()
|
|||
|
||||
void Scenery::save(PackStream* stream)
|
||||
{
|
||||
BaseDefinition::save(stream);
|
||||
|
||||
AtmosphereDefinitionClass.save(stream, atmosphere);
|
||||
cameraSave(stream, camera);
|
||||
CloudsDefinitionClass.save(stream, clouds);
|
||||
|
@ -42,6 +45,8 @@ void Scenery::save(PackStream* stream)
|
|||
|
||||
void Scenery::load(PackStream* stream)
|
||||
{
|
||||
BaseDefinition::load(stream);
|
||||
|
||||
AtmosphereDefinitionClass.load(stream, atmosphere);
|
||||
cameraLoad(stream, camera);
|
||||
CloudsDefinitionClass.load(stream, clouds);
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "BaseDefinition.h"
|
||||
|
||||
//class AtmosphereDefinition;
|
||||
//class CameraDefinition;
|
||||
//class CloudsDefinition;
|
||||
|
@ -31,17 +33,17 @@ namespace rendering {
|
|||
*
|
||||
* This class contains the whole scenery definition.
|
||||
*/
|
||||
class RENDERINGSHARED_EXPORT Scenery
|
||||
class RENDERINGSHARED_EXPORT Scenery: private BaseDefinition
|
||||
{
|
||||
public:
|
||||
Scenery();
|
||||
~Scenery();
|
||||
virtual ~Scenery();
|
||||
|
||||
virtual void save(PackStream* stream);
|
||||
virtual void load(PackStream* stream);
|
||||
|
||||
void autoPreset(int seed);
|
||||
|
||||
void save(PackStream* stream);
|
||||
void load(PackStream* stream);
|
||||
|
||||
void setAtmosphere(AtmosphereDefinition* atmosphere);
|
||||
inline AtmosphereDefinition* getAtmosphere() {return atmosphere;}
|
||||
void getAtmosphere(AtmosphereDefinition* atmosphere);
|
||||
|
|
Loading…
Reference in a new issue