Resolve "Toggle Free Look with Hotkey"
[ryzomcore.git] / ryzom / client / src / continent_manager.h
blob4e6d0774cba3907ca266c68276445929db17e723
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010-2019 Winch Gate Property Limited
3 //
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.
8 //
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
23 /////////////
24 // INCLUDE //
25 /////////////
26 // Misc
27 #include "nel/misc/types_nl.h"
28 // std.
29 #include <vector>
30 #include <map>
31 #include <string>
32 // client
33 #include "continent.h"
34 // client sheets
35 #include "client_sheets/world_sheet.h"
37 ///////////
38 // CLASS //
39 ///////////
41 namespace NLMISC
43 class CVectorD;
44 class CVector;
45 class IProgressCallback;
48 namespace NLGEORGES
50 class UFormElm;
53 class CContinent;
54 struct CFogState;
56 /**
57 * Class to manage all continents.
58 * \author Guillaume PUZIN (GUIGUI)
59 * \author Nevrax France
60 * \date 2001
61 * \warning When you modify this class be sure _Current is always valid.
63 class CContinentManager
65 public:
66 /// Constructor
67 CContinentManager();
69 /// preload continent sheets
70 void preloadSheets();
72 /// Load & setup all continent.
73 void load();
75 // reset all datas
76 void reset();
78 /**
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();
101 // get fog
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();
128 void reloadSky();
130 std::string getRegionNameByAlias(uint32 i);
132 protected:
134 void loadContinentLandMarks();
135 void readLMConts(const std::string &dataPath);
137 protected:
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;
151 public:
152 // World Map Info
153 std::vector<CContLandMark> WorldMap;
158 #endif // CL_CONTINENT_MANAGER_H
160 /* End of continent_manager.h */