1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
|
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
#include "FeatureDef.h"
#include "Rendering/Models/IModelParser.h"
#include "Sim/Misc/CollisionVolume.h"
#include "System/EventHandler.h"
CR_BIND(FeatureDef, );
CR_REG_METADATA(FeatureDef, (
CR_MEMBER(myName),
CR_MEMBER(description),
CR_MEMBER(metal),
CR_MEMBER(id),
CR_MEMBER(energy),
CR_MEMBER(maxHealth),
CR_MEMBER(reclaimTime),
CR_MEMBER(mass),
CR_MEMBER(crushResistance),
CR_MEMBER(upright),
CR_MEMBER(drawType),
//CR_MEMBER(model), FIXME
CR_MEMBER(modelname),
CR_MEMBER(resurrectable),
CR_MEMBER(destructable),
CR_MEMBER(blocking),
CR_MEMBER(burnable),
CR_MEMBER(floating),
CR_MEMBER(geoThermal),
CR_MEMBER(deathFeature),
CR_MEMBER(smokeTime),
CR_MEMBER(xsize),
CR_MEMBER(zsize)
));
FeatureDef::FeatureDef()
: collisionVolume(NULL)
, id(-1)
, metal(0)
, energy(0)
, maxHealth(0)
, reclaimTime(0)
, mass(0.0f)
, crushResistance(0.0f)
, drawType(0)
, model(NULL)
, resurrectable(false)
, smokeTime(0)
, destructable(false)
, reclaimable(true)
, autoreclaim(true)
, blocking(false)
, burnable(false)
, floating(false)
, noSelect(false)
, geoThermal(false)
, upright(false)
, xsize(0)
, zsize(0)
{
}
FeatureDef::~FeatureDef() {
delete collisionVolume;
collisionVolume = NULL;
}
S3DModel* FeatureDef::LoadModel() const
{
if (this->model == NULL)
this->model = modelParser->Load3DModel(modelname);
else
eventHandler.LoadedModelRequested();
return (this->model);
}
|