1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This source file has been modified by the following contributors:
5 // Copyright (C) 2020 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
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"
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
;
41 NLLIGO::CLigoConfig LigoConfig
;
43 static TUnifiedCallbackItem CallbackArray
[] =
48 extern string OutputPath
;
49 extern vector
<string
> PacsPrimPath
;
50 extern vector
<string
> LookupPath
;
51 extern vector
<string
> LookupNoRecursePath
;
54 /*-----------------------------------------------------------------*\
56 \*-----------------------------------------------------------------*/
58 class CAIDataService
: public NLNET::IService
66 // callback for the tick service 'tick' message
70 /*-----------------------------------------------------------------*\
71 SERVICE INIT & RELEASE
72 \*-----------------------------------------------------------------*/
76 void CAIDataService::init (void)
78 setVersion (RYZOM_VERSION
);
80 // this is the init for the ligo pri;itive parser lib
83 // setup the update systems
84 setUpdateTimeout(200);
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");
94 AI_SHARE::init(&LigoConfig
);
100 CConfigFile
&cf
= ConfigFile
;
101 CConfigFile::CVar
*var
;
103 var
= cf
.getVarPtr("Paths");
107 for (i
=0; (sint
)i
<var
->size(); ++i
)
108 LookupPath
.push_back(var
->asString(i
));
111 var
= cf
.getVarPtr("NoRecursePaths");
115 for (i
=0; (sint
)i
<var
->size(); ++i
)
116 LookupNoRecursePath
.push_back(var
->asString(i
));
119 var
= cf
.getVarPtr("PacsPrimPaths");
123 for (i
=0; (sint
)i
<var
->size(); ++i
)
124 PacsPrimPath
.push_back(var
->asString(i
));
127 var
= cf
.getVarPtr("OutputPath");
130 OutputPath
= CPath::standardizePath(var
->asString());
137 void CAIDataService::release (void)
139 // release sub systems
140 CMessages::release();
144 /*-----------------------------------------------------------------*\
146 \*-----------------------------------------------------------------*/
148 ///update called every coplete cycle of service loop
150 bool CAIDataService::update (void)
152 CAIService::update();
156 /*-----------------------------------------------------------------*\
158 \*-----------------------------------------------------------------*/
159 NLNET_SERVICE_MAIN (CAIDataService
, "AIDS", "ai_data_service", 0, CallbackArray
, "", "")