Eris
1.3.21
|
00001 // 00002 // C++ Interface: TerrainModObserver 00003 // 00004 // Description: The purpose of this class is to handle the bulk of the work 00005 // involved with using Mercator::TerrainMods. It handles parsing 00006 // the Atlas data and storing all the information needed by 00007 // TerrainGenerator to add and remove them from the Terrain. 00008 // 00009 // TerrainGenerator listens for changes in the modifier and 00010 // updates or removes the modifiers from the terrain as needed. 00011 // 00012 // 00013 // Author: Tamas Bates <rhymer@gmail.com>, (C) 2008 00014 // Author: Erik Hjortsberg <erik.hjortsberg@iteam.se>, (C) 2008 00015 // 00016 // This program is free software; you can redistribute it and/or modify 00017 // it under the terms of the GNU General Public License as published by 00018 // the Free Software Foundation; either version 2 of the License, or 00019 // (at your option) any later version. 00020 // 00021 // This program is distributed in the hope that it will be useful, 00022 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00023 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00024 // GNU General Public License for more details. 00025 // 00026 // You should have received a copy of the GNU General Public License 00027 // along with this program; if not, write to the Free Software 00028 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.// 00029 // 00030 #ifndef ERIS_TERRAINMODOBSERVER_H 00031 #define ERIS_TERRAINMODOBSERVER_H 00032 00033 #include <sigc++/signal.h> 00034 #include <Eris/Entity.h> 00035 00036 namespace Mercator { 00037 class TerrainMod; 00038 } 00039 00040 namespace Eris { 00041 00042 class TerrainModTranslator; 00043 00052 class TerrainModObserver 00053 { 00054 public: 00059 TerrainModObserver(Entity* entity); 00060 00064 virtual ~TerrainModObserver(); 00065 00071 virtual bool init(bool alwaysObserve = false); 00072 00077 Mercator::TerrainMod* getMod() const; 00078 00079 00084 sigc::signal<void> ModChanged; 00085 00090 sigc::signal<void> ModDeleted; 00091 00096 Entity* getEntity() const; 00097 00098 protected: 00099 00103 Entity* mEntity; 00104 00108 Entity::AttrChangedSlot mAttrChangedSlot; 00109 00110 00114 virtual void onModChanged(); 00115 00119 virtual void onModDeleted(); 00120 00125 void attributeChanged(const Atlas::Message::Element& attributeValue); 00126 00130 void entity_Moved(); 00131 00136 void entity_Deleted(); 00137 00142 virtual void observeEntity(); 00143 00149 virtual bool parseMod(); 00150 00155 virtual void reparseMod(); 00156 00157 00162 TerrainModTranslator* mInnerMod; 00163 }; 00164 00165 } 00166 00167 #endif