AreaManager.hpp

Go to the documentation of this file.
00001 /*
00002 SagaEngine library
00003 Copyright (c) 2002-2006 Skalden Studio AS
00004 
00005 This software is provided 'as-is', without any express or implied 
00006 warranty. In no event will the authors be held liable for any 
00007 damages arising from the use of this software.
00008 
00009 Permission is granted to distribute the library under the terms of the 
00010 Q Public License version 1.0. Be sure to read and understand the license
00011 before using the library. It should be included here, or you may read it
00012 at http://www.trolltech.com/products/qt/licenses/licensing/qpl
00013 
00014 The original version of this library can be located at:
00015 http://www.sagaengine.com/
00016 
00017 Rune Myrland
00018 rune@skalden.com
00019 */
00020 
00021 
00022 #ifndef sim_area_AreaManager_hpp
00023 #define sim_area_AreaManager_hpp
00024 
00025 #include "sim_area.hpp"
00026 #include "util/type/util_type.hpp"
00027 #include "comp/Composite.hpp"
00028 
00029 namespace se_core {
00030     class _SeCoreExport AreaManager {
00031     public:
00032         AreaManager();
00033         ~AreaManager();
00034         void addArea(Area* area);
00035         bool hasArea(const char* name);
00036         Area* area(const char* name);
00037         int areasByFactory(const char* name, Area** dest, int maxCount);
00038         Area* areaById(Composite::id_type id);
00039         int activeCount() { return activeCount_; }
00040         Area* active(int index);
00041         void resetThings();
00042         void resetAll();
00043         void dump();
00044         void resetActive();
00045         void setActive(Area* area);
00046         void setActive(Area* area, int pages);
00047         void setInactive(Area* area);   
00048         void setInactive();
00049         int areaCount() { return areaCount_; }
00050         Area* area(int index) { return areas_[index]; }
00051 
00052         void addFactory(const AreaFactory* factory);
00053         Area* createArea(const char* areaName, const char* factoryName, int pageX = 0, int pageY = 0, int pageZ = 0, int gridId = -1);
00054         void integrity();
00055 
00056         int maxWidth() { return maxWidth_; }
00057         int maxHeight() { return maxHeight_; }
00058 
00059     private:
00060         void _setActive(Area* area, int pages);
00061         const AreaFactory* factory(const char* name) const;
00062 
00063         static const int MAX_ELEMENTS = 1024 * 16;
00064         static const int MAX_FACTORIES = 512;
00065         friend class PhysicsManager;
00066         static const int MAX_ACTIVE = 3 * (7 * 7 * 7);
00067 
00068         int areaCount_;
00069         int factoryCount_;
00070         int activeCount_;
00071 
00072         const AreaFactory** factories_;
00073         Area** areas_;
00074         Area** active_;
00075         bool* shouldKeep_;
00076 
00077         coor_tile_t maxWidth_, maxHeight_;
00078     };
00079 
00080 }
00081 
00082 #endif

Home Page | SagaEngine trunk (updated nightly) reference generated Sun Dec 2 20:06:11 2007 by Doxygen version 1.3.9.1.

SourceForge.net Logo