diff --git a/source/glest_game/type_instances/object.cpp b/source/glest_game/type_instances/object.cpp index 0b2b1b85..6da48b67 100644 --- a/source/glest_game/type_instances/object.cpp +++ b/source/glest_game/type_instances/object.cpp @@ -52,6 +52,9 @@ Object::Object(ObjectType *objectType, const Vec3f &pos, const Vec2i &mapPos) : if(tmt->getRotationAllowed() != true) { rotation=0; } + if(tmt->getRandomPositionEnabled() != true) { + this->pos = pos; + } animated=tmt->getAnimSpeed()>0; } visible=false; diff --git a/source/glest_game/types/tileset_model_type.h b/source/glest_game/types/tileset_model_type.h index 5ab7f8a5..bdbc170c 100644 --- a/source/glest_game/types/tileset_model_type.h +++ b/source/glest_game/types/tileset_model_type.h @@ -43,6 +43,7 @@ private: ModelParticleSystemTypes particleTypes; int height; bool rotationAllowed; + bool randomPositionEnabled; bool smoothTwoFrameAnim; int animSpeed; @@ -64,6 +65,9 @@ public: inline bool getRotationAllowed() const {return rotationAllowed;} inline void setRotationAllowed(bool rotationAllowed) {this->rotationAllowed=rotationAllowed;} + + inline bool getRandomPositionEnabled() const {return randomPositionEnabled;} + inline void setRandomPositionEnabled(bool randomPositionEnabled) {this->randomPositionEnabled=randomPositionEnabled;} inline bool getSmoothTwoFrameAnim() const {return smoothTwoFrameAnim;} inline void setSmoothTwoFrameAnim(bool smoothTwoFrameAnim) {this->smoothTwoFrameAnim=smoothTwoFrameAnim;} diff --git a/source/glest_game/world/tileset.cpp b/source/glest_game/world/tileset.cpp index 43926a46..2eee72e2 100644 --- a/source/glest_game/world/tileset.cpp +++ b/source/glest_game/world/tileset.cpp @@ -349,6 +349,13 @@ void Tileset::load(const string &dir, Checksum *checksum, Checksum *tilesetCheck else{ tmt->setRotationAllowed(true); } + //randomPositionEnabled + if(modelNode->hasAttribute("randomPositionEnabled") == true) { + tmt->setRandomPositionEnabled(modelNode->getAttribute("randomPositionEnabled")->getBoolValue()); + } + else{ + tmt->setRandomPositionEnabled(true); + } //smoothTwoFrameAnim if(modelNode->hasAttribute("smoothTwoFrameAnim") == true) {