Resolve "Toggle Free Look with Hotkey"
[ryzomcore.git] / ryzom / server / src / ai_data_service / service_main.cpp
blobe0ec2a8e8613e730c531528ac04a3c952c308ca0
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This source file has been modified by the following contributors:
5 // Copyright (C) 2020 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
6 //
7 // This program is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU Affero General Public License as
9 // published by the Free Software Foundation, either version 3 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU Affero General Public License for more details.
17 // You should have received a copy of the GNU Affero General Public License
18 // along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #include "nel/misc/types_nl.h"
23 #include "nel/net/service.h"
24 #include "nel/misc/path.h"
25 #include "nel/ligo/primitive.h"
26 #include "nel/ligo/ligo_config.h"
27 #include "game_share/ryzom_version.h"
28 #include "ai_share/ai_share.h"
30 #include "ai_files.h"
31 #include "ai_manager.h"
32 #include "ai_service.h"
33 #include "aids_actions.h"
34 #include "messages.h" // singleton manager for transport class messages
36 using namespace NLMISC;
37 using namespace NLNET;
38 using namespace std;
40 // The ligo config
41 NLLIGO::CLigoConfig LigoConfig;
43 static TUnifiedCallbackItem CallbackArray[] =
45 { "QWERTY", 0, },
48 extern string OutputPath;
49 extern vector<string> PacsPrimPath;
50 extern vector<string> LookupPath;
51 extern vector<string> LookupNoRecursePath;
54 /*-----------------------------------------------------------------*\
55 SERVICE CLASS
56 \*-----------------------------------------------------------------*/
58 class CAIDataService : public NLNET::IService
60 public:
61 void init();
62 bool update();
63 void release();
66 // callback for the tick service 'tick' message
67 static void cbTick();
70 /*-----------------------------------------------------------------*\
71 SERVICE INIT & RELEASE
72 \*-----------------------------------------------------------------*/
74 ///init
76 void CAIDataService::init (void)
78 setVersion (RYZOM_VERSION);
80 // this is the init for the ligo pri;itive parser lib
81 NLLIGO::Register ();
83 // setup the update systems
84 setUpdateTimeout(200);
86 // Init ligo
87 if (!LigoConfig.readPrimitiveClass ("world_editor_classes.xml", false))
89 // Should be in R:\leveldesign\world_edit_files
90 nlerror ("Can't load ligo primitive config file world_editor_classes.xml");
93 // init sub systems
94 AI_SHARE::init(&LigoConfig);
95 CMessages::init();
96 CAIDSActions::init();
100 CConfigFile &cf = ConfigFile;
101 CConfigFile::CVar *var;
103 var = cf.getVarPtr("Paths");
104 if (var != NULL)
106 uint i;
107 for (i=0; (sint)i<var->size(); ++i)
108 LookupPath.push_back(var->asString(i));
111 var = cf.getVarPtr("NoRecursePaths");
112 if (var != NULL)
114 uint i;
115 for (i=0; (sint)i<var->size(); ++i)
116 LookupNoRecursePath.push_back(var->asString(i));
119 var = cf.getVarPtr("PacsPrimPaths");
120 if (var != NULL)
122 uint i;
123 for (i=0; (sint)i<var->size(); ++i)
124 PacsPrimPath.push_back(var->asString(i));
127 var = cf.getVarPtr("OutputPath");
128 if (var != NULL)
130 OutputPath = CPath::standardizePath(var->asString());
135 ///release
137 void CAIDataService::release (void)
139 // release sub systems
140 CMessages::release();
144 /*-----------------------------------------------------------------*\
145 SERVICE UPDATES
146 \*-----------------------------------------------------------------*/
148 ///update called every coplete cycle of service loop
150 bool CAIDataService::update (void)
152 CAIService::update();
153 return true;
156 /*-----------------------------------------------------------------*\
157 NLNET_SERVICE_MAIN
158 \*-----------------------------------------------------------------*/
159 NLNET_SERVICE_MAIN (CAIDataService, "AIDS", "ai_data_service", 0, CallbackArray, "", "")