New lua versions
[ryzomcore.git] / ryzom / server / src / ai_service / world_container.cpp
blob19d9f7f8751ca0ac7bc963a93e7c58abd0d031ed
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 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 #include "stdpch.h"
20 #include "world_container.h"
22 #include "nel/misc/path.h"
23 #include "nel/misc/file.h"
24 // #include "nel/misc/hierarchical_timer.h"
25 #include "server_share/msg_ai_service.h"
28 using namespace std;
29 using namespace NLMISC;
30 using namespace RYAI_MAP_CRUNCH;
32 RYAI_MAP_CRUNCH::CWorldMap CWorldContainer::_WorldMaps/*[3]*/;
34 std::vector<std::string> CWorldContainer::_ContinentNames;
36 extern bool EGSHasMirrorReady;
39 * Constructor
41 CWorldContainer::CWorldContainer()
43 clear();
48 * Clear
50 void CWorldContainer::clear()
52 _WorldMaps.clear();
57 * Load Continent
59 void CWorldContainer::loadContinent(const string &name)
61 nlinfo("Loading continent '%s' in WorldContainer", name.c_str());
63 if (find(_ContinentNames.begin(), _ContinentNames.end(), name) != _ContinentNames.end())
65 nldebug("CWorldContainer::loadContinent : continent '%s' is already loaded, ignoring repeat load request", name.c_str());
66 return;
69 try
71 CIFile f0(CPath::lookup(name+"_0.cwmap2"));
73 _WorldMaps.serial(f0);
75 _ContinentNames.push_back(name);
77 if (EGSHasMirrorReady)
79 // if EGS is up, send the new list of available continent
80 CReportAICollisionAvailableMsg msg;
81 msg.ContinentsCollision = _ContinentNames;
82 msg.send("EGS");
85 catch (const Exception &e)
87 nlwarning("Unable to load continent '%s', aborted (%s)", name.c_str(), e.what());