# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

zone_manager.h

Go to the documentation of this file.
00001 
00007 /* Copyright, 2000 Nevrax Ltd.
00008  *
00009  * This file is part of NEVRAX D.T.C. SYSTEM.
00010  * NEVRAX D.T.C. SYSTEM is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2, or (at your option)
00013  * any later version.
00014 
00015  * NEVRAX D.T.C. SYSTEM is distributed in the hope that it will be useful, but
00016  * WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00018  * General Public License for more details.
00019 
00020  * You should have received a copy of the GNU General Public License
00021  * along with NEVRAX D.T.C. SYSTEM; see the file COPYING. If not, write to the
00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00023  * MA 02111-1307, USA.
00024  */
00025 
00026 #ifndef NL_ZONE_MANAGER_H
00027 #define NL_ZONE_MANAGER_H
00028 
00029 #include <string>
00030 #include <map>
00031 #include "nel/misc/types_nl.h"
00032 #include "3d/zone.h"
00033 //#include "nel/misc/task_manager.h"
00034 
00035 #include "3d/async_file_manager_3d.h"
00036 #include "3d/zone_search.h"
00037 
00038 
00039 namespace NL3D
00040 {
00041 
00042 
00043 typedef volatile        CZone   *TVolatileZonePtr;
00044 
00045 
00053 class CZoneManager : public CZoneSearch
00054 {
00055 
00056 public:
00057 
00061         struct SZoneManagerWork
00062         {
00063                 // Set to true when zone is removed
00064                 bool    ZoneRemoved;
00065                 // Id of zone to remove
00066                 uint16  IdZoneToRemove;
00067                 // Name of the Zone for remove to landscape
00068                 std::string     NameZoneRemoved;
00069 
00070                 // Set to true when zone is added
00071                 bool            ZoneAdded;
00072                 // Zone for add to landscape
00073                 CZone           *Zone;
00074                 // Name of the Zone for add to landscape
00075                 std::string     NameZoneAdded;
00076         };
00077 
00078 public:
00079 
00081         CZoneManager();
00082 
00084         ~CZoneManager();
00085 
00088         void checkZonesAround (uint x, uint y, uint area);
00089 
00091         bool isWorking () { return _WorkInProgress; }
00092 
00094         bool isWorkComplete (SZoneManagerWork &rWork);
00095 
00100 
00101         inline void setZonePath (std::string zonePath) { _zonePath = zonePath; }
00102 
00104         inline std::string getZonePath (void) { return _zonePath; }
00105 
00106 private:
00107 
00109         std::string _zonePath;
00110 
00111         bool _WorkInProgress;
00112 
00113         std::vector<uint16> _LoadedZones;
00114 
00115         std::vector<uint16> _ZoneList; // Zone set at a given position
00116         uint32 _LastX, _LastY;
00117 
00119         bool _AddingZone;
00120         uint16 _ZoneToAddId;
00121         std::string _ZoneToAddName;
00122         // Loading Task - Inter-Thread values
00123         TVolatileZonePtr        _Zone;
00124 
00125         // Removing Task
00126         bool _RemovingZone;
00127         uint16 _IdZoneToRemove;
00128 };
00129 
00130 
00138 class CZoneLoadingTask : public NLMISC::IRunnable
00139 {
00140 public:
00142         CZoneLoadingTask (const std::string &sZoneName, TVolatileZonePtr *ppZone);
00143 
00145         void run (void);
00146 
00147 private:
00148 
00149         TVolatileZonePtr        *_Zone;
00150         std::string _ZoneName;
00151 };
00152 
00153 
00154 } // NL3D
00155 
00156 
00157 #endif // NL_ZONE_MANAGER_H
00158 
00159 /* End of zone_manager.h */