00001
00011 #ifndef __OBJECTFIXED__H__
00012 #define __OBJECTFIXED__H__
00013
00014 #include <wx/wx.h>
00015 #include <wx/colour.h>
00016
00017 #include "../common.h"
00018 #include "../tinyxml/tinyxml.h"
00019 #include "Object.h"
00020
00024 class ObjectFixed: public Object {
00025 public:
00029 class Config: public Object::Config {
00030 public:
00039 Config(const string & imageFile, const Direction & objectDirection, const Action & objectAction,
00040 const string & objectName, const string & objectDescription):
00041 Object::Config(imageFile, objectDirection, objectAction, objectName, objectDescription)
00042 {}
00043
00047 explicit Config(TiXmlElement * node);
00048
00052 virtual ~Config() {}
00053
00059 virtual void ShowEditationWindow(wxWindow * parent, bool waitUntilClosed = true);
00060
00064 virtual TiXmlElement * CreateXmlNode() const;
00065
00069 virtual const string & GetObjectClassName() const {
00070 return CLASS_NAME;
00071 }
00072
00078 virtual const wxColour * GetObjectTextColour() const {
00079 return wxRED;
00080 }
00081 };
00082
00083 public:
00088 ObjectFixed(const Config & config): Object(config) {}
00089
00093 virtual ~ObjectFixed() {}
00094
00099 virtual void Collision(Object * collisionObject) {}
00100
00107 virtual Object::Config * CreateObjectConfig() const;
00108
00118 virtual void LoadFromConfig(const Object::Config & config, bool fullLoad = true);
00119
00126 virtual void SetAction(const Action & newAction) {
00127 if (newAction.GetAction() != Object::Action::WAIT) {
00128 THROW(ExceptionObjectBadAction, "Fixed object can not change its action.");
00129 }
00130 }
00131
00137 virtual void SetDirection(const Direction & newDirection) {
00138 direction.SetDirection(newDirection.GetDirection());
00139 }
00140
00144 virtual const Priority & GetPriority() const {
00145 return ObjectFixed::PRIORITY;
00146 }
00147
00152 virtual bool CanAppearMoreThenOnce() const {
00153 return ObjectFixed::CAN_APPEAR_MORE_THEN_ONCE;
00154 }
00155
00160 virtual const string & GetClassName() const {
00161 return ObjectFixed::CLASS_NAME;
00162 }
00163
00167 virtual void ChooseNextAction() {}
00168
00173 virtual bool IsImaginary() const {
00174 return false;
00175 }
00176
00180 virtual bool IsEditableByUser() const {
00181 return true;
00182 }
00183
00187 virtual bool IsMoveableByUser() const {
00188 return true;
00189 }
00190
00191 public:
00193 static const string CLASS_NAME;
00194
00195 private:
00197 static const Object::Priority PRIORITY;
00199 static const bool CAN_APPEAR_MORE_THEN_ONCE;
00200 };
00201
00202 #endif
00203
00204