1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010-2019 Winch Gate Property Limited
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef CL_CONTINENT_MANAGER_H
20 #define CL_CONTINENT_MANAGER_H
27 #include "nel/misc/types_nl.h"
33 #include "continent.h"
35 #include "client_sheets/world_sheet.h"
45 class IProgressCallback
;
57 * Class to manage all continents.
58 * \author Guillaume PUZIN (GUIGUI)
59 * \author Nevrax France
61 * \warning When you modify this class be sure _Current is always valid.
63 class CContinentManager
69 /// preload continent sheets
72 /// Load & setup all continent.
79 * Select continent from a name.
80 * \param const string &name : name of the continent to select.
82 void select(const std::string
&name
, const NLMISC::CVectorD
&pos
, NLMISC::IProgressCallback
&progress
);
83 /// Select closest continent from a vector.
84 void select(const NLMISC::CVectorD
&pos
, NLMISC::IProgressCallback
&progress
);
86 /** Test whether the next call to updateStreamable will be blocking.
87 * This happen for example when the player is too near of a village and when asynchronous loading is not sufficient.
88 * \param pos player position
90 bool isLoadingforced(const NLMISC::CVector
&playerPos
) const;
92 /** Given the position of the player, load / unload objects, asynchronously when possible (these are village for now)
94 void updateStreamable(const NLMISC::CVector
&playerPos
);
95 /** Given the position of the player, load / unload objects, but always in a synchronous fashion.
97 void forceUpdateStreamable(const NLMISC::CVector
&playerPos
, NLMISC::IProgressCallback
&progress
);
99 void removeVillages();
102 void getFogState(TFogType fogType
, float dayNight
, float duskRatio
, CLightCycleManager::TLightState lightState
, const NLMISC::CVectorD
&pos
, CFogState
&result
);
104 // Return a pointer on the current continent.
105 CContinent
*cur() {return _Current
;}
107 // Return a pointer on the desired continent
108 CContinent
*get(const std::string
&contName
);
110 const std::string
&getCurrentContinentSelectName();
112 // load / save all user landmarks in xml format
113 void writeTo(xmlNodePtr node
) const;
114 void readFrom(xmlNodePtr node
);
116 // load / saves all user landMarks
117 // \return number of landmarks loaded or saved
118 uint32
serialUserLandMarks(NLMISC::IStream
&f
);
120 // rebuild visible landmarks on current map
121 void updateUserLandMarks();
123 // load / saves all fow maps
124 void serialFOWMaps();
126 void reloadWeather();
130 std::string
getRegionNameByAlias(uint32 i
);
134 void loadContinentLandMarks();
135 void readLMConts(const std::string
&dataPath
);
139 typedef std::map
<std::string
, CContinent
*> TContinents
;
141 /// Map with all continents.
142 TContinents _Continents
;
144 /// Current continent selected.
145 CContinent
*_Current
;
146 CContinent
*_Hibernated
;
148 /// Map to find region name by alias
149 std::map
<uint32
, std::string
> aliasToRegionMap
;
153 std::vector
<CContLandMark
> WorldMap
;
158 #endif // CL_CONTINENT_MANAGER_H
160 /* End of continent_manager.h */