Changed: remove server src and cfg for Atys live branch (useless since we use another repo)
--HG-- branch : atyshg/ark Live-746
parent
2c6bfe7d54
commit
9fc1987631
@ -1,149 +0,0 @@
|
|||||||
// Use with commandline: ryzom_admin_service -A. -C. -L. --nobreak --fulladminname=admin_executor_service --shortadminname=AES
|
|
||||||
|
|
||||||
#include "admin_executor_service_default.cfg"
|
|
||||||
|
|
||||||
// ---- config local variables
|
|
||||||
|
|
||||||
// Address of the admin service (default port is 49996)
|
|
||||||
ASHost = "localhost";
|
|
||||||
ASPort="46701";
|
|
||||||
|
|
||||||
// ---- service NeL variables (used by ConfigFile class)
|
|
||||||
|
|
||||||
AESAliasName= "aes_open";
|
|
||||||
|
|
||||||
StartCommands=
|
|
||||||
{
|
|
||||||
// Create a gateway module
|
|
||||||
"moduleManager.createModule StandardGateway gw",
|
|
||||||
// add a layer 5 transport
|
|
||||||
"gw.transportAdd L5Transport l5",
|
|
||||||
// open the transport
|
|
||||||
"gw.transportCmd l5(open)",
|
|
||||||
|
|
||||||
/// Create default connection with admin executor service
|
|
||||||
// Create a gateway module
|
|
||||||
"moduleManager.createModule StandardGateway gw_aes",
|
|
||||||
// create the admin executor service module
|
|
||||||
"moduleManager.createModule AdminExecutorServiceClient aes_client",
|
|
||||||
"aes_client.plug gw_aes",
|
|
||||||
|
|
||||||
// create a layer 3 client to connect to aes gateway
|
|
||||||
"gw_aes.transportAdd L3Client aes_l3c",
|
|
||||||
"gw_aes.transportCmd aes_l3c(connect addr="+AESHost+":"+AESPort+")",
|
|
||||||
|
|
||||||
// create the admin executor service module
|
|
||||||
"moduleManager.createModule AdminExecutorService aes",
|
|
||||||
|
|
||||||
// create a gateway to connect to as
|
|
||||||
"moduleManager.createModule StandardGateway asc_gw",
|
|
||||||
// create a layer 3 client
|
|
||||||
"asc_gw.transportAdd L3Client l3c",
|
|
||||||
"asc_gw.transportCmd l3c(connect addr="+ASHost+":"+ASPort+")",
|
|
||||||
|
|
||||||
// create a gateway for services to connect
|
|
||||||
"moduleManager.createModule StandardGateway aes_gw",
|
|
||||||
// create a layer 3 server
|
|
||||||
"aes_gw.transportAdd L3Server l3s",
|
|
||||||
"aes_gw.transportOptions l3s(PeerInvisible)",
|
|
||||||
"aes_gw.transportCmd l3s(open port="+AESPort+")",
|
|
||||||
|
|
||||||
// plug the as
|
|
||||||
"aes.plug asc_gw",
|
|
||||||
"aes.plug aes_gw",
|
|
||||||
};
|
|
||||||
|
|
||||||
StartCommands +=
|
|
||||||
{
|
|
||||||
"aes.addRegisteredService bms_master open",
|
|
||||||
// "aes.addRegisteredService bms_pd_master open",
|
|
||||||
"aes.addRegisteredService egs open",
|
|
||||||
"aes.addRegisteredService gpms open",
|
|
||||||
"aes.addRegisteredService ios open",
|
|
||||||
"aes.addRegisteredService rns open",
|
|
||||||
"aes.addRegisteredService rws open",
|
|
||||||
"aes.addRegisteredService ts open",
|
|
||||||
"aes.addRegisteredService ms open",
|
|
||||||
"aes.addRegisteredService ais_newbyland open",
|
|
||||||
"aes.addRegisteredService mfs open",
|
|
||||||
"aes.addRegisteredService su open",
|
|
||||||
"aes.addRegisteredService fes open",
|
|
||||||
"aes.addRegisteredService sbs open",
|
|
||||||
"aes.addRegisteredService lgs open",
|
|
||||||
// "aes.addRegisteredService mos open",
|
|
||||||
// "aes.addRegisteredService pdss open",
|
|
||||||
"aes.addRegisteredService ras open",
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
bms_master = { "./", "/home/nevrax/dev/live/service_backup_service/backup_service", "-C. -L. --nobreak --writepid -P49990" };
|
|
||||||
bms_pd_master = { "./", "/home/nevrax/dev/live/service_backup_service/backup_service", "-C. -L. --nobreak --writepid -P49992" };
|
|
||||||
egs = { "./", "/home/nevrax/dev/live/service_entities_game_service/entities_game_service", "-C. -L. --nobreak --writepid" };
|
|
||||||
gpms = { "/home/nevrax/dev/gpms", "/home/nevrax/dev/live/service_gpm_service/gpm_service", "-C. -L. --nobreak --writepid" };
|
|
||||||
ios = { "/home/nevrax/dev/ios", "/home/nevrax/dev/live/service_input_output_service/input_output_service", "-C. -L. --nobreak --writepid" };
|
|
||||||
rns = { "/home/nevrax/dev/rns", "/home/nevrax/dev/live/service_ryzom_naming_service/ryzom_naming_service", "-C. -L. --nobreak --writepid" };
|
|
||||||
rws = { "/home/nevrax/dev/rws", "/home/nevrax/dev/live/service_ryzom_welcome_service/ryzom_welcome_service", "-C. -L. --nobreak --writepid" };
|
|
||||||
ts = { "/home/nevrax/dev/ts", "/home/nevrax/dev/live/service_tick_service/tick_service", "-C. -L. --nobreak --writepid" };
|
|
||||||
ms = { "/home/nevrax/dev/ms", "/home/nevrax/dev/live/service_mirror_service/mirror_service", "-C. -L. --nobreak --writepid" };
|
|
||||||
ais_newbyland = { "/home/nevrax/dev/ais_newbyland", "/home/nevrax/dev/live/service_ai_service/ai_service", "-C. -L. --nobreak --writepid -mCommon:Newbieland:Post" };
|
|
||||||
mfs = { "/home/nevrax/dev/mfs", "/home/nevrax/dev/live/service_mail_forum_service/mail_forum_service", "-C. -L. --nobreak --writepid" };
|
|
||||||
su = { "/home/nevrax/dev/su", "/home/nevrax/dev/live/service_shard_unifier_service/shard_unifier_service", "-C. -L. --nobreak --writepid" };
|
|
||||||
fes = { "/home/nevrax/dev/fes", "/home/nevrax/dev/live/service_frontend_service/frontend_service", "-C. -L. --nobreak --writepid" };
|
|
||||||
sbs = { "/home/nevrax/dev/sbs", "/home/nevrax/dev/live/service_session_browser_server/session_browser_server", "-C. -L. --nobreak --writepid" };
|
|
||||||
lgs = { "/home/nevrax/dev/lgs", "/home/nevrax/dev/live/service_logger_service/logger_service", "-C. -L. --nobreak --writepid" };
|
|
||||||
mos = { "/home/nevrax/dev/mos", "/home/nevrax/dev/live/service_monitor_service/monitor_service", "-C. -L. --nobreak --writepid" };
|
|
||||||
pdss = { "/home/nevrax/dev/pdss", "/home/nevrax/dev/live/service_pd_support_service/pd_support_service", "-C. -L. --nobreak --writepid" };
|
|
||||||
ras = { "./", "src/ryzom_admin_service/ryzom_admin_service", "--fulladminname=admin_service --shortadminname=AS -C. -L. --nobreak --writepid" };
|
|
||||||
|
|
||||||
RegisteredServices=
|
|
||||||
{
|
|
||||||
"bms_master",
|
|
||||||
"bms_pd_master",
|
|
||||||
"egs",
|
|
||||||
"gpms",
|
|
||||||
"ios",
|
|
||||||
"rns",
|
|
||||||
"rws",
|
|
||||||
"ts",
|
|
||||||
"ms",
|
|
||||||
"ais_newbyland",
|
|
||||||
"mfs",
|
|
||||||
"su",
|
|
||||||
"fes",
|
|
||||||
"sbs",
|
|
||||||
"lgs",
|
|
||||||
"mos",
|
|
||||||
"pdss",
|
|
||||||
"ras",
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
DontUseStdIn = 0;
|
|
||||||
|
|
||||||
// ---- service NeL variables (used by CVariable class)
|
|
||||||
|
|
||||||
// If the update loop is too slow, a thread will produce an assertion.
|
|
||||||
// By default, the value is set to 10 minutes.
|
|
||||||
// Set to 0 for no assertion.
|
|
||||||
UpdateAssertionThreadTimeout = 0;
|
|
||||||
|
|
||||||
// ---- service custom variables (used by ConfigFile class)
|
|
||||||
|
|
||||||
// ---- service custom variables (used by CVariable class)
|
|
||||||
|
|
||||||
// in second, -1 for not restarting
|
|
||||||
RestartDelay = 60;
|
|
||||||
|
|
||||||
// how many second before aborting the request if not finished
|
|
||||||
RequestTimeout = 5;
|
|
||||||
|
|
||||||
// log path for advanced log report
|
|
||||||
LogPath = "/.";
|
|
||||||
|
|
||||||
// setup for deployment environment with exeternal configuration system responsible for launching apps and
|
|
||||||
// for configuring AES services
|
|
||||||
DontLaunchServicesDirectly = 1;
|
|
||||||
UseExplicitAESRegistration = 1;
|
|
||||||
KillServicesOnDisconnect = 1;
|
|
||||||
|
|
||||||
ShardName="dev";
|
|
@ -1,7 +0,0 @@
|
|||||||
#include "common.cfg"
|
|
||||||
|
|
||||||
// I'm the AES, I'll not connect to myself!
|
|
||||||
DontUseAES = 1;
|
|
||||||
|
|
||||||
// I don't need a connection to a naming service
|
|
||||||
DontUseNS = 1;
|
|
@ -1,22 +0,0 @@
|
|||||||
// Use with commandline: ryzom_admin_service --fulladminname=ryzom_admin_service --shortadminname=AS -C. -L. --nobreak --writepid
|
|
||||||
|
|
||||||
// ---- config local variables
|
|
||||||
|
|
||||||
ASWebPort="46700";
|
|
||||||
ASPort="46701";
|
|
||||||
|
|
||||||
#include "admin_service_default.cfg"
|
|
||||||
|
|
||||||
// ---- service NeL variables (used by ConfigFile class)
|
|
||||||
|
|
||||||
AESAliasName= "ras";
|
|
||||||
|
|
||||||
Paths = {
|
|
||||||
".",
|
|
||||||
};
|
|
||||||
|
|
||||||
// ---- service NeL variables (used by CVariable class)
|
|
||||||
|
|
||||||
// ---- service custom variables (used by ConfigFile class)
|
|
||||||
|
|
||||||
// ---- service custom variables (used by CVariable class)
|
|
@ -1,27 +0,0 @@
|
|||||||
#include "common.cfg"
|
|
||||||
|
|
||||||
DontUseNS = 1;
|
|
||||||
|
|
||||||
RRDToolPath = "rrdtool";
|
|
||||||
RRDVarPath = "save_shard/rrd_graphs";
|
|
||||||
|
|
||||||
// Variables required to be defined by other cfgs
|
|
||||||
//AESHost="localhost";
|
|
||||||
//ASWebPort="46700";
|
|
||||||
//ASPort="46701";
|
|
||||||
|
|
||||||
StartCommands +=
|
|
||||||
{
|
|
||||||
// create the admin service module and open the web interface
|
|
||||||
"moduleManager.createModule AdminService as webPort="+ASWebPort,
|
|
||||||
|
|
||||||
// create a gateway for aes to connect
|
|
||||||
"moduleManager.createModule StandardGateway as_gw",
|
|
||||||
// create a layer 3 server
|
|
||||||
"as_gw.transportAdd L3Server l3s",
|
|
||||||
"as_gw.transportOptions l3s(PeerInvisible)",
|
|
||||||
"as_gw.transportCmd l3s(open port="+ASPort+")",
|
|
||||||
|
|
||||||
// plug the as
|
|
||||||
"as.plug as_gw",
|
|
||||||
};
|
|
@ -1,64 +0,0 @@
|
|||||||
// Use with commandline: ai_service -C. -L. --nobreak --writepid -mCommon:Newbieland:Post
|
|
||||||
|
|
||||||
// ---- config local variables
|
|
||||||
|
|
||||||
SUPort = 50505;
|
|
||||||
SUHost = "localhost";
|
|
||||||
// SU - listen address of the SU service (for L5 connections)
|
|
||||||
SUAddress = SUHost+":"+SUPort;
|
|
||||||
|
|
||||||
#include "ai_service_default.cfg"
|
|
||||||
|
|
||||||
// ---- service NeL variables (used by ConfigFile class)
|
|
||||||
|
|
||||||
AESAliasName= "ais_newbyland";
|
|
||||||
|
|
||||||
GraphVars += { "TickSpeedLoop", "60000" };
|
|
||||||
GraphVars += { "L5CallbackCount", "60000" };
|
|
||||||
GraphVars += { "L5CallbackTime", "60000" };
|
|
||||||
GraphVars += { "MirrorCallbackCount", "60000" };
|
|
||||||
GraphVars += { "MirrorCallbackTime", "60000" };
|
|
||||||
|
|
||||||
Paths = {
|
|
||||||
".",
|
|
||||||
"../common/data_common",
|
|
||||||
"../common/data_leveldesign",
|
|
||||||
};
|
|
||||||
|
|
||||||
// ---- service NeL variables (used by CVariable class)
|
|
||||||
|
|
||||||
// ---- service custom variables (used by ConfigFile class)
|
|
||||||
|
|
||||||
#include "used_continents.cfg"
|
|
||||||
|
|
||||||
// Mirror limits
|
|
||||||
DatasetSizefe_temp = 600000;
|
|
||||||
DatasetSizefame = 26000;
|
|
||||||
|
|
||||||
// define the primitives configuration used. (AIS, EGS)
|
|
||||||
UsedPrimitives =
|
|
||||||
{
|
|
||||||
"newbieland_all",
|
|
||||||
};
|
|
||||||
|
|
||||||
// the following variable must be defined but should be empty - it's presence is used to change the behaviour
|
|
||||||
// of the packed sheet reader
|
|
||||||
GeorgePaths = { "" };
|
|
||||||
|
|
||||||
// ---- service custom variables (used by CVariable class)
|
|
||||||
|
|
||||||
NbPlayersLimit = PlayerLimit;
|
|
||||||
|
|
||||||
// Entity Limits (AIS)
|
|
||||||
NbPetLimit = NbPlayersLimit*4;
|
|
||||||
NbFaunaLimit = 50000;
|
|
||||||
NbNpcLimit = 20000;
|
|
||||||
NbFxLimit = 500;
|
|
||||||
|
|
||||||
#include "backup_service_interface.cfg"
|
|
||||||
|
|
||||||
// Set this shard as a ring (1) or mainland (0) shard (main behavior switch)
|
|
||||||
IsRingShard = 0;
|
|
||||||
|
|
||||||
// Disable ryzom verbose logging
|
|
||||||
VerboseMIRROR = 0;
|
|
@ -1,198 +0,0 @@
|
|||||||
#include "common.cfg"
|
|
||||||
|
|
||||||
// a list of system command that run at server startup.
|
|
||||||
SystemCmd = {};
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
|
||||||
//- Basic (specific) heal profile parameters ---------------------------------
|
|
||||||
// Downtime for normal heal (on other bots of the group)
|
|
||||||
HealSpecificDowntime = 100;
|
|
||||||
// Downtime for self heal
|
|
||||||
HealSpecificDowntimeSelf = 100;
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
// Disable caching of ligo primitive in binary files
|
|
||||||
CachePrims = 0;
|
|
||||||
CachePrimsLog = 0;
|
|
||||||
|
|
||||||
// do not log the corrected position.
|
|
||||||
LogAcceptablePos = 0;
|
|
||||||
// do not log group creation failure
|
|
||||||
LogGroupCreationFailure = 0;
|
|
||||||
// do not log aliad tree owner construstion.
|
|
||||||
LogAliasTreeOwner = 0;
|
|
||||||
// do not log outpost info
|
|
||||||
LogOutpostDebug = 0;
|
|
||||||
// Speed factor, for debug purpose only. Don't set to high speed factor !
|
|
||||||
SpeedFactor = 1;
|
|
||||||
// Speep up the timer triggering. Set a value between 1 (normal) and INT_MAX.
|
|
||||||
TimerSpeedUp = 1;
|
|
||||||
|
|
||||||
// Default timer for wander behavior
|
|
||||||
DefaultWanderMinTimer = 50; // 5s
|
|
||||||
DefaultWanderMaxTimer = 100; // 10s
|
|
||||||
|
|
||||||
// Fame and guard behavior
|
|
||||||
// Fame value under witch the guard attack the player in sigth
|
|
||||||
FameForGuardAttack = -450000;
|
|
||||||
// The minimum of fame for guard to help the player
|
|
||||||
FameForGuardHelp = -200000;
|
|
||||||
|
|
||||||
// The default aggro distance for NPC
|
|
||||||
DefaultNpcAggroDist = 15;
|
|
||||||
// The default escort range for escort behavior
|
|
||||||
DefaultEscortRange = 10;
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Aggro //
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
|
||||||
AggroReturnDistCheck = 15.0;
|
|
||||||
AggroReturnDistCheckFauna = 15.0;
|
|
||||||
AggroReturnDistCheckNpc = 1.5;
|
|
||||||
AggroD1Radius = 250.0;
|
|
||||||
AggroD2Radius = 150.0;
|
|
||||||
AggroPrimaryGroupDist = 0.0;
|
|
||||||
AggroPrimaryGroupCoef = 0.0;
|
|
||||||
AggroSecondaryGroupDist = 0.0;
|
|
||||||
AggroSecondaryGroupCoef = 0.0;
|
|
||||||
AggroPropagationRadius = 60.0;
|
|
||||||
|
|
||||||
BotRepopFx = "";
|
|
||||||
|
|
||||||
// GROUP KEYWORDS
|
|
||||||
// used mainly in event handlers to determine to which groups events apply
|
|
||||||
KeywordsGroupNpc = {
|
|
||||||
|
|
||||||
"patrol", // a group of bots who guard a patrol route or point
|
|
||||||
"convoy", // a group with pack animals who follow roads from place to place
|
|
||||||
"with_players", // a group who may travel with players
|
|
||||||
};
|
|
||||||
|
|
||||||
// BOT KEYWORDS
|
|
||||||
// used mainly in npc_state_profile to determine which ai profiles to assign to which bots
|
|
||||||
KeywordsBotNpc = {
|
|
||||||
|
|
||||||
"team_leader", // a bot who leads the way in front of their team (and acts as leader
|
|
||||||
// in discussion with players)
|
|
||||||
"animal_leader", // a bot who leads pack animals
|
|
||||||
"guard", // a bot who is a guard of some sort (eg karavan guard)
|
|
||||||
"emissary", // eg karavan emissary
|
|
||||||
"preacher", // eg kami preacher
|
|
||||||
"guardian", // typically kami guardians
|
|
||||||
"vip", // someone who has an escort of players or NPCs (assumed to be harmless)
|
|
||||||
};
|
|
||||||
|
|
||||||
// STATE KEYWORDS
|
|
||||||
// used mainly in event handlers to determine to which state events apply
|
|
||||||
// eg: when a player goes link dead if the team that this player is escorting
|
|
||||||
// is in a dangerous area the team may enter a 'protect ourselves and wait for
|
|
||||||
// players' punctual state
|
|
||||||
KeywordsStateNpc = {
|
|
||||||
|
|
||||||
"safe", // eg the gathering point at town entrance
|
|
||||||
"dangerous", // eg a route through the wilds
|
|
||||||
};
|
|
||||||
|
|
||||||
ColourNames =
|
|
||||||
{
|
|
||||||
"red : 0",
|
|
||||||
"beige : 1",
|
|
||||||
"green : 2",
|
|
||||||
"turquoise : 3",
|
|
||||||
"blue : 4",
|
|
||||||
"violet : 5",
|
|
||||||
"white : 6",
|
|
||||||
"black : 7",
|
|
||||||
|
|
||||||
"redHair: 0",
|
|
||||||
"blackHair: 1",
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
StartCommandsWhenMirrorReady = {
|
|
||||||
};
|
|
||||||
|
|
||||||
//---------------------------------------------------------
|
|
||||||
// commands for multi IA configuration
|
|
||||||
// For multi IA config, use the -m command line switch folowed
|
|
||||||
// by a semicolon separated list of command block to run.
|
|
||||||
// ex :
|
|
||||||
// -mCommon:Matis:Post
|
|
||||||
// will execute the folowing command blocks in order :
|
|
||||||
// * StartCommandsWhenMirrorReadyCommon
|
|
||||||
// * StartCommandsWhenMirrorReadyMatis
|
|
||||||
// * StartCommandsWhenMirrorReadyPost
|
|
||||||
//---------------------------------------------------------
|
|
||||||
// common commands before loading continents
|
|
||||||
StartCommandsWhenMirrorReadyCommon =
|
|
||||||
{
|
|
||||||
"RandomPosMaxRetry 6400",
|
|
||||||
"fightRangeRange 4 60",
|
|
||||||
"LogOutpostDebug 1",
|
|
||||||
"grpHistoryRecordLog",
|
|
||||||
|
|
||||||
"verboseAIProfiles",
|
|
||||||
"verboseAliasNodeTreeParserLog",
|
|
||||||
"verboseCombatLog",
|
|
||||||
"verboseFaunaMgrLog",
|
|
||||||
"verboseFaunaParseLog",
|
|
||||||
"verboseNPCBotProfiles",
|
|
||||||
"verboseNPCMgrLog",
|
|
||||||
"verboseNPCParserLog",
|
|
||||||
"verboseNpcDescriptionMsgLog",
|
|
||||||
"verbosePrimitiveParserLog",
|
|
||||||
// "verboseSwitchMultipleChangesOfAProperty",
|
|
||||||
};
|
|
||||||
|
|
||||||
// commands for Newbieland continent
|
|
||||||
StartCommandsWhenMirrorReadyNewbieland =
|
|
||||||
{
|
|
||||||
"loadContinent newbieland",
|
|
||||||
"createStaticAIInstance newbieland",
|
|
||||||
"loadMapsFromCommon newbieland_all",
|
|
||||||
};
|
|
||||||
|
|
||||||
// commands for post continents loading
|
|
||||||
StartCommandsWhenMirrorReadyPost =
|
|
||||||
{
|
|
||||||
"spawnInstances",
|
|
||||||
"updateAI",
|
|
||||||
"updateAI",
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// commands for Ring continents
|
|
||||||
StartCommandsWhenMirrorReadyRing =
|
|
||||||
{
|
|
||||||
"loadContinent r2_desert",
|
|
||||||
"createDynamicAIInstance 10000",
|
|
||||||
"loadPrimitiveFile dummy.primitive",
|
|
||||||
|
|
||||||
"loadContinent r2_forest",
|
|
||||||
"createDynamicAIInstance 10001",
|
|
||||||
"loadPrimitiveFile dummy.primitive",
|
|
||||||
|
|
||||||
"loadContinent r2_lakes",
|
|
||||||
"createDynamicAIInstance 10003",
|
|
||||||
"loadPrimitiveFile dummy.primitive",
|
|
||||||
|
|
||||||
"loadContinent r2_jungle",
|
|
||||||
"createDynamicAIInstance 10002",
|
|
||||||
"loadPrimitiveFile dummy.primitive",
|
|
||||||
|
|
||||||
"loadContinent r2_roots",
|
|
||||||
"createDynamicAIInstance 10004",
|
|
||||||
"loadPrimitiveFile dummy.primitive",
|
|
||||||
|
|
||||||
// "spawnInstances",
|
|
||||||
"updateAI",
|
|
||||||
"updateAI",
|
|
||||||
|
|
||||||
// L5 connect to the shard unifier
|
|
||||||
"unifiedNetwork.addService ShardUnifier ( address="+SUAddress+" sendId external autoRetry )",
|
|
||||||
|
|
||||||
// Create a shard AIS Module
|
|
||||||
"moduleManager.createModule AisControl ais",
|
|
||||||
// Connect AIS
|
|
||||||
"ais.plug gw"
|
|
||||||
};
|
|
@ -1,34 +0,0 @@
|
|||||||
// Use with commandline: backup_service -C. -L. --nobreak --writepid -P49990
|
|
||||||
|
|
||||||
#include "backup_service_default.cfg"
|
|
||||||
|
|
||||||
// ---- config local variables
|
|
||||||
|
|
||||||
// ---- service NeL variables (used by ConfigFile class)
|
|
||||||
|
|
||||||
AESAliasName = "bms_master";
|
|
||||||
|
|
||||||
Paths += {
|
|
||||||
".",
|
|
||||||
"../common/data_leveldesign",
|
|
||||||
};
|
|
||||||
|
|
||||||
// ---- service NeL variables (used by CVariable class)
|
|
||||||
|
|
||||||
// Where to save specific shard data (ie: player backup), relatively to SaveShardRoot
|
|
||||||
SaveFilesDirectory = "";
|
|
||||||
|
|
||||||
// where to save generic shard data (ie: packed_sheet)
|
|
||||||
WriteFilesDirectory = "data_shard";
|
|
||||||
|
|
||||||
// ---- service custom variables (used by ConfigFile class)
|
|
||||||
|
|
||||||
WebPort = 49970;
|
|
||||||
|
|
||||||
// ---- service custom variables (used by CVariable class)
|
|
||||||
|
|
||||||
// BS - Root directory where data are backuped to
|
|
||||||
IncrementalBackupDirectory = "../incremental_backup";
|
|
||||||
|
|
||||||
// Root directory where data from shards are stored into
|
|
||||||
SaveShardRoot = "save_shard/";
|
|
@ -1,32 +0,0 @@
|
|||||||
#include "common.cfg"
|
|
||||||
|
|
||||||
// ---- service NeL variables (used by ConfigFile class)
|
|
||||||
|
|
||||||
DontUseNS = 1;
|
|
||||||
|
|
||||||
// ---- service NeL variables (used by CVariable class)
|
|
||||||
|
|
||||||
ListeningPort = 49990;
|
|
||||||
|
|
||||||
// ---- service custom variables (used by ConfigFile class)
|
|
||||||
|
|
||||||
// Listening port for the Web server to connect in
|
|
||||||
|
|
||||||
WebPort = 49898;
|
|
||||||
|
|
||||||
BSReadState = 1;
|
|
||||||
|
|
||||||
|
|
||||||
// ---- service custom variables (used by CVariable class)
|
|
||||||
|
|
||||||
// Port for the Layer 3 interface of the backup service
|
|
||||||
L3ListeningPort = 49950;
|
|
||||||
|
|
||||||
// template path from SaveShardRoot to find character saves
|
|
||||||
SaveTemplatePath = "$shard/characters/account_$userid_$charid$ext";
|
|
||||||
|
|
||||||
// character saves possible extension list
|
|
||||||
SaveExtList = "_pdr.bin _pdr.xml .bin";
|
|
||||||
|
|
||||||
//BSFilePrefix = "R:/code/ryzom/r2_shard/";
|
|
||||||
//BSFileSubst = "r2_shard/";
|
|
@ -1,5 +0,0 @@
|
|||||||
L3BSPort = "49950";
|
|
||||||
BSHost = "localhost:49990";
|
|
||||||
UseBS = 1;
|
|
||||||
// Root directory where data from shards are stored into
|
|
||||||
SaveShardRoot = "save_shard/";
|
|
@ -1,99 +0,0 @@
|
|||||||
// ---- config local variables
|
|
||||||
|
|
||||||
// Used by ConfigFile in EGS and WS
|
|
||||||
ShardId = 302;
|
|
||||||
|
|
||||||
// Used by CVariable in WS
|
|
||||||
PlayerLimit = 5000;
|
|
||||||
|
|
||||||
// Used to connect to AES (this file) and to set up AES service (admin_executor_service.cfg)
|
|
||||||
AESPort="46702";
|
|
||||||
AESHost="localhost";
|
|
||||||
|
|
||||||
// ---- service NeL variables (used by ConfigFile class)
|
|
||||||
|
|
||||||
WindowStyle = "WIN";
|
|
||||||
|
|
||||||
// don't connect to the old NeLNS AES
|
|
||||||
DontUseAES = 1;
|
|
||||||
|
|
||||||
// Configure module gateway for layer 5 module comm
|
|
||||||
StartCommands +=
|
|
||||||
{
|
|
||||||
// Create a gateway module
|
|
||||||
"moduleManager.createModule StandardGateway gw",
|
|
||||||
// add a layer 5 transport
|
|
||||||
"gw.transportAdd L5Transport l5",
|
|
||||||
// open the transport
|
|
||||||
"gw.transportCmd l5(open)",
|
|
||||||
|
|
||||||
/// Create default connection with admin executor service
|
|
||||||
// Create a gateway module
|
|
||||||
"moduleManager.createModule StandardGateway gw_aes",
|
|
||||||
// create the admin executor service module
|
|
||||||
"moduleManager.createModule AdminExecutorServiceClient aes_client",
|
|
||||||
"aes_client.plug gw_aes",
|
|
||||||
|
|
||||||
// create a layer 3 client to connect to aes gateway
|
|
||||||
"gw_aes.transportAdd L3Client aes_l3c",
|
|
||||||
"gw_aes.transportCmd aes_l3c(connect addr="+AESHost+":"+AESPort+")",
|
|
||||||
};
|
|
||||||
|
|
||||||
NSHost = "localhost";
|
|
||||||
|
|
||||||
// A list of vars to graph for any service
|
|
||||||
GraphVars +=
|
|
||||||
{
|
|
||||||
"ProcessUsedMemory", "60000", // every minute
|
|
||||||
};
|
|
||||||
|
|
||||||
IgnoredFiles = { "continent.cfg", "__read_me.txt", "bandit.html", "flora_primr.primitive" };
|
|
||||||
|
|
||||||
// Set a mainland SessionId.
|
|
||||||
// Live: Must be 0 for ring shards, non-zero (usually ShardId) for mainland shards
|
|
||||||
// Dev: Can be non-zero to initially connect a client to a ring shard
|
|
||||||
NoWSShardId = ShardId;
|
|
||||||
|
|
||||||
// ---- service NeL variables (used by CVariable class)
|
|
||||||
|
|
||||||
// Disable generation / display of nldebug messages
|
|
||||||
DisableNLDebug = 1;
|
|
||||||
|
|
||||||
// Disable nel net verbose logging
|
|
||||||
VerboseNETTC = 0;
|
|
||||||
VerboseLNETL0 = 0;
|
|
||||||
VerboseLNETL1 = 0;
|
|
||||||
VerboseLNETL2 = 0;
|
|
||||||
VerboseLNETL3 = 0;
|
|
||||||
VerboseLNETL4 = 0;
|
|
||||||
VerboseLNETL5 = 0;
|
|
||||||
VerboseLNETL6 = 0;
|
|
||||||
|
|
||||||
// If the update loop is too slow, a thread will produce an assertion.
|
|
||||||
// By default, the value is set to 10 minutes.
|
|
||||||
// Set to 0 for no assertion.
|
|
||||||
UpdateAssertionThreadTimeout = 6000000;
|
|
||||||
|
|
||||||
// how to sleep between 2 network updates
|
|
||||||
// 0 = pipe
|
|
||||||
// 1 = usleep
|
|
||||||
// 2 = nanosleep
|
|
||||||
// 3 = sched_yield
|
|
||||||
// 4 = nothing
|
|
||||||
UseYieldMethod = 0;
|
|
||||||
|
|
||||||
DefaultMaxExpectedBlockSize = 200000000; // 200 M !
|
|
||||||
DefaultMaxSentBlockSize = 200000000; // 200 M !
|
|
||||||
|
|
||||||
// Will SaveFilesDirectory will be converted to a full path?
|
|
||||||
ConvertSaveFilesDirectoryToFullPath = 0;
|
|
||||||
|
|
||||||
// Where to save specific shard data (ie: player backup), relatively to SaveShardRoot
|
|
||||||
SaveFilesDirectory = "";
|
|
||||||
|
|
||||||
// where to save generic shard data (ie: packed_sheet)
|
|
||||||
WriteFilesDirectory = "data_shard";
|
|
||||||
|
|
||||||
// ---- service custom variables (used by ConfigFile class)
|
|
||||||
|
|
||||||
// ---- service custom variables (used by CVariable class)
|
|
@ -1,320 +0,0 @@
|
|||||||
// Auto generated config file
|
|
||||||
// Use with commandline: dynamic_scenario_service -C. -L. --nobreak --writepid
|
|
||||||
AESAliasName= "dss";
|
|
||||||
|
|
||||||
ASWebPort="46700";
|
|
||||||
ASPort="46701";
|
|
||||||
AESPort="46702";
|
|
||||||
SUPort = 50505;
|
|
||||||
SUGlobalPort = 50503;
|
|
||||||
L3BSPort = "49950";
|
|
||||||
L3SlaveBSPort = "49951";
|
|
||||||
L3MasterLGSPort = 49992;
|
|
||||||
LGSBSPort = 49994;
|
|
||||||
L3LGSBSPort = 49995;
|
|
||||||
SUHost = "localhost";
|
|
||||||
MFSHost = "localhost";
|
|
||||||
BSHost = "localhost:49990";
|
|
||||||
SlaveBSHost = "";
|
|
||||||
MasterLGSHost = "localhost";
|
|
||||||
SlaveLGSHost = "localhost";
|
|
||||||
LGSBSHost = "localhost";
|
|
||||||
DBHost = "localhost";
|
|
||||||
#define DONT_USE_LGS_SLAVE
|
|
||||||
// Configure module gateway for layer 5 module comm
|
|
||||||
StartCommands +=
|
|
||||||
{
|
|
||||||
// Create a gateway module
|
|
||||||
"moduleManager.createModule StandardGateway gw",
|
|
||||||
// add a layer 5 transport
|
|
||||||
"gw.transportAdd L5Transport l5",
|
|
||||||
// open the transport
|
|
||||||
"gw.transportCmd l5(open)",
|
|
||||||
|
|
||||||
/// Create default connection with admin executor service
|
|
||||||
// Create a gateway module
|
|
||||||
"moduleManager.createModule StandardGateway gw_aes",
|
|
||||||
// create the admin executor service module
|
|
||||||
"moduleManager.createModule AdminExecutorServiceClient aes_client",
|
|
||||||
"aes_client.plug gw_aes",
|
|
||||||
|
|
||||||
// create a layer 3 client to connect to aes gateway
|
|
||||||
"gw_aes.transportAdd L3Client aes_l3c",
|
|
||||||
"gw_aes.transportCmd aes_l3c(connect addr=localhost:"+AESPort+")",
|
|
||||||
};
|
|
||||||
|
|
||||||
/// A list of vars to graph for any service
|
|
||||||
GraphVars =
|
|
||||||
{
|
|
||||||
"ProcessUsedMemory", "60000", // every minute
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/* Force default value for PDLib directory (e.g. SaveFilesDirectory...)
|
|
||||||
* PLEASE NOTICE THAT THIS LINE MUST BE LEFT TO ""
|
|
||||||
* Only log analyser must have the $shard parameter to find all shards root directory
|
|
||||||
*/
|
|
||||||
PDRootDirectory = "";
|
|
||||||
|
|
||||||
// Log PD updates to log file (1 enabled, 0 disabled), see PDLogSaveDirectory to choose where to log
|
|
||||||
PDEnableLog = 1;
|
|
||||||
|
|
||||||
// Log PD StringManager updates to log file (1 enabled, 0 disabled), see PDLogSaveDirectory to choose where to log
|
|
||||||
PDEnableStringLog = 0;
|
|
||||||
|
|
||||||
// Number of seconds between 2 logs to file
|
|
||||||
PDLogUpdate = 10;
|
|
||||||
|
|
||||||
// MySGL wrapper strict mode - controls use of asserts if SQL requests fail
|
|
||||||
MSWStrictMode=0;
|
|
||||||
|
|
||||||
// This is the mapping for logical continent to physical one
|
|
||||||
ContinentNameTranslator =
|
|
||||||
{
|
|
||||||
"matis_newbie", "matis",
|
|
||||||
"zorai_newbie", "zorai",
|
|
||||||
"terre", "terre_oubliee",
|
|
||||||
"sources", "sources_interdites"
|
|
||||||
};
|
|
||||||
|
|
||||||
NegFiltersDebug = { "ZZZZZZZZZZZ" };
|
|
||||||
NegFiltersInfo = { "ZZZZZZZZZZZ" };
|
|
||||||
NegFiltersWarning = { "ZZZZZZZZZZZ", "Missing log context for log" };
|
|
||||||
//NegFiltersDebug = { "NET", "ADMIN", "MIRROR", "NC", "PATH" };
|
|
||||||
//NegFiltersInfo = { "NET", "ADMIN", "MIRROR", "NC", "CF", "TimerManagerUpdate" };
|
|
||||||
// NegFiltersWarning = { "CT_LRC", "AnimalSpawned" };
|
|
||||||
|
|
||||||
// Block the system in the tick service that provokes stalls when overloaded
|
|
||||||
WaitForBSThreshold=0;
|
|
||||||
|
|
||||||
// Only produce log*.log files and not <service name>*.log
|
|
||||||
DontLog=1;
|
|
||||||
|
|
||||||
IgnoredFiles = { "continent.cfg", "__read_me.txt", "bandit.html", "flora_primr.primitive" };
|
|
||||||
|
|
||||||
// If the update loop is too slow, a thread will produce an assertion.
|
|
||||||
// By default, the value is set to 10 minutes.
|
|
||||||
// Set to 0 for no assertion.
|
|
||||||
UpdateAssertionThreadTimeout = 6000000;
|
|
||||||
|
|
||||||
DefaultMaxExpectedBlockSize = 200000000; // 200 M !
|
|
||||||
DefaultMaxSentBlockSize = 200000000; // 200 M !
|
|
||||||
|
|
||||||
// MS Packet size limit in bytes, PER DATASET (warning: depending on the weights, limits per property may be very small)
|
|
||||||
MaxOutBandwidth = 100000000;
|
|
||||||
|
|
||||||
// how to sleep between 2 network updates
|
|
||||||
// 0 = pipe
|
|
||||||
// 1 = usleep
|
|
||||||
// 2 = nanosleep
|
|
||||||
// 3 = sched_yield
|
|
||||||
// 4 = nothing
|
|
||||||
UseYieldMethod = 0;
|
|
||||||
|
|
||||||
// The privileges needed to access any ring session
|
|
||||||
PrivilegeForSessionAccess = ":DEV:SGM:GM:SG:";
|
|
||||||
|
|
||||||
// The max number of ring points (aka ring access) for each ecosystem
|
|
||||||
MaxRingPoints = "A1:D7:F7:J8:L6:R13";
|
|
||||||
|
|
||||||
// Level limit for newb scenarios
|
|
||||||
FreeTrialSkillLimit=21;
|
|
||||||
|
|
||||||
// Level limit for newb scenarios
|
|
||||||
DefaultInterShardExchangeLevelCap=0;
|
|
||||||
|
|
||||||
// Configureation for DSS
|
|
||||||
MaxNpcs = 300;
|
|
||||||
MaxStaticObjects = 200;
|
|
||||||
|
|
||||||
// the following variable must be defined but should be empty - it's presence is used to change the behaviour
|
|
||||||
// of the packed sheet reader
|
|
||||||
GeorgePaths = { "" };
|
|
||||||
|
|
||||||
// Dissable nel net verbose logging
|
|
||||||
VerboseNETTC = 0;
|
|
||||||
VerboseLNETL0 = 0;
|
|
||||||
VerboseLNETL1 = 0;
|
|
||||||
VerboseLNETL2 = 0;
|
|
||||||
VerboseLNETL3 = 0;
|
|
||||||
VerboseLNETL4 = 0;
|
|
||||||
VerboseLNETL5 = 0;
|
|
||||||
VerboseLNETL6 = 0;
|
|
||||||
|
|
||||||
// Dissable ryzom verbose logging
|
|
||||||
VerboseMIRROR = 0;
|
|
||||||
VerboseRingRPLog = 0;
|
|
||||||
VerboseCDBGroup = 0;
|
|
||||||
|
|
||||||
// What to do with characters coming from another mainland shard?
|
|
||||||
// 0: teleport to the stored session id
|
|
||||||
// 1: let the character play anyway, but leave the stored session id unchanged
|
|
||||||
// 2: assign the stored session id with FixedSessionId and let play
|
|
||||||
AllowCharsFromAllSessions = 0;
|
|
||||||
|
|
||||||
// Use Shard Unifier or not
|
|
||||||
DontUseSU = 0;
|
|
||||||
|
|
||||||
// the domain's set of useful addresses
|
|
||||||
LSHost = SUHost;
|
|
||||||
RSMHost = SUHost;
|
|
||||||
|
|
||||||
// MFS config
|
|
||||||
WebSrvUsersDirectory = "";
|
|
||||||
WebRootDirectory = "/home/nevrax/live/save_shard/www";
|
|
||||||
HoFHDTDirectory = "/local/www/hof/hdt";
|
|
||||||
|
|
||||||
// BS Specifics --------------------------------------------------------------------------
|
|
||||||
// BS - set to 1 if a BS is not part of a naming service group (then BS not disclosed
|
|
||||||
// to other services by the Layer 5, i.e. the services sending requests to BS have
|
|
||||||
// to know its/their address(es) by another mean)
|
|
||||||
BSDontUseNS = 1;
|
|
||||||
// BS - set the host of the naming service where the BS register
|
|
||||||
BSNSHost = "localhost";
|
|
||||||
UseBS = 1;
|
|
||||||
XMLSave = 0;
|
|
||||||
|
|
||||||
// Where to save specific shard data (ie: player backup), relatively to SaveShardRoot
|
|
||||||
SaveFilesDirectory = "";
|
|
||||||
|
|
||||||
// where to save generic shard data (ie: packed_sheet)
|
|
||||||
WriteFilesDirectory = "r2_shard/data_shard";
|
|
||||||
|
|
||||||
// Will SaveFilesDirectory will be converted to a full path?
|
|
||||||
ConvertSaveFilesDirectoryToFullPath = 0;
|
|
||||||
|
|
||||||
// BS - Root directory where data are backuped to
|
|
||||||
IncrementalBackupDirectory = "../incremental_backup";
|
|
||||||
|
|
||||||
// IOS - Directory to store ios.string_cache file
|
|
||||||
StringManagerCacheDirectory = "../data_shard_local";
|
|
||||||
|
|
||||||
// IOS - Directory to log chat into
|
|
||||||
LogChatDirectory = "../data_shard_local";
|
|
||||||
|
|
||||||
// MFS - Directories
|
|
||||||
WebRootDirectory = "../www";
|
|
||||||
|
|
||||||
// Root directory where data from shards are stored into
|
|
||||||
SaveShardRoot = "../save_shard/";
|
|
||||||
|
|
||||||
// SU Specifics --------------------------------------------------------------------------
|
|
||||||
// SU - set to 1 if SU didn't use a naming service
|
|
||||||
SUDontUseNS = 1;
|
|
||||||
// SU - host for the NS used by SU
|
|
||||||
SUNSHost = "localhost";
|
|
||||||
// SU - listen address of the SU service (for L5 connections)
|
|
||||||
SUAddress = SUHost+":"+SUPort;
|
|
||||||
// SU - nel and ring database names
|
|
||||||
DBNelName = "nel";
|
|
||||||
DBRingName = "ring_open";
|
|
||||||
// Nel DB user
|
|
||||||
DBNelUser = "open";
|
|
||||||
// Ring DB user
|
|
||||||
DBRingUser = "open";
|
|
||||||
// SU - password to access to the nel database with DBNelUseruser (default is no password)
|
|
||||||
DBNelPass = "";
|
|
||||||
// SU - password to access to the ring database with DBRingUser (default is no password)
|
|
||||||
DBRingPass = "";
|
|
||||||
|
|
||||||
// WS Specifics --------------------------------------------------------------------------
|
|
||||||
// WS - use or not the legacy WelcomeService from nel ns (only for backward compatibility during transition to ring)
|
|
||||||
DontUseLSService = 1;
|
|
||||||
|
|
||||||
// Global config --------------------------------------------------------------------------
|
|
||||||
// set to 0 if you want to use the admin system
|
|
||||||
DontUseAES = 1;
|
|
||||||
|
|
||||||
// Dissable generation / display of nldebug messages
|
|
||||||
DissableNLDebug = 1;
|
|
||||||
DisableNLDebug = 1;
|
|
||||||
ShardId = 201;
|
|
||||||
BasePort = 51400;
|
|
||||||
SaveFilesDirectory="open_ring01/";
|
|
||||||
NSHost = "localhost";
|
|
||||||
// Player limits (AIS, EGS, WS, FS)
|
|
||||||
NbPlayersLimit = 5000;
|
|
||||||
NbGuildLimit = 15000;
|
|
||||||
PlayerLimit = NbPlayersLimit;
|
|
||||||
ClientLimit = 1000;
|
|
||||||
|
|
||||||
// Set this shard as a ring (1) or mainland (0) shard (main behavior switch)
|
|
||||||
IsRingShard = 1;
|
|
||||||
|
|
||||||
// Set a mainland SessionId.
|
|
||||||
// Live: Must be 0 for ring shards, non-zero (usually ShardId) for mainland shards
|
|
||||||
// Dev: Can be non-zero to initially connect a client to a ring shard
|
|
||||||
NoWSShardId = ShardId;
|
|
||||||
FixedSessionId = 0;
|
|
||||||
|
|
||||||
// Mirror limits
|
|
||||||
DatasetSizefe_temp = 600000;
|
|
||||||
DatasetSizefame = 26000;
|
|
||||||
|
|
||||||
// FS Specifics --------------------------------------------------------------------------
|
|
||||||
// Client bandwidth ratio, set to 1 for standard operation, more than one allocate more bandwidth
|
|
||||||
BandwidthRatio = 2;
|
|
||||||
|
|
||||||
// EGS Specifics --------------------------------------------------------------------------
|
|
||||||
// Entity Limits (EGS)
|
|
||||||
NbObjectsLimit = 2000;
|
|
||||||
NbNpcSpawnedByEGSLimit = 5000;
|
|
||||||
NbForageSourcesLimit = 10000;
|
|
||||||
NbToxicCloudsLimit = 5000;
|
|
||||||
|
|
||||||
// AIS Specifics --------------------------------------------------------------------------
|
|
||||||
// Entity Limits (AIS)
|
|
||||||
NbPetLimit = NbPlayersLimit*4;
|
|
||||||
NbFaunaLimit = 50000;
|
|
||||||
NbNpcLimit = 50000;
|
|
||||||
NbFxLimit = 500;
|
|
||||||
|
|
||||||
// This is the list of continent to use with their unique instance number
|
|
||||||
UsedContinents =
|
|
||||||
{
|
|
||||||
"r2_desert", "10000",
|
|
||||||
"r2_forest", "10001",
|
|
||||||
"r2_jungle", "10002",
|
|
||||||
"r2_lakes", "10003",
|
|
||||||
"r2_roots", "10004",
|
|
||||||
};
|
|
||||||
|
|
||||||
// define the primitives configuration used.
|
|
||||||
UsedPrimitives =
|
|
||||||
{
|
|
||||||
};
|
|
||||||
FSListenHost = "localhost";
|
|
||||||
#include "dynamic_scenario_service_default.cfg"
|
|
||||||
WriteFilesDirectory="../live/service_dynamic_scenario_service/";
|
|
||||||
DontLog = 1;
|
|
||||||
WebSrvHost = "http://localhost:50000/";
|
|
||||||
Mainlands = {
|
|
||||||
"302", "Open", "(Open Developer Community)", "en",
|
|
||||||
};
|
|
||||||
HomeMainlandNames =
|
|
||||||
{
|
|
||||||
"302", "Open", "open",
|
|
||||||
};
|
|
||||||
RRDVarPath = "../rrd_graphs";
|
|
||||||
NegFiltersInfo+= {"FESTATS", "FETIME", "FERECV", "FESEND: sent SYNC message to client 1", "EIT: Register EId"};
|
|
||||||
NegFiltersWarning+= {"PIPO_SESSION1", "casino_session_matis01", "invalid damage type 10", "_log_Item_Delete",
|
|
||||||
"_log_Item_Money", "_log_Item_Create", "_log_Item_Move", "botChatMissionAdvance> invalid index 0",
|
|
||||||
"_MaxRange(0) < _MinRange(1)", "Can't find craft plan sheet 'unknown.unknown'"};
|
|
||||||
DontUseAES=1;
|
|
||||||
RingRPEnabled=0;
|
|
||||||
DomainName = "ryzom_open";
|
|
||||||
EnableStlAllocatorChecker = 0;
|
|
||||||
// start commands for setting up the exchange level caps of different ryzom shards
|
|
||||||
StartCommands += { "setShardExchangeLimit 101 250" };
|
|
||||||
StartCommands += { "setShardExchangeLimit 102 250" };
|
|
||||||
StartCommands += { "setShardExchangeLimit 103 250" };
|
|
||||||
StartCommands += { "setShardExchangeLimit 104 0" };
|
|
||||||
StartCommands += { "setShardExchangeLimit 105 0" };
|
|
||||||
StartCommands += { "displayShardExchangeLimits" };
|
|
||||||
StartCommands += { "EnableStlAllocatorChecker 0" };
|
|
||||||
|
|
||||||
Paths = {
|
|
||||||
".",
|
|
||||||
"../common/data_common",
|
|
||||||
"../common/data_leveldesign",
|
|
||||||
};
|
|
@ -1,9 +0,0 @@
|
|||||||
|
|
||||||
DelayBeforeStartAct = 1;
|
|
||||||
MaxNpcs = 300;
|
|
||||||
MaxStaticObjects = 200;
|
|
||||||
|
|
||||||
StartCommands +=
|
|
||||||
{
|
|
||||||
"unifiedNetwork.addService ShardUnifier ( address="+SUAddress+" sendId external autoRetry )",
|
|
||||||
};
|
|
@ -1,196 +0,0 @@
|
|||||||
// Use with commandline: entities_game_service -C. -L. --nobreak --writepid
|
|
||||||
|
|
||||||
// ---- config local variables
|
|
||||||
|
|
||||||
#define DONT_USE_LGS_SLAVE
|
|
||||||
|
|
||||||
AESPort="46702";
|
|
||||||
SUPort = 50505;
|
|
||||||
SUGlobalPort = 50503;
|
|
||||||
L3MasterLGSPort = 41292;
|
|
||||||
L3SlaveLGSPort = 49993;
|
|
||||||
SUHost = "localhost";
|
|
||||||
MasterLGSHost = "localhost";
|
|
||||||
SlaveLGSHost = "localhost";
|
|
||||||
// SU - listen address of the SU service (for L5 connections)
|
|
||||||
SUAddress = SUHost+":"+SUPort;
|
|
||||||
|
|
||||||
#include "entities_game_service_default.cfg"
|
|
||||||
|
|
||||||
// ---- service NeL variables (used by ConfigFile class)
|
|
||||||
|
|
||||||
AESAliasName= "egs";
|
|
||||||
|
|
||||||
StartCommands += {
|
|
||||||
"moduleManager.createModule AnimSessionManager asm",
|
|
||||||
"asm.plug gw",
|
|
||||||
};
|
|
||||||
|
|
||||||
// start commands for setting up the exchange level caps of different ryzom shards
|
|
||||||
StartCommands += { "setShardExchangeLimit 302 250" };
|
|
||||||
|
|
||||||
StartCommands += { "displayShardExchangeLimits" };
|
|
||||||
StartCommands += { "EnableStlAllocatorChecker 0" };
|
|
||||||
|
|
||||||
GraphVars += { "CharacterLoadPerTick", "60000" };
|
|
||||||
GraphVars += { "CharacterSavePerTick", "60000" };
|
|
||||||
GraphVars += { "TickSpeedLoop", "60000" };
|
|
||||||
GraphVars += { "L5CallbackCount", "60000" };
|
|
||||||
GraphVars += { "L5CallbackTime", "60000" };
|
|
||||||
GraphVars += { "MirrorCallbackCount", "60000" };
|
|
||||||
GraphVars += { "MirrorCallbackTime", "60000" };
|
|
||||||
|
|
||||||
NSHost = "localhost";
|
|
||||||
|
|
||||||
Paths = {
|
|
||||||
".",
|
|
||||||
"../common/data_common",
|
|
||||||
"../common/data_leveldesign",
|
|
||||||
};
|
|
||||||
PathsNoRecurse= {"."};
|
|
||||||
|
|
||||||
|
|
||||||
// ---- service NeL variables (used by CVariable class)
|
|
||||||
|
|
||||||
// ---- service custom variables (used by ConfigFile class)
|
|
||||||
|
|
||||||
WebSrvHost = "http://localhost:55555/";
|
|
||||||
|
|
||||||
NbPlayersLimit = PlayerLimit;
|
|
||||||
NbGuildLimit = 15000;
|
|
||||||
|
|
||||||
// Entity Limits (EGS)
|
|
||||||
NbObjectsLimit = 2000;
|
|
||||||
NbNpcSpawnedByEGSLimit = 5000;
|
|
||||||
NbForageSourcesLimit = 10000;
|
|
||||||
NbToxicCloudsLimit = 5000;
|
|
||||||
|
|
||||||
#include "used_continents.cfg"
|
|
||||||
|
|
||||||
// define the primitives configuration used.
|
|
||||||
UsedPrimitives =
|
|
||||||
{
|
|
||||||
"newbieland_all",
|
|
||||||
};
|
|
||||||
|
|
||||||
// the following variable must be defined but should be empty - it's presence is used to change the behaviour
|
|
||||||
// of the packed sheet reader
|
|
||||||
GeorgePaths = { "" };
|
|
||||||
|
|
||||||
HomeMainlandNames =
|
|
||||||
{
|
|
||||||
"302", "Open", "open",
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
UsedContinents +=
|
|
||||||
{
|
|
||||||
"bagne", "0",
|
|
||||||
"fyros", "1",
|
|
||||||
"fyros_island", "2",
|
|
||||||
"fyros_newbie", "3",
|
|
||||||
"indoors", "4", // NB : this is for uninstanciated indoors building.
|
|
||||||
"matis", "5",
|
|
||||||
"matis_newbie", "7",
|
|
||||||
"matis_island", "8",
|
|
||||||
"nexus", "9",
|
|
||||||
"route_gouffre","10",
|
|
||||||
"sources", "11",
|
|
||||||
"terre", "12",
|
|
||||||
// "testroom", "13",
|
|
||||||
"tryker", "14",
|
|
||||||
"tryker_island","15",
|
|
||||||
"tryker_newbie","16",
|
|
||||||
"zorai", "17",
|
|
||||||
"zorai_island", "18",
|
|
||||||
"zorai_newbie", "19",
|
|
||||||
"newbieland", "20",
|
|
||||||
"kitiniere", "21",
|
|
||||||
};
|
|
||||||
|
|
||||||
// define the primitives configuration used.
|
|
||||||
UsedPrimitives =
|
|
||||||
{
|
|
||||||
"newbieland_all",
|
|
||||||
"matis_newbie_all",
|
|
||||||
"matis_all",
|
|
||||||
"matis_island_all",
|
|
||||||
"zorai_newbie_all",
|
|
||||||
"zorai_all",
|
|
||||||
"zorai_island_all",
|
|
||||||
"fyros_newbie_all",
|
|
||||||
"fyros_all",
|
|
||||||
"fyros_island_all",
|
|
||||||
"tryker_newbie_all",
|
|
||||||
"tryker_all",
|
|
||||||
"tryker_island_all",
|
|
||||||
"terre_all",
|
|
||||||
"sources_all",
|
|
||||||
"route_gouffre_all",
|
|
||||||
"nexus_all",
|
|
||||||
"bagne_all",
|
|
||||||
"kitiniere_all",
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Mirror limits
|
|
||||||
DatasetSizefe_temp = 600000;
|
|
||||||
DatasetSizefame = 26000;
|
|
||||||
|
|
||||||
// ---- service custom variables (used by CVariable class)
|
|
||||||
|
|
||||||
RingRPEnabled=0;
|
|
||||||
RingRPXPRequiredPerAction=700;
|
|
||||||
RingRPXPRequiredPerTimeSlice=700;
|
|
||||||
|
|
||||||
MaxXPGainPerPlayer = 30.0;
|
|
||||||
DeathXPFactor = 0.1;
|
|
||||||
|
|
||||||
MFSHost = "localhost";
|
|
||||||
|
|
||||||
// Use Shard Unifier or not
|
|
||||||
DontUseSU = 0;
|
|
||||||
|
|
||||||
// Set this shard as a ring (1) or mainland (0) shard (main behavior switch)
|
|
||||||
IsRingShard = 0;
|
|
||||||
|
|
||||||
// Set a mainland SessionId.
|
|
||||||
// Live: Must be 0 for ring shards, non-zero (usually ShardId) for mainland shards
|
|
||||||
// Dev: Can be non-zero to initially connect a client to a ring shard
|
|
||||||
FixedSessionId = ShardId;
|
|
||||||
|
|
||||||
// Level limit for newb scenarios
|
|
||||||
FreeTrialSkillLimit=21;
|
|
||||||
|
|
||||||
// Level limit for newb scenarios
|
|
||||||
DefaultInterShardExchangeLevelCap=0;
|
|
||||||
|
|
||||||
// Disable ryzom verbose logging
|
|
||||||
VerboseMIRROR = 0;
|
|
||||||
VerboseRingRPLog = 0;
|
|
||||||
VerboseCDBGroup = 0;
|
|
||||||
|
|
||||||
// What to do with characters coming from another mainland shard?
|
|
||||||
// 0: teleport to the stored session id
|
|
||||||
// 1: let the character play anyway, but leave the stored session id unchanged
|
|
||||||
// 2: assign the stored session id with FixedSessionId and let play
|
|
||||||
AllowCharsFromAllSessions = 0;
|
|
||||||
|
|
||||||
/* Force default value for PDLib directory (e.g. SaveFilesDirectory...)
|
|
||||||
* PLEASE NOTICE THAT THIS LINE MUST BE LEFT TO ""
|
|
||||||
* Only log analyser must have the $shard parameter to find all shards root directory
|
|
||||||
*/
|
|
||||||
PDRootDirectory = "";
|
|
||||||
|
|
||||||
// Log PD updates to log file (1 enabled, 0 disabled), see PDLogSaveDirectory to choose where to log
|
|
||||||
PDEnableLog = 1;
|
|
||||||
|
|
||||||
// Log PD StringManager updates to log file (1 enabled, 0 disabled), see PDLogSaveDirectory to choose where to log
|
|
||||||
PDEnableStringLog = 0;
|
|
||||||
|
|
||||||
// Number of seconds between 2 logs to file
|
|
||||||
PDLogUpdate = 10;
|
|
||||||
|
|
||||||
#include "backup_service_interface.cfg"
|
|
||||||
|
|
||||||
XMLSave = 0;
|
|
File diff suppressed because it is too large
Load Diff
@ -1,47 +0,0 @@
|
|||||||
// Use with commandline: frontend_service -C. -L. --nobreak --writepid
|
|
||||||
|
|
||||||
// ---- config local variables
|
|
||||||
|
|
||||||
// Client bandwidth ratio, set to 1 for standard opration, more than one allocate more bandwidth
|
|
||||||
BandwidthRatio = 1;
|
|
||||||
|
|
||||||
FSUDPPort = 47851;
|
|
||||||
FSListenHost = "shard.ryzomcore.org";
|
|
||||||
|
|
||||||
#include "frontend_service_default.cfg"
|
|
||||||
|
|
||||||
// ---- service NeL variables (used by ConfigFile class)
|
|
||||||
|
|
||||||
AESAliasName= "fes";
|
|
||||||
|
|
||||||
GraphVars += { "TickSpeedLoop", "60000" };
|
|
||||||
GraphVars += { "L5CallbackCount", "60000" };
|
|
||||||
GraphVars += { "L5CallbackTime", "60000" };
|
|
||||||
GraphVars += { "MirrorCallbackCount", "60000" };
|
|
||||||
GraphVars += { "MirrorCallbackTime", "60000" };
|
|
||||||
|
|
||||||
Paths = {
|
|
||||||
"../common/data_common",
|
|
||||||
".",
|
|
||||||
"../common/data_leveldesign",
|
|
||||||
};
|
|
||||||
|
|
||||||
// ---- service NeL variables (used by CVariable class)
|
|
||||||
|
|
||||||
// ---- service custom variables (used by ConfigFile class)
|
|
||||||
|
|
||||||
//AcceptInvalidCookie = 1;
|
|
||||||
|
|
||||||
ClientLimit = 1000;
|
|
||||||
|
|
||||||
// Mirror limits
|
|
||||||
DatasetSizefe_temp = 600000;
|
|
||||||
DatasetSizefame = 26000;
|
|
||||||
|
|
||||||
// ---- service custom variables (used by CVariable class)
|
|
||||||
|
|
||||||
// Disable ryzom verbose logging
|
|
||||||
VerboseMIRROR = 0;
|
|
||||||
|
|
||||||
// Root directory where data from shards are stored into
|
|
||||||
SaveShardRoot = "save_shard/";
|
|
@ -1,104 +0,0 @@
|
|||||||
#include "common.cfg"
|
|
||||||
|
|
||||||
// Configure module gateway for front end operation
|
|
||||||
StartCommands +=
|
|
||||||
{
|
|
||||||
// Add a security plugin (will add player info on player module proxy)
|
|
||||||
"gw.securityCreate FESecurity",
|
|
||||||
// create a front end service transport
|
|
||||||
"gw.transportAdd FEServer fes",
|
|
||||||
// set the transport option (need PeerInvisible and Firewalled)
|
|
||||||
"gw.transportOptions fes(PeerInvisible Firewalled)",
|
|
||||||
// open the transport
|
|
||||||
"gw.transportCmd fes(open)",
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// UDP port for client communication
|
|
||||||
//FrontendPort = 47851;
|
|
||||||
|
|
||||||
ListenAddress = FSListenHost+":"+FSUDPPort;
|
|
||||||
|
|
||||||
// Maximum size that can be read from a client message
|
|
||||||
DatagramLength = 10000;
|
|
||||||
|
|
||||||
// Time-out before removing a client when it does not send any more data
|
|
||||||
ClientTimeOut = 600000; // 10 min
|
|
||||||
|
|
||||||
// Time-out before removing a limbo client when it does not send any more data
|
|
||||||
LimboTimeOut = 60000; // 1 min
|
|
||||||
|
|
||||||
// Maximum bytes per game cycle sent to all clients (currently not used/implemented)
|
|
||||||
TotalBandwidth = 536870911; // <512 MB : max value for 32 bit bitsize !
|
|
||||||
|
|
||||||
// Maximum bytes per game cycle sent to a client, including all headers
|
|
||||||
ClientBandwidth = 332 * BandwidthRatio; // 332 <=> 13 kbit/s at 5 Hz; 202 <=> 16 kbit/s at 10 Hz
|
|
||||||
|
|
||||||
// Maximum bytes for impulsion channels per datagram sent to a client
|
|
||||||
ImpulsionByteSize0 = 20 * BandwidthRatio;
|
|
||||||
ImpulsionByteSize1 = 200 * BandwidthRatio;
|
|
||||||
ImpulsionByteSize2 = 200 * BandwidthRatio;
|
|
||||||
NbMinimalVisualBytes = 50;
|
|
||||||
|
|
||||||
// Distance/delta ratio that triggers the sending of a position
|
|
||||||
DistanceDeltaRatioForPos = 100;
|
|
||||||
|
|
||||||
// Number of game cycles per front-end cycle
|
|
||||||
GameCycleRatio = 1;
|
|
||||||
// Execution period of distance calculation
|
|
||||||
CalcDistanceExecutionPeriod = 8;
|
|
||||||
// Execution period of position prioritization
|
|
||||||
PositionPrioExecutionPeriod = 2;
|
|
||||||
// Execution period of orientation prioritization
|
|
||||||
OrientationPrioExecutionPeriod = 8;
|
|
||||||
// Execution period of discreet properties prioritization
|
|
||||||
DiscreetPrioExecutionPeriod = 2;
|
|
||||||
|
|
||||||
SortPrioExecutionPeriod = 1;
|
|
||||||
|
|
||||||
// Display or not the "FE" nlinfos
|
|
||||||
DisplayInfo = 1;
|
|
||||||
|
|
||||||
// Prioritizer mode (currently the only mode is 1 for DistanceDelta)
|
|
||||||
PriorityMode = 1;
|
|
||||||
|
|
||||||
// Strategy for selecting pairs to prioritize (Power2WithCeiling=0, Scoring=1)
|
|
||||||
SelectionStrategy = 1;
|
|
||||||
|
|
||||||
// Minimum number of pairs to select for prioritization
|
|
||||||
MinNbPairsToSelect = 2000;
|
|
||||||
|
|
||||||
// Index of client to monitor, or 0 for no monitoring
|
|
||||||
ClientMonitor = 0;
|
|
||||||
|
|
||||||
// Allow or not beeping
|
|
||||||
AllowBeep = 1;
|
|
||||||
|
|
||||||
Lag = 0; // The lag on the simulated network (used by simlag)
|
|
||||||
PacketLoss = 0; // percentage of lost packet (used by simlag)
|
|
||||||
PacketDuplication = 0; // percentage of duplicated packet (used by simlag)
|
|
||||||
PacketDisordering = 0; // percentage of disordered packet (used by simlag) (Lag must be >100 to use disordering)
|
|
||||||
|
|
||||||
// ----------------------------------------
|
|
||||||
// Frontend/Patch mode settings
|
|
||||||
|
|
||||||
// If 1, the frontend server is used in Patch/Frontend mode (0 = only frontend mode, old behaviour)
|
|
||||||
UseWebPatchServer = 1;
|
|
||||||
|
|
||||||
// If 0, the frontend service is in Patch mode at startup, and it won't accept clients unless WS tells it to do so.
|
|
||||||
AcceptClientsAtStartup = 1;
|
|
||||||
|
|
||||||
// Patch URL footer. PatchURL will look like 'http://223.254.124.23:43435/patch'
|
|
||||||
PatchingURLFooter = ":43435/patch";
|
|
||||||
|
|
||||||
// System command to be executed when FS tries to start Web Patch server (ideally at FS startup)
|
|
||||||
StartWebServerSysCommand = "";
|
|
||||||
|
|
||||||
// System command to be executed when FS tries to stop Web Patch server (ideally when FS turns to frontend mode)
|
|
||||||
StopWebServerSysCommand = "";
|
|
||||||
|
|
||||||
// Use Thread for sending
|
|
||||||
UseSendThread = 1;
|
|
||||||
|
|
||||||
// Unidirectional Mirror mode (FS part)
|
|
||||||
ExpediteTOCK = 1;
|
|
@ -1,39 +0,0 @@
|
|||||||
// Use with commandline: gpm_service -C. -L. --nobreak --writepid
|
|
||||||
|
|
||||||
#include "gpm_service_default.cfg"
|
|
||||||
|
|
||||||
// ---- config local variables
|
|
||||||
|
|
||||||
// ---- service NeL variables (used by ConfigFile class)
|
|
||||||
|
|
||||||
AESAliasName= "gpms";
|
|
||||||
|
|
||||||
GraphVars += { "TickSpeedLoop", "60000" };
|
|
||||||
GraphVars += { "L5CallbackCount", "60000" };
|
|
||||||
GraphVars += { "L5CallbackTime", "60000" };
|
|
||||||
GraphVars += { "MirrorCallbackCount", "60000" };
|
|
||||||
GraphVars += { "MirrorCallbackTime", "60000" };
|
|
||||||
|
|
||||||
Paths = {
|
|
||||||
".",
|
|
||||||
"../common/data_common",
|
|
||||||
"../common/data_leveldesign",
|
|
||||||
};
|
|
||||||
|
|
||||||
// ---- service NeL variables (used by CVariable class)
|
|
||||||
|
|
||||||
// ---- service custom variables (used by ConfigFile class)
|
|
||||||
|
|
||||||
#include "used_continents.cfg"
|
|
||||||
|
|
||||||
// Mirror limits
|
|
||||||
DatasetSizefe_temp = 600000;
|
|
||||||
DatasetSizefame = 26000;
|
|
||||||
|
|
||||||
// ---- service custom variables (used by CVariable class)
|
|
||||||
|
|
||||||
// Set this shard as a ring (1) or mainland (0) shard (main behavior switch)
|
|
||||||
IsRingShard = 0;
|
|
||||||
|
|
||||||
// Disable ryzom verbose logging
|
|
||||||
VerboseMIRROR = 0;
|
|
@ -1,7 +0,0 @@
|
|||||||
#include "common.cfg"
|
|
||||||
|
|
||||||
CheckPlayerSpeed = 0;
|
|
||||||
SecuritySpeedFactor = 1.5;
|
|
||||||
|
|
||||||
LoadPacsPrims = 0;
|
|
||||||
LoadPacsCol = 1;
|
|
@ -1,81 +0,0 @@
|
|||||||
// Use with commandline: input_output_service -C. -L. --nobreak --writepid
|
|
||||||
|
|
||||||
// ---- config local variables
|
|
||||||
|
|
||||||
#define DONT_USE_LGS_SLAVE
|
|
||||||
|
|
||||||
AESPort="46702";
|
|
||||||
SUPort = 50505;
|
|
||||||
SUGlobalPort = 50503;
|
|
||||||
L3MasterLGSPort = 41292;
|
|
||||||
L3SlaveLGSPort = 49993;
|
|
||||||
SUHost = "localhost";
|
|
||||||
MasterLGSHost = "localhost";
|
|
||||||
SlaveLGSHost = "localhost";
|
|
||||||
// SU - listen address of the SU service (for L5 connections)
|
|
||||||
SUAddress = SUHost+":"+SUPort;
|
|
||||||
|
|
||||||
#include "input_output_service_default.cfg"
|
|
||||||
|
|
||||||
// ---- service NeL variables (used by ConfigFile class)
|
|
||||||
|
|
||||||
AESAliasName= "ios";
|
|
||||||
|
|
||||||
// Create a char name mapper
|
|
||||||
StartCommands +=
|
|
||||||
{
|
|
||||||
"moduleManager.createModule CharNameMapper cnm",
|
|
||||||
"cnm.plug gw",
|
|
||||||
"moduleManager.createModule IOSRingModule iosrm",
|
|
||||||
"iosrm.plug gw",
|
|
||||||
};
|
|
||||||
|
|
||||||
Paths = {
|
|
||||||
".",
|
|
||||||
"../common/data_common",
|
|
||||||
"../common/data_leveldesign",
|
|
||||||
};
|
|
||||||
|
|
||||||
// ---- service NeL variables (used by CVariable class)
|
|
||||||
|
|
||||||
// ---- service custom variables (used by ConfigFile class)
|
|
||||||
|
|
||||||
// Mirror limits
|
|
||||||
DatasetSizefe_temp = 600000;
|
|
||||||
DatasetSizefame = 26000;
|
|
||||||
|
|
||||||
// the following variable must be defined but should be empty - it's presence is used to change the behaviour
|
|
||||||
// of the packed sheet reader
|
|
||||||
GeorgePaths = { "" };
|
|
||||||
|
|
||||||
// Use Shard Unifier or not
|
|
||||||
DontUseSU = 0;
|
|
||||||
|
|
||||||
HomeMainlandNames =
|
|
||||||
{
|
|
||||||
"302", "Open", "open",
|
|
||||||
};
|
|
||||||
|
|
||||||
// ---- service custom variables (used by CVariable class)
|
|
||||||
|
|
||||||
// Set this shard as a ring (1) or mainland (0) shard (main behavior switch)
|
|
||||||
IsRingShard = 0;
|
|
||||||
|
|
||||||
// Disable ryzom verbose logging
|
|
||||||
VerboseMIRROR = 0;
|
|
||||||
|
|
||||||
#include "backup_service_interface.cfg"
|
|
||||||
|
|
||||||
// IOS - Directory to store ios.string_cache file
|
|
||||||
StringManagerCacheDirectory = "data_shard_local";
|
|
||||||
|
|
||||||
// IOS - Directory to log chat into
|
|
||||||
LogChatDirectory = "data_shard_local";
|
|
||||||
|
|
||||||
ReadTranslationWork = 1;
|
|
||||||
TranslationWorkPath = "";
|
|
||||||
VerboseStringManager = 0;
|
|
||||||
VerboseStringManagerParser = 0;
|
|
||||||
VerboseChat = 0;
|
|
||||||
VerboseChatManagement = 0;
|
|
||||||
VerboseNameTranslation = 0;
|
|
@ -1,95 +0,0 @@
|
|||||||
#include "common.cfg"
|
|
||||||
|
|
||||||
// ---- service NeL variables (used by ConfigFile class)
|
|
||||||
|
|
||||||
StartCommands +=
|
|
||||||
{
|
|
||||||
// L5 connect to the shard unifier
|
|
||||||
"unifiedNetwork.addService ShardUnifier ( address="+SUAddress+" sendId external autoRetry )",
|
|
||||||
|
|
||||||
// Create a gateway for global interconnection
|
|
||||||
// modules from different shard are visible to each other if they connect to
|
|
||||||
// this gateway. SU Local module have no interest to be plugged here.
|
|
||||||
"moduleManager.createModule StandardGateway glob_gw",
|
|
||||||
// add a layer 3 server transport
|
|
||||||
"glob_gw.transportAdd L3Client l3c",
|
|
||||||
// open the transport
|
|
||||||
"glob_gw.transportCmd l3c(connect addr="+SUHost+":"+SUGlobalPort+")",
|
|
||||||
|
|
||||||
// Create a gateway for logger service connection
|
|
||||||
"moduleManager.createModule StandardGateway lgs_gw",
|
|
||||||
|
|
||||||
// add a layer 3 server transport for master logger service
|
|
||||||
"lgs_gw.transportAdd L3Client masterL3c",
|
|
||||||
// open the transport
|
|
||||||
"lgs_gw.transportCmd masterL3c(connect addr="+MasterLGSHost+":"+L3MasterLGSPort+")",
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifndef DONT_USE_LGS_SLAVE
|
|
||||||
|
|
||||||
StartCommands +=
|
|
||||||
{
|
|
||||||
// add a layer 3 server transport for slave logger service
|
|
||||||
"lgs_gw.transportAdd L3Client slaveL3c",
|
|
||||||
// open the transport
|
|
||||||
"lgs_gw.transportCmd slaveL3c(connect addr="+SlaveLGSHost+":"+L3SlaveLGSPort+")",
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
StartCommands +=
|
|
||||||
{
|
|
||||||
// Create a chat unifier client
|
|
||||||
"moduleManager.createModule ChatUnifierClient cuc",
|
|
||||||
|
|
||||||
// and plug it on the gateway to reach the SU ChatUnifierServer
|
|
||||||
"cuc.plug glob_gw",
|
|
||||||
"cuc.plug gw",
|
|
||||||
|
|
||||||
// Create the logger service client module
|
|
||||||
"moduleManager.createModule LoggerServiceClient lsc",
|
|
||||||
"lsc.plug lgs_gw",
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ---- service NeL variables (used by CVariable class)
|
|
||||||
|
|
||||||
// ---- service custom variables (used by ConfigFile class)
|
|
||||||
|
|
||||||
// a list of system command that can be run with "sysCmd" service command.
|
|
||||||
SystemCmd = {};
|
|
||||||
|
|
||||||
// IOS don't use work directory by default
|
|
||||||
ReadTranslationWork = 0;
|
|
||||||
TranslationWorkPath = "translation/work";
|
|
||||||
|
|
||||||
// Global shard bot name translation file. You sould overide this
|
|
||||||
// in input_output_service.cfg to specialize the file
|
|
||||||
// depending on the shard main language.
|
|
||||||
BotNameTranslationFile = "bot_names.txt";
|
|
||||||
|
|
||||||
// Global shard event faction translation file. You sould override this
|
|
||||||
// in input_output_service.cfg to specialize the file
|
|
||||||
// depending on the shard main language.
|
|
||||||
EventFactionTranslationFile = "event_factions.txt";
|
|
||||||
|
|
||||||
|
|
||||||
// ---- service custom variables (used by CVariable class)
|
|
||||||
|
|
||||||
// Activate/deactivate debugging of missing paremeter replacement
|
|
||||||
DebugReplacementParameter = 1;
|
|
||||||
|
|
||||||
// Default verbose debug flags:
|
|
||||||
//-----------------------------
|
|
||||||
|
|
||||||
// Log bot name translation from 'BotNameTranslationFile'
|
|
||||||
VerboseNameTranslation = 1;
|
|
||||||
// Log chat management operation
|
|
||||||
VerboseChatManagement = 1;
|
|
||||||
// Log chat event
|
|
||||||
VerboseChat = 1;
|
|
||||||
// Log string manager message
|
|
||||||
VerboseStringManager = 1;
|
|
||||||
// Log the string manager parsing message
|
|
||||||
VerboseStringManagerParser = 0;
|
|
@ -1,50 +0,0 @@
|
|||||||
// Use with commandline: logger_service -C. -L. --nobreak --writepid
|
|
||||||
|
|
||||||
#include "logger_service_default.cfg"
|
|
||||||
|
|
||||||
// ---- config local variables
|
|
||||||
|
|
||||||
LGSL3Port = 41292;
|
|
||||||
|
|
||||||
// ---- service NeL variables (used by ConfigFile class)
|
|
||||||
|
|
||||||
AESAliasName= "lgs";
|
|
||||||
|
|
||||||
StartCommands +=
|
|
||||||
{
|
|
||||||
"moduleManager.createModule LoggerService ls",
|
|
||||||
"moduleManager.createModule StandardGateway lgs_gw",
|
|
||||||
"ls.plug lgs_gw",
|
|
||||||
"lgs_gw.transportAdd L3Server l3s",
|
|
||||||
"lgs_gw.transportOptions l3s(PeerInvisible)",
|
|
||||||
"lgs_gw.transportCmd l3s(open port="+ LGSL3Port +")",
|
|
||||||
};
|
|
||||||
|
|
||||||
DontUseNS = 1;
|
|
||||||
|
|
||||||
Paths = {
|
|
||||||
".",
|
|
||||||
"../common/data_leveldesign",
|
|
||||||
};
|
|
||||||
|
|
||||||
// ---- service NeL variables (used by CVariable class)
|
|
||||||
|
|
||||||
// Where to save specific shard data (ie: player backup), relatively to SaveShardRoot
|
|
||||||
SaveFilesDirectory = "save_shard/";
|
|
||||||
|
|
||||||
// where to save generic shard data (ie: packed_sheet)
|
|
||||||
WriteFilesDirectory = "r2_shard/data_shard";
|
|
||||||
|
|
||||||
// ---- service custom variables (used by ConfigFile class)
|
|
||||||
|
|
||||||
// Use Shard Unifier or not
|
|
||||||
DontUseSU = 0;
|
|
||||||
|
|
||||||
HomeMainlandNames =
|
|
||||||
{
|
|
||||||
"302", "Open", "open",
|
|
||||||
};
|
|
||||||
|
|
||||||
// ---- service custom variables (used by CVariable class)
|
|
||||||
|
|
||||||
#include "backup_service_interface.cfg"
|
|
@ -1 +0,0 @@
|
|||||||
#include "common.cfg"
|
|
@ -1,19 +0,0 @@
|
|||||||
// Use with commandline: mail_forum_service -C. -L. --nobreak --writepid
|
|
||||||
|
|
||||||
#include "mail_forum_service_default.cfg"
|
|
||||||
|
|
||||||
// ---- config local variables
|
|
||||||
|
|
||||||
// ---- service NeL variables (used by ConfigFile class)
|
|
||||||
|
|
||||||
AESAliasName= "mfs";
|
|
||||||
|
|
||||||
Paths = {
|
|
||||||
".",
|
|
||||||
};
|
|
||||||
|
|
||||||
// ---- service NeL variables (used by CVariable class)
|
|
||||||
|
|
||||||
// ---- service custom variables (used by ConfigFile class)
|
|
||||||
|
|
||||||
// ---- service custom variables (used by CVariable class)
|
|
@ -1,29 +0,0 @@
|
|||||||
#include "common.cfg"
|
|
||||||
|
|
||||||
// ---- service NeL variables (used by ConfigFile class)
|
|
||||||
|
|
||||||
DontUseNS = 1;
|
|
||||||
|
|
||||||
// ---- service NeL variables (used by CVariable class)
|
|
||||||
|
|
||||||
// ---- service custom variables (used by ConfigFile class)
|
|
||||||
|
|
||||||
|
|
||||||
// ---- service custom variables (used by CVariable class)
|
|
||||||
|
|
||||||
WebRootDirectory = "save_shard/www";
|
|
||||||
|
|
||||||
// Set if Hall of Fame generator is enabled
|
|
||||||
HoFEnableGenerator = 1;
|
|
||||||
|
|
||||||
// Set if HoF generator is verbose
|
|
||||||
HoFVerbose = 0;
|
|
||||||
|
|
||||||
// Directory where HDT files are
|
|
||||||
HoFHDTDirectory = "/local/www/hof/hdt";
|
|
||||||
|
|
||||||
// HoF generator maximum update period in milliseconds
|
|
||||||
HoFGeneratorUpdatePeriod = 200;
|
|
||||||
|
|
||||||
// HoF generator directory update period in seconds
|
|
||||||
HoFGeneratorDirUpdatePeriod = 60;
|
|
@ -1,35 +0,0 @@
|
|||||||
// Use with commandline: mirror_service -C. -L. --nobreak --writepid
|
|
||||||
|
|
||||||
#include "mirror_service_default.cfg"
|
|
||||||
|
|
||||||
// ---- config local variables
|
|
||||||
|
|
||||||
// ---- service NeL variables (used by ConfigFile class)
|
|
||||||
|
|
||||||
AESAliasName= "ms";
|
|
||||||
|
|
||||||
GraphVars += { "UserSpeedLoop", "60000" };
|
|
||||||
GraphVars += { "L5CallbackCount", "60000" };
|
|
||||||
GraphVars += { "L5CallbackTime", "60000" };
|
|
||||||
|
|
||||||
Paths = {
|
|
||||||
".",
|
|
||||||
"../common/data_common",
|
|
||||||
"../common/data_leveldesign",
|
|
||||||
};
|
|
||||||
|
|
||||||
// ---- service NeL variables (used by CVariable class)
|
|
||||||
|
|
||||||
// ---- service custom variables (used by ConfigFile class)
|
|
||||||
|
|
||||||
// Mirror limits
|
|
||||||
DatasetSizefe_temp = 600000;
|
|
||||||
DatasetSizefame = 26000;
|
|
||||||
|
|
||||||
// MS Packet size limit in bytes, PER DATASET (warning: depending on the weights, limits per property may be very small)
|
|
||||||
MaxOutBandwidth = 100000000;
|
|
||||||
|
|
||||||
// ---- service custom variables (used by CVariable class)
|
|
||||||
|
|
||||||
// Disable ryzom verbose logging
|
|
||||||
VerboseMIRROR = 0;
|
|
@ -1,6 +0,0 @@
|
|||||||
#include "common.cfg"
|
|
||||||
|
|
||||||
// ---- service custom variables (used by ConfigFile class)
|
|
||||||
|
|
||||||
// Linux only
|
|
||||||
DestroyGhostSegments = 1;
|
|
@ -1,38 +0,0 @@
|
|||||||
// Use with commandline: monitor_service -C. -L. --nobreak --writepid
|
|
||||||
|
|
||||||
#include "monitor_service_default.cfg"
|
|
||||||
|
|
||||||
#include "used_continents.cfg"
|
|
||||||
|
|
||||||
// ---- config local variables
|
|
||||||
|
|
||||||
// ---- service NeL variables (used by ConfigFile class)
|
|
||||||
|
|
||||||
AESAliasName= "mos";
|
|
||||||
|
|
||||||
GraphVars += { "UserSpeedLoop", "60000" };
|
|
||||||
GraphVars += { "L5CallbackCount", "60000" };
|
|
||||||
GraphVars += { "L5CallbackTime", "60000" };
|
|
||||||
|
|
||||||
Paths = {
|
|
||||||
".",
|
|
||||||
"../common/data_common",
|
|
||||||
"../common/data_leveldesign",
|
|
||||||
};
|
|
||||||
|
|
||||||
// ---- service NeL variables (used by CVariable class)
|
|
||||||
|
|
||||||
// ---- service custom variables (used by ConfigFile class)
|
|
||||||
|
|
||||||
// Mirror limits
|
|
||||||
DatasetSizefe_temp = 600000;
|
|
||||||
DatasetSizefame = 26000;
|
|
||||||
|
|
||||||
// MS Packet size limit in bytes, PER DATASET (warning: depending on the weights, limits per property may be very small)
|
|
||||||
MaxOutBandwidth = 100000000;
|
|
||||||
|
|
||||||
|
|
||||||
// ---- service custom variables (used by CVariable class)
|
|
||||||
|
|
||||||
// Disable ryzom verbose logging
|
|
||||||
VerboseMIRROR = 0;
|
|
@ -1 +0,0 @@
|
|||||||
#include "common.cfg"
|
|
@ -1,21 +0,0 @@
|
|||||||
// Use with commandline: ryzom_naming_service -C. -L. --nobreak --writepid
|
|
||||||
|
|
||||||
#include "naming_service_default.cfg"
|
|
||||||
|
|
||||||
// ---- config local variables
|
|
||||||
|
|
||||||
// ---- service NeL variables (used by ConfigFile class)
|
|
||||||
|
|
||||||
AESAliasName= "rns";
|
|
||||||
|
|
||||||
Paths = {
|
|
||||||
"data_www"
|
|
||||||
};
|
|
||||||
|
|
||||||
// ---- service NeL variables (used by CVariable class)
|
|
||||||
|
|
||||||
// ---- service custom variables (used by ConfigFile class)
|
|
||||||
|
|
||||||
BasePort = 51000;
|
|
||||||
|
|
||||||
// ---- service custom variables (used by CVariable class)
|
|
@ -1,7 +0,0 @@
|
|||||||
#include "common.cfg"
|
|
||||||
|
|
||||||
SId = 1;
|
|
||||||
DontUseNS = 1;
|
|
||||||
|
|
||||||
UniqueOnShardServices = {}; // { "EGS", "GPMS", "IOS", "TICKS", "WS", "AIS", "DSS" };
|
|
||||||
UniqueByMachineServices = {}; // { "MS" };
|
|
@ -1,4 +0,0 @@
|
|||||||
Ce repertoire ne doit contenir *que* des fichiers qui sont differents s'il y a plusieurs instance de shard.
|
|
||||||
C'est le cas par exemple des sauvegardes des joueurs, des guiles, de la date etc...
|
|
||||||
|
|
||||||
ATTENTION: *aucuns* fichiers (sauf le read me) ici ne doivent etre commité dans le cvs car ils sont sauvé dynamiquement et doivent savoir se creer lorsqu'ils n'existent pas.
|
|
@ -1,47 +0,0 @@
|
|||||||
// Use with commandline: session_browser_server -C. -L. --nobreak --writepid
|
|
||||||
|
|
||||||
#include "session_browser_server_default.cfg"
|
|
||||||
|
|
||||||
// ---- config local variables
|
|
||||||
|
|
||||||
#include "sql.cfg"
|
|
||||||
|
|
||||||
SBSPort = 48851;
|
|
||||||
|
|
||||||
SUHost = "localhost";
|
|
||||||
|
|
||||||
// ---- service NeL variables (used by ConfigFile class)
|
|
||||||
|
|
||||||
AESAliasName= "sbs";
|
|
||||||
|
|
||||||
StartCommands +=
|
|
||||||
{
|
|
||||||
"moduleManager.createModule SessionBrowserServerMod sbs suAddr="+SUHost+":49999 listenPort="+SBSPort+" ring_db(host="+DBHost+" user="+DBRingUser+" password="+DBRingPass+" base="+DBRingName+")",
|
|
||||||
"sbs.plug gw",
|
|
||||||
};
|
|
||||||
|
|
||||||
GraphVars += { "NetSpeedLoop", "60000" };
|
|
||||||
GraphVars += { "L5CallbackCount", "60000" };
|
|
||||||
GraphVars += { "L5CallbackTime", "60000" };
|
|
||||||
|
|
||||||
Paths = {
|
|
||||||
".",
|
|
||||||
};
|
|
||||||
|
|
||||||
// ---- service NeL variables (used by CVariable class)
|
|
||||||
|
|
||||||
// ---- service custom variables (used by ConfigFile class)
|
|
||||||
|
|
||||||
// Use Shard Unifier or not
|
|
||||||
DontUseSU = 0;
|
|
||||||
|
|
||||||
HomeMainlandNames =
|
|
||||||
{
|
|
||||||
"302", "Open", "open",
|
|
||||||
};
|
|
||||||
|
|
||||||
// The max number of ring points (aka ring access) for each ecosystem
|
|
||||||
MaxRingPoints = "A1:D7:F7:J8:L6:R13";
|
|
||||||
|
|
||||||
|
|
||||||
// ---- service custom variables (used by CVariable class)
|
|
@ -1 +0,0 @@
|
|||||||
#include "common.cfg"
|
|
@ -1,77 +0,0 @@
|
|||||||
# ------------------------------------------------------------------------------
|
|
||||||
# SCREEN KEYBINDINGS
|
|
||||||
# ------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# Remove some stupid / dangerous key bindings
|
|
||||||
bind ^k
|
|
||||||
#bind L
|
|
||||||
bind ^\
|
|
||||||
# Make them better
|
|
||||||
bind \\ quit
|
|
||||||
bind K kill
|
|
||||||
bind I login on
|
|
||||||
bind O login off
|
|
||||||
|
|
||||||
hardstatus alwayslastline "%w"
|
|
||||||
|
|
||||||
chdir $RYZOM_PATH/server
|
|
||||||
|
|
||||||
screen -t aes /bin/sh ../tools/scripts/linux/service_launcher.sh aes $RYZOM_PATH/../build/bin/ryzom_admin_service -A. -C. -L. --nobreak --fulladminname=admin_executor_service --shortadminname=AES
|
|
||||||
|
|
||||||
# bms_master
|
|
||||||
screen -t bms_master /bin/sh ../tools/scripts/linux/service_launcher.sh bms_master $RYZOM_PATH/../build/bin/ryzom_backup_service -C. -L. --nobreak --writepid -P49990
|
|
||||||
|
|
||||||
# bms_pd_master
|
|
||||||
#screen -t bms_pd_master /bin/sh ../tools/scripts/linux/service_launcher.sh bms_pd_master $RYZOM_PATH/../build/bin/ryzom_backup_service -C. -L. --nobreak --writepid -P49992
|
|
||||||
|
|
||||||
# egs
|
|
||||||
screen -t egs /bin/sh ../tools/scripts/linux/service_launcher.sh egs $RYZOM_PATH/../build/bin/ryzom_entities_game_service -C. -L. --nobreak --writepid
|
|
||||||
|
|
||||||
# gpms
|
|
||||||
screen -t gpms /bin/sh ../tools/scripts/linux/service_launcher.sh gpms $RYZOM_PATH/../build/bin/ryzom_gpm_service -C. -L. --nobreak --writepid
|
|
||||||
|
|
||||||
# ios
|
|
||||||
screen -t ios /bin/sh ../tools/scripts/linux/service_launcher.sh ios $RYZOM_PATH/../build/bin/ryzom_ios_service -C. -L. --nobreak --writepid
|
|
||||||
|
|
||||||
# rns
|
|
||||||
screen -t rns /bin/sh ../tools/scripts/linux/service_launcher.sh rns $RYZOM_PATH/../build/bin/ryzom_naming_service -C. -L. --nobreak --writepid
|
|
||||||
|
|
||||||
# rws
|
|
||||||
screen -t rws /bin/sh ../tools/scripts/linux/service_launcher.sh rws $RYZOM_PATH/../build/bin/ryzom_welcome_service -C. -L. --nobreak --writepid
|
|
||||||
|
|
||||||
# ts
|
|
||||||
screen -t ts /bin/sh ../tools/scripts/linux/service_launcher.sh ts $RYZOM_PATH/../build/bin/ryzom_tick_service -C. -L. --nobreak --writepid
|
|
||||||
|
|
||||||
# ms
|
|
||||||
screen -t ms /bin/sh ../tools/scripts/linux/service_launcher.sh ms $RYZOM_PATH/../build/bin/ryzom_mirror_service -C. -L. --nobreak --writepid
|
|
||||||
|
|
||||||
# ais_newbyland
|
|
||||||
screen -t ais_newbyland /bin/sh ../tools/scripts/linux/service_launcher.sh ais_newbyland $RYZOM_PATH/../build/bin/ryzom_ai_service -C. -L. --nobreak --writepid -mCommon:Newbieland:Post
|
|
||||||
|
|
||||||
# mfs
|
|
||||||
screen -t mfs /bin/sh ../tools/scripts/linux/service_launcher.sh mfs $RYZOM_PATH/../build/bin/ryzom_mail_forum_service -C. -L. --nobreak --writepid
|
|
||||||
|
|
||||||
# su
|
|
||||||
screen -t su /bin/sh ../tools/scripts/linux/service_launcher.sh su $RYZOM_PATH/../build/bin/ryzom_shard_unifier_service -C. -L. --nobreak --writepid
|
|
||||||
|
|
||||||
# fes
|
|
||||||
screen -t fes /bin/sh ../tools/scripts/linux/service_launcher.sh fes $RYZOM_PATH/../build/bin/ryzom_frontend_service -C. -L. --nobreak --writepid
|
|
||||||
|
|
||||||
# sbs
|
|
||||||
screen -t sbs /bin/sh ../tools/scripts/linux/service_launcher.sh sbs $RYZOM_PATH/../build/bin/ryzom_session_browser_service -C. -L. --nobreak --writepid
|
|
||||||
|
|
||||||
# lgs
|
|
||||||
screen -t lgs /bin/sh ../tools/scripts/linux/service_launcher.sh lgs $RYZOM_PATH/../build/bin/ryzom_logger_service -C. -L. --nobreak --writepid
|
|
||||||
|
|
||||||
# mos
|
|
||||||
#screen -t mos /bin/sh ../tools/scripts/linux/service_launcher.sh mos $RYZOM_PATH/../build/bin/ryzom_monitor_service -C. -L. --nobreak --writepid
|
|
||||||
|
|
||||||
# pdss
|
|
||||||
#screen -t pdss /bin/sh ../tools/scripts/linux/service_launcher.sh pdss $RYZOM_PATH/../build/bin/ryzom_pd_support_service -C. -L. --nobreak --writepid
|
|
||||||
|
|
||||||
# ras
|
|
||||||
screen -t ras /bin/sh ../tools/scripts/linux/service_launcher.sh ras $RYZOM_PATH/../build/bin/ryzom_admin_service --fulladminname=admin_service --shortadminname=AS -C. -L. --nobreak --writepid
|
|
||||||
|
|
||||||
# switch back to AES screen
|
|
||||||
select 0
|
|
||||||
|
|
@ -1,50 +0,0 @@
|
|||||||
// Use with commandline: shard_unifier_service -C. -L. --nobreak --writepid
|
|
||||||
|
|
||||||
// ---- config local variables
|
|
||||||
|
|
||||||
SUGlobalPort = 50503;
|
|
||||||
|
|
||||||
#include "sql.cfg"
|
|
||||||
|
|
||||||
#include "shard_unifier_service_default.cfg"
|
|
||||||
|
|
||||||
// ---- service NeL variables (used by ConfigFile class)
|
|
||||||
|
|
||||||
AESAliasName= "su";
|
|
||||||
|
|
||||||
// Create a command executor
|
|
||||||
StartCommands +=
|
|
||||||
{
|
|
||||||
"moduleManager.createModule CommandExecutor ce",
|
|
||||||
"ce.plug gw",
|
|
||||||
};
|
|
||||||
|
|
||||||
GraphVars += { "TotalConcurentUser", "60000" };
|
|
||||||
GraphVars += { "NetSpeedLoop", "60000" };
|
|
||||||
GraphVars += { "L5CallbackCount", "60000" };
|
|
||||||
GraphVars += { "L5CallbackTime", "60000" };
|
|
||||||
|
|
||||||
Paths = {
|
|
||||||
".",
|
|
||||||
};
|
|
||||||
|
|
||||||
// ---- service NeL variables (used by CVariable class)
|
|
||||||
|
|
||||||
// ---- service custom variables (used by ConfigFile class)
|
|
||||||
|
|
||||||
// Use Shard Unifier or not
|
|
||||||
DontUseSU = 0;
|
|
||||||
|
|
||||||
HomeMainlandNames =
|
|
||||||
{
|
|
||||||
"302", "Open", "open",
|
|
||||||
};
|
|
||||||
|
|
||||||
// ---- service custom variables (used by CVariable class)
|
|
||||||
|
|
||||||
DomainName = "ryzom_open";
|
|
||||||
|
|
||||||
// The privileges needed to access any ring session
|
|
||||||
PrivilegeForSessionAccess = ":DEV:SGM:GM:SG:";
|
|
||||||
|
|
||||||
#include "backup_service_interface.cfg"
|
|
@ -1,33 +0,0 @@
|
|||||||
#include "common.cfg"
|
|
||||||
|
|
||||||
DontUseNS = 1;
|
|
||||||
|
|
||||||
StartCommands +=
|
|
||||||
{
|
|
||||||
// Create a gateway for global interconnection
|
|
||||||
// modules from different shard are visible to each other if they connect to
|
|
||||||
// this gateway. SU Local module have no interest to be plugged here.
|
|
||||||
"moduleManager.createModule StandardGateway glob_gw",
|
|
||||||
// add a layer 3 server transport
|
|
||||||
"glob_gw.transportAdd L3Server l3s",
|
|
||||||
// open the transport
|
|
||||||
"glob_gw.transportCmd l3s(open port="+SUGlobalPort+")",
|
|
||||||
// Create a session manager module
|
|
||||||
"moduleManager.createModule RingSessionManager rsm web(port=49999) ring_db(host="+DBHost+" user="+DBRingUser+" password="+DBRingPass+" base="+DBRingName+") nel_db(host="+DBHost+" user="+DBNelUser+" password="+DBNelPass+" base="+DBNelName+")",
|
|
||||||
"rsm.plug gw",
|
|
||||||
// Create a login service module
|
|
||||||
"moduleManager.createModule LoginService ls ring_db(host="+DBHost+" user="+DBRingUser+" password="+DBRingPass+" base="+DBRingName+") web(port=49998) nel_db(host="+DBHost+" user="+DBNelUser+" password="+DBNelPass+" base="+DBNelName+")",
|
|
||||||
"ls.plug gw",
|
|
||||||
// Create a character synchronization module
|
|
||||||
"moduleManager.createModule CharacterSynchronisation cs fake_edit_char ring_db(host="+DBHost+" user="+DBRingUser+" password="+DBRingPass+" base="+DBRingName+")",
|
|
||||||
"cs.plug gw",
|
|
||||||
// Create entity locator module
|
|
||||||
"moduleManager.createModule EntityLocator el ring_db(host="+DBHost+" user="+DBRingUser+" password="+DBRingPass+" base="+DBRingName+") nel_db(host="+DBHost+" user="+DBNelUser+" password="+DBNelPass+" base="+DBNelName+")",
|
|
||||||
"el.plug gw",
|
|
||||||
// Create a mail forum notifier forwarder
|
|
||||||
"moduleManager.createModule MailForumNotifierFwd mfnfwd ring_db(host="+DBHost+" user="+DBRingUser+" password="+DBRingPass+" base="+DBRingName+") web(port=49897)",
|
|
||||||
"mfnfwd.plug gw",
|
|
||||||
// Create a chat unifier server module
|
|
||||||
"moduleManager.createModule ChatUnifierServer cus ring_db(host="+DBHost+" user="+DBRingUser+" password="+DBRingPass+" base="+DBRingName+")",
|
|
||||||
"cus.plug gw",
|
|
||||||
};
|
|
@ -1,14 +0,0 @@
|
|||||||
DBHost = "localhost";
|
|
||||||
DBNelName = "nel";
|
|
||||||
DBRingName = "ring_open";
|
|
||||||
// Nel DB user
|
|
||||||
DBNelUser = "shard";
|
|
||||||
// Ring DB user
|
|
||||||
DBRingUser = "shard";
|
|
||||||
// SU - password to access to the nel database with DBNelUseruser (default is no password)
|
|
||||||
DBNelPass = "";
|
|
||||||
// SU - password to access to the ring database with DBRingUser (default is no password)
|
|
||||||
DBRingPass = "";
|
|
||||||
|
|
||||||
// MySQL wrapper strict mode - controls use of asserts if SQL requests fail
|
|
||||||
MSWStrictMode=0;
|
|
@ -1,52 +0,0 @@
|
|||||||
# Supporting modules and libraries.
|
|
||||||
# Need servershare for build packed collision tool
|
|
||||||
# Need aishare for build wmap tool
|
|
||||||
IF(WITH_RYZOM_TOOLS OR WITH_RYZOM_SERVER)
|
|
||||||
ADD_SUBDIRECTORY(server_share)
|
|
||||||
ADD_SUBDIRECTORY(ai_share)
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
IF(WITH_RYZOM_SERVER)
|
|
||||||
|
|
||||||
# Supporting modules and libraries.
|
|
||||||
ADD_SUBDIRECTORY(admin_modules)
|
|
||||||
ADD_SUBDIRECTORY(gameplay_module_lib)
|
|
||||||
ADD_SUBDIRECTORY(pd_lib)
|
|
||||||
|
|
||||||
# Ryzom Services
|
|
||||||
ADD_SUBDIRECTORY(ai_service)
|
|
||||||
ADD_SUBDIRECTORY(backup_service)
|
|
||||||
ADD_SUBDIRECTORY(dynamic_scenario_service)
|
|
||||||
ADD_SUBDIRECTORY(entities_game_service)
|
|
||||||
ADD_SUBDIRECTORY(frontend_service)
|
|
||||||
ADD_SUBDIRECTORY(gpm_service)
|
|
||||||
ADD_SUBDIRECTORY(input_output_service)
|
|
||||||
ADD_SUBDIRECTORY(ryzom_admin_service)
|
|
||||||
ADD_SUBDIRECTORY(ryzom_naming_service)
|
|
||||||
ADD_SUBDIRECTORY(ryzom_welcome_service)
|
|
||||||
ADD_SUBDIRECTORY(log_analyser_service)
|
|
||||||
ADD_SUBDIRECTORY(logger_service)
|
|
||||||
ADD_SUBDIRECTORY(mail_forum_service)
|
|
||||||
ADD_SUBDIRECTORY(mirror_service)
|
|
||||||
ADD_SUBDIRECTORY(monitor_service)
|
|
||||||
ADD_SUBDIRECTORY(pd_reference_builder)
|
|
||||||
ADD_SUBDIRECTORY(pd_support_service)
|
|
||||||
ADD_SUBDIRECTORY(persistant_data_service)
|
|
||||||
ADD_SUBDIRECTORY(session_browser_server)
|
|
||||||
ADD_SUBDIRECTORY(shard_unifier_service)
|
|
||||||
ADD_SUBDIRECTORY(tick_service)
|
|
||||||
ADD_SUBDIRECTORY(patchman_service)
|
|
||||||
|
|
||||||
|
|
||||||
# Deprecated, no longer used.
|
|
||||||
#ADD_SUBDIRECTORY(ags_test)
|
|
||||||
#ADD_SUBDIRECTORY(ai_data_service)
|
|
||||||
#ADD_SUBDIRECTORY(entity_view_service)
|
|
||||||
ADD_SUBDIRECTORY(general_utilities_service)
|
|
||||||
|
|
||||||
# Not sure, no longer used maybe?
|
|
||||||
#sabrina
|
|
||||||
#simulation_service
|
|
||||||
#testing_tool_service
|
|
||||||
|
|
||||||
ENDIF()
|
|
@ -1,19 +0,0 @@
|
|||||||
FILE(GLOB SRC *.cpp *.h)
|
|
||||||
|
|
||||||
NL_TARGET_LIB(ryzom_adminmodules ${SRC})
|
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
|
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES(ryzom_adminmodules nelmisc nelnet)
|
|
||||||
NL_DEFAULT_PROPS(ryzom_adminmodules "Ryzom, Library: Service Admin Modules")
|
|
||||||
NL_ADD_RUNTIME_FLAGS(ryzom_adminmodules)
|
|
||||||
NL_ADD_LIB_SUFFIX(ryzom_adminmodules)
|
|
||||||
|
|
||||||
IF(WITH_PCH)
|
|
||||||
ADD_NATIVE_PRECOMPILED_HEADER(ryzom_adminmodules ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.h ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.cpp)
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
|
|
||||||
INSTALL(TARGETS ryzom_adminmodules LIBRARY DESTINATION ${RYZOM_LIB_PREFIX} ARCHIVE DESTINATION ${RYZOM_LIB_PREFIX} COMPONENT libraries)
|
|
||||||
ENDIF()
|
|
||||||
|
|
@ -1,40 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
/** This file declare a pure nel module library */
|
|
||||||
|
|
||||||
|
|
||||||
#include "nel/net/module_manager.h"
|
|
||||||
#include "nel/net/module.h"
|
|
||||||
#include "nel/net/module_builder_parts.h"
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
using namespace NLMISC;
|
|
||||||
using namespace NLNET;
|
|
||||||
|
|
||||||
extern void as_forceLink();
|
|
||||||
extern void aes_forceLink();
|
|
||||||
extern void aesclient_forceLink();
|
|
||||||
|
|
||||||
void admin_modules_forceLink()
|
|
||||||
{
|
|
||||||
as_forceLink();
|
|
||||||
aes_forceLink();
|
|
||||||
aesclient_forceLink();
|
|
||||||
}
|
|
||||||
|
|
||||||
//NLMISC_DECL_PURE_LIB(CNelModuleLibrary);
|
|
||||||
|
|
@ -1,731 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
|
||||||
// WARNING : this is a generated file, don't change it !
|
|
||||||
/////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#include "stdpch.h"
|
|
||||||
#include "admin_modules_itf.h"
|
|
||||||
|
|
||||||
namespace ADMIN
|
|
||||||
{
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
|
||||||
// WARNING : this is a generated file, don't change it !
|
|
||||||
/////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
const CAdminServiceSkel::TMessageHandlerMap &CAdminServiceSkel::getMessageHandlers() const
|
|
||||||
{
|
|
||||||
static TMessageHandlerMap handlers;
|
|
||||||
static bool init = false;
|
|
||||||
|
|
||||||
if (!init)
|
|
||||||
{
|
|
||||||
std::pair < TMessageHandlerMap::iterator, bool > res;
|
|
||||||
|
|
||||||
res = handlers.insert(std::make_pair(std::string("USU"), &CAdminServiceSkel::upServiceUpdate_skel));
|
|
||||||
// if this assert, you have a doubly message name in your interface definition !
|
|
||||||
nlassert(res.second);
|
|
||||||
|
|
||||||
res = handlers.insert(std::make_pair(std::string("GU"), &CAdminServiceSkel::graphUpdate_skel));
|
|
||||||
// if this assert, you have a doubly message name in your interface definition !
|
|
||||||
nlassert(res.second);
|
|
||||||
|
|
||||||
res = handlers.insert(std::make_pair(std::string("HRGU"), &CAdminServiceSkel::highRezGraphUpdate_skel));
|
|
||||||
// if this assert, you have a doubly message name in your interface definition !
|
|
||||||
nlassert(res.second);
|
|
||||||
|
|
||||||
res = handlers.insert(std::make_pair(std::string("CR"), &CAdminServiceSkel::commandResult_skel));
|
|
||||||
// if this assert, you have a doubly message name in your interface definition !
|
|
||||||
nlassert(res.second);
|
|
||||||
|
|
||||||
init = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
bool CAdminServiceSkel::fwdOnProcessModuleMessage(NLNET::IModuleProxy *sender, const NLNET::CMessage &message)
|
|
||||||
{
|
|
||||||
const TMessageHandlerMap &mh = getMessageHandlers();
|
|
||||||
|
|
||||||
TMessageHandlerMap::const_iterator it(mh.find(message.getName()));
|
|
||||||
|
|
||||||
if (it == mh.end())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
TMessageHandler cmd = it->second;
|
|
||||||
(this->*cmd)(sender, message);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void CAdminServiceSkel::upServiceUpdate_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message)
|
|
||||||
{
|
|
||||||
H_AUTO(CAdminServiceSkel_upServiceUpdate_USU);
|
|
||||||
std::vector < TServiceStatus > serviceStatus;
|
|
||||||
nlRead(__message, serialCont, serviceStatus);
|
|
||||||
upServiceUpdate(sender, serviceStatus);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CAdminServiceSkel::graphUpdate_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message)
|
|
||||||
{
|
|
||||||
H_AUTO(CAdminServiceSkel_graphUpdate_GU);
|
|
||||||
TGraphDatas graphDatas;
|
|
||||||
nlRead(__message, serial, graphDatas);
|
|
||||||
graphUpdate(sender, graphDatas);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CAdminServiceSkel::highRezGraphUpdate_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message)
|
|
||||||
{
|
|
||||||
H_AUTO(CAdminServiceSkel_highRezGraphUpdate_HRGU);
|
|
||||||
THighRezDatas graphDatas;
|
|
||||||
nlRead(__message, serial, graphDatas);
|
|
||||||
highRezGraphUpdate(sender, graphDatas);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CAdminServiceSkel::commandResult_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message)
|
|
||||||
{
|
|
||||||
H_AUTO(CAdminServiceSkel_commandResult_CR);
|
|
||||||
uint32 commandId;
|
|
||||||
nlRead(__message, serial, commandId);
|
|
||||||
std::string serviceAlias;
|
|
||||||
nlRead(__message, serial, serviceAlias);
|
|
||||||
std::string result;
|
|
||||||
nlRead(__message, serial, result);
|
|
||||||
commandResult(sender, commandId, serviceAlias, result);
|
|
||||||
}
|
|
||||||
// An AES send an update of the list of service up
|
|
||||||
void CAdminServiceProxy::upServiceUpdate(NLNET::IModule *sender, const std::vector < TServiceStatus > &serviceStatus)
|
|
||||||
{
|
|
||||||
if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported())
|
|
||||||
{
|
|
||||||
// immediate local synchronous dispatching
|
|
||||||
_LocalModuleSkel->upServiceUpdate(_ModuleProxy->getModuleGateway()->getPluggedModuleProxy(sender), serviceStatus);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// send the message for remote dispatching and execution or local queing
|
|
||||||
NLNET::CMessage __message;
|
|
||||||
|
|
||||||
buildMessageFor_upServiceUpdate(__message, serviceStatus);
|
|
||||||
|
|
||||||
_ModuleProxy->sendModuleMessage(sender, __message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// An AES send graph data update
|
|
||||||
void CAdminServiceProxy::graphUpdate(NLNET::IModule *sender, const TGraphDatas &graphDatas)
|
|
||||||
{
|
|
||||||
if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported())
|
|
||||||
{
|
|
||||||
// immediate local synchronous dispatching
|
|
||||||
_LocalModuleSkel->graphUpdate(_ModuleProxy->getModuleGateway()->getPluggedModuleProxy(sender), graphDatas);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// send the message for remote dispatching and execution or local queing
|
|
||||||
NLNET::CMessage __message;
|
|
||||||
|
|
||||||
buildMessageFor_graphUpdate(__message, graphDatas);
|
|
||||||
|
|
||||||
_ModuleProxy->sendModuleMessage(sender, __message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// An AES send high rez graph data update
|
|
||||||
void CAdminServiceProxy::highRezGraphUpdate(NLNET::IModule *sender, const THighRezDatas &graphDatas)
|
|
||||||
{
|
|
||||||
if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported())
|
|
||||||
{
|
|
||||||
// immediate local synchronous dispatching
|
|
||||||
_LocalModuleSkel->highRezGraphUpdate(_ModuleProxy->getModuleGateway()->getPluggedModuleProxy(sender), graphDatas);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// send the message for remote dispatching and execution or local queing
|
|
||||||
NLNET::CMessage __message;
|
|
||||||
|
|
||||||
buildMessageFor_highRezGraphUpdate(__message, graphDatas);
|
|
||||||
|
|
||||||
_ModuleProxy->sendModuleMessage(sender, __message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// AES send back the result of execution of a command
|
|
||||||
void CAdminServiceProxy::commandResult(NLNET::IModule *sender, uint32 commandId, const std::string &serviceAlias, const std::string &result)
|
|
||||||
{
|
|
||||||
if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported())
|
|
||||||
{
|
|
||||||
// immediate local synchronous dispatching
|
|
||||||
_LocalModuleSkel->commandResult(_ModuleProxy->getModuleGateway()->getPluggedModuleProxy(sender), commandId, serviceAlias, result);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// send the message for remote dispatching and execution or local queing
|
|
||||||
NLNET::CMessage __message;
|
|
||||||
|
|
||||||
buildMessageFor_commandResult(__message, commandId, serviceAlias, result);
|
|
||||||
|
|
||||||
_ModuleProxy->sendModuleMessage(sender, __message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Message serializer. Return the message received in reference for easier integration
|
|
||||||
const NLNET::CMessage &CAdminServiceProxy::buildMessageFor_upServiceUpdate(NLNET::CMessage &__message, const std::vector < TServiceStatus > &serviceStatus)
|
|
||||||
{
|
|
||||||
__message.setType("USU");
|
|
||||||
nlWrite(__message, serialCont, const_cast < std::vector < TServiceStatus >& > (serviceStatus));
|
|
||||||
|
|
||||||
|
|
||||||
return __message;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Message serializer. Return the message received in reference for easier integration
|
|
||||||
const NLNET::CMessage &CAdminServiceProxy::buildMessageFor_graphUpdate(NLNET::CMessage &__message, const TGraphDatas &graphDatas)
|
|
||||||
{
|
|
||||||
__message.setType("GU");
|
|
||||||
nlWrite(__message, serial, const_cast < TGraphDatas& > (graphDatas));
|
|
||||||
|
|
||||||
|
|
||||||
return __message;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Message serializer. Return the message received in reference for easier integration
|
|
||||||
const NLNET::CMessage &CAdminServiceProxy::buildMessageFor_highRezGraphUpdate(NLNET::CMessage &__message, const THighRezDatas &graphDatas)
|
|
||||||
{
|
|
||||||
__message.setType("HRGU");
|
|
||||||
nlWrite(__message, serial, const_cast < THighRezDatas& > (graphDatas));
|
|
||||||
|
|
||||||
|
|
||||||
return __message;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Message serializer. Return the message received in reference for easier integration
|
|
||||||
const NLNET::CMessage &CAdminServiceProxy::buildMessageFor_commandResult(NLNET::CMessage &__message, uint32 commandId, const std::string &serviceAlias, const std::string &result)
|
|
||||||
{
|
|
||||||
__message.setType("CR");
|
|
||||||
nlWrite(__message, serial, commandId);
|
|
||||||
nlWrite(__message, serial, const_cast < std::string& > (serviceAlias));
|
|
||||||
nlWrite(__message, serial, const_cast < std::string& > (result));
|
|
||||||
|
|
||||||
|
|
||||||
return __message;
|
|
||||||
}
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
|
||||||
// WARNING : this is a generated file, don't change it !
|
|
||||||
/////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
const CAdminExecutorServiceSkel::TMessageHandlerMap &CAdminExecutorServiceSkel::getMessageHandlers() const
|
|
||||||
{
|
|
||||||
static TMessageHandlerMap handlers;
|
|
||||||
static bool init = false;
|
|
||||||
|
|
||||||
if (!init)
|
|
||||||
{
|
|
||||||
std::pair < TMessageHandlerMap::iterator, bool > res;
|
|
||||||
|
|
||||||
res = handlers.insert(std::make_pair(std::string("SCO"), &CAdminExecutorServiceSkel::setShardOrders_skel));
|
|
||||||
// if this assert, you have a doubly message name in your interface definition !
|
|
||||||
nlassert(res.second);
|
|
||||||
|
|
||||||
res = handlers.insert(std::make_pair(std::string("SDS"), &CAdminExecutorServiceSkel::shutdownShard_skel));
|
|
||||||
// if this assert, you have a doubly message name in your interface definition !
|
|
||||||
nlassert(res.second);
|
|
||||||
|
|
||||||
res = handlers.insert(std::make_pair(std::string("CC"), &CAdminExecutorServiceSkel::controlCmd_skel));
|
|
||||||
// if this assert, you have a doubly message name in your interface definition !
|
|
||||||
nlassert(res.second);
|
|
||||||
|
|
||||||
res = handlers.insert(std::make_pair(std::string("SCMD"), &CAdminExecutorServiceSkel::serviceCmd_skel));
|
|
||||||
// if this assert, you have a doubly message name in your interface definition !
|
|
||||||
nlassert(res.second);
|
|
||||||
|
|
||||||
res = handlers.insert(std::make_pair(std::string("CR"), &CAdminExecutorServiceSkel::commandResult_skel));
|
|
||||||
// if this assert, you have a doubly message name in your interface definition !
|
|
||||||
nlassert(res.second);
|
|
||||||
|
|
||||||
res = handlers.insert(std::make_pair(std::string("GU"), &CAdminExecutorServiceSkel::graphUpdate_skel));
|
|
||||||
// if this assert, you have a doubly message name in your interface definition !
|
|
||||||
nlassert(res.second);
|
|
||||||
|
|
||||||
res = handlers.insert(std::make_pair(std::string("HRGU"), &CAdminExecutorServiceSkel::highRezGraphUpdate_skel));
|
|
||||||
// if this assert, you have a doubly message name in your interface definition !
|
|
||||||
nlassert(res.second);
|
|
||||||
|
|
||||||
res = handlers.insert(std::make_pair(std::string("SSU"), &CAdminExecutorServiceSkel::serviceStatusUpdate_skel));
|
|
||||||
// if this assert, you have a doubly message name in your interface definition !
|
|
||||||
nlassert(res.second);
|
|
||||||
|
|
||||||
init = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
bool CAdminExecutorServiceSkel::fwdOnProcessModuleMessage(NLNET::IModuleProxy *sender, const NLNET::CMessage &message)
|
|
||||||
{
|
|
||||||
const TMessageHandlerMap &mh = getMessageHandlers();
|
|
||||||
|
|
||||||
TMessageHandlerMap::const_iterator it(mh.find(message.getName()));
|
|
||||||
|
|
||||||
if (it == mh.end())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
TMessageHandler cmd = it->second;
|
|
||||||
(this->*cmd)(sender, message);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void CAdminExecutorServiceSkel::setShardOrders_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message)
|
|
||||||
{
|
|
||||||
H_AUTO(CAdminExecutorServiceSkel_setShardOrders_SCO);
|
|
||||||
std::string shardName;
|
|
||||||
nlRead(__message, serial, shardName);
|
|
||||||
TShardOrders shardOrders;
|
|
||||||
nlRead(__message, serial, shardOrders);
|
|
||||||
setShardOrders(sender, shardName, shardOrders);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CAdminExecutorServiceSkel::shutdownShard_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message)
|
|
||||||
{
|
|
||||||
H_AUTO(CAdminExecutorServiceSkel_shutdownShard_SDS);
|
|
||||||
std::string shardName;
|
|
||||||
nlRead(__message, serial, shardName);
|
|
||||||
uint32 delay;
|
|
||||||
nlRead(__message, serial, delay);
|
|
||||||
shutdownShard(sender, shardName, delay);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CAdminExecutorServiceSkel::controlCmd_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message)
|
|
||||||
{
|
|
||||||
H_AUTO(CAdminExecutorServiceSkel_controlCmd_CC);
|
|
||||||
uint32 commandId;
|
|
||||||
nlRead(__message, serial, commandId);
|
|
||||||
std::string serviceAlias;
|
|
||||||
nlRead(__message, serial, serviceAlias);
|
|
||||||
std::string command;
|
|
||||||
nlRead(__message, serial, command);
|
|
||||||
controlCmd(sender, commandId, serviceAlias, command);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CAdminExecutorServiceSkel::serviceCmd_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message)
|
|
||||||
{
|
|
||||||
H_AUTO(CAdminExecutorServiceSkel_serviceCmd_SCMD);
|
|
||||||
uint32 commandId;
|
|
||||||
nlRead(__message, serial, commandId);
|
|
||||||
std::string serviceAlias;
|
|
||||||
nlRead(__message, serial, serviceAlias);
|
|
||||||
std::string command;
|
|
||||||
nlRead(__message, serial, command);
|
|
||||||
serviceCmd(sender, commandId, serviceAlias, command);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CAdminExecutorServiceSkel::commandResult_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message)
|
|
||||||
{
|
|
||||||
H_AUTO(CAdminExecutorServiceSkel_commandResult_CR);
|
|
||||||
uint32 commandId;
|
|
||||||
nlRead(__message, serial, commandId);
|
|
||||||
std::string serviceAlias;
|
|
||||||
nlRead(__message, serial, serviceAlias);
|
|
||||||
std::string result;
|
|
||||||
nlRead(__message, serial, result);
|
|
||||||
commandResult(sender, commandId, serviceAlias, result);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CAdminExecutorServiceSkel::graphUpdate_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message)
|
|
||||||
{
|
|
||||||
H_AUTO(CAdminExecutorServiceSkel_graphUpdate_GU);
|
|
||||||
TGraphDatas graphDatas;
|
|
||||||
nlRead(__message, serial, graphDatas);
|
|
||||||
graphUpdate(sender, graphDatas);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CAdminExecutorServiceSkel::highRezGraphUpdate_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message)
|
|
||||||
{
|
|
||||||
H_AUTO(CAdminExecutorServiceSkel_highRezGraphUpdate_HRGU);
|
|
||||||
THighRezDatas graphDatas;
|
|
||||||
nlRead(__message, serial, graphDatas);
|
|
||||||
highRezGraphUpdate(sender, graphDatas);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CAdminExecutorServiceSkel::serviceStatusUpdate_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message)
|
|
||||||
{
|
|
||||||
H_AUTO(CAdminExecutorServiceSkel_serviceStatusUpdate_SSU);
|
|
||||||
std::string status;
|
|
||||||
nlRead(__message, serial, status);
|
|
||||||
serviceStatusUpdate(sender, status);
|
|
||||||
}
|
|
||||||
// AS send orders for a shard
|
|
||||||
void CAdminExecutorServiceProxy::setShardOrders(NLNET::IModule *sender, const std::string &shardName, const TShardOrders &shardOrders)
|
|
||||||
{
|
|
||||||
if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported())
|
|
||||||
{
|
|
||||||
// immediate local synchronous dispatching
|
|
||||||
_LocalModuleSkel->setShardOrders(_ModuleProxy->getModuleGateway()->getPluggedModuleProxy(sender), shardName, shardOrders);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// send the message for remote dispatching and execution or local queing
|
|
||||||
NLNET::CMessage __message;
|
|
||||||
|
|
||||||
buildMessageFor_setShardOrders(__message, shardName, shardOrders);
|
|
||||||
|
|
||||||
_ModuleProxy->sendModuleMessage(sender, __message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// AS send a command to shutdown a shard with a delay
|
|
||||||
void CAdminExecutorServiceProxy::shutdownShard(NLNET::IModule *sender, const std::string &shardName, uint32 delay)
|
|
||||||
{
|
|
||||||
if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported())
|
|
||||||
{
|
|
||||||
// immediate local synchronous dispatching
|
|
||||||
_LocalModuleSkel->shutdownShard(_ModuleProxy->getModuleGateway()->getPluggedModuleProxy(sender), shardName, delay);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// send the message for remote dispatching and execution or local queing
|
|
||||||
NLNET::CMessage __message;
|
|
||||||
|
|
||||||
buildMessageFor_shutdownShard(__message, shardName, delay);
|
|
||||||
|
|
||||||
_ModuleProxy->sendModuleMessage(sender, __message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// AS send a control command to this AES
|
|
||||||
void CAdminExecutorServiceProxy::controlCmd(NLNET::IModule *sender, uint32 commandId, const std::string &serviceAlias, const std::string &command)
|
|
||||||
{
|
|
||||||
if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported())
|
|
||||||
{
|
|
||||||
// immediate local synchronous dispatching
|
|
||||||
_LocalModuleSkel->controlCmd(_ModuleProxy->getModuleGateway()->getPluggedModuleProxy(sender), commandId, serviceAlias, command);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// send the message for remote dispatching and execution or local queing
|
|
||||||
NLNET::CMessage __message;
|
|
||||||
|
|
||||||
buildMessageFor_controlCmd(__message, commandId, serviceAlias, command);
|
|
||||||
|
|
||||||
_ModuleProxy->sendModuleMessage(sender, __message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Send a command to a service.
|
|
||||||
void CAdminExecutorServiceProxy::serviceCmd(NLNET::IModule *sender, uint32 commandId, const std::string &serviceAlias, const std::string &command)
|
|
||||||
{
|
|
||||||
if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported())
|
|
||||||
{
|
|
||||||
// immediate local synchronous dispatching
|
|
||||||
_LocalModuleSkel->serviceCmd(_ModuleProxy->getModuleGateway()->getPluggedModuleProxy(sender), commandId, serviceAlias, command);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// send the message for remote dispatching and execution or local queing
|
|
||||||
NLNET::CMessage __message;
|
|
||||||
|
|
||||||
buildMessageFor_serviceCmd(__message, commandId, serviceAlias, command);
|
|
||||||
|
|
||||||
_ModuleProxy->sendModuleMessage(sender, __message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// AES client send back the result of execution of a command
|
|
||||||
void CAdminExecutorServiceProxy::commandResult(NLNET::IModule *sender, uint32 commandId, const std::string &serviceAlias, const std::string &result)
|
|
||||||
{
|
|
||||||
if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported())
|
|
||||||
{
|
|
||||||
// immediate local synchronous dispatching
|
|
||||||
_LocalModuleSkel->commandResult(_ModuleProxy->getModuleGateway()->getPluggedModuleProxy(sender), commandId, serviceAlias, result);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// send the message for remote dispatching and execution or local queing
|
|
||||||
NLNET::CMessage __message;
|
|
||||||
|
|
||||||
buildMessageFor_commandResult(__message, commandId, serviceAlias, result);
|
|
||||||
|
|
||||||
_ModuleProxy->sendModuleMessage(sender, __message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// A service send graph data update
|
|
||||||
void CAdminExecutorServiceProxy::graphUpdate(NLNET::IModule *sender, const TGraphDatas &graphDatas)
|
|
||||||
{
|
|
||||||
if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported())
|
|
||||||
{
|
|
||||||
// immediate local synchronous dispatching
|
|
||||||
_LocalModuleSkel->graphUpdate(_ModuleProxy->getModuleGateway()->getPluggedModuleProxy(sender), graphDatas);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// send the message for remote dispatching and execution or local queing
|
|
||||||
NLNET::CMessage __message;
|
|
||||||
|
|
||||||
buildMessageFor_graphUpdate(__message, graphDatas);
|
|
||||||
|
|
||||||
_ModuleProxy->sendModuleMessage(sender, __message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// A service high rez graph data update
|
|
||||||
void CAdminExecutorServiceProxy::highRezGraphUpdate(NLNET::IModule *sender, const THighRezDatas &graphDatas)
|
|
||||||
{
|
|
||||||
if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported())
|
|
||||||
{
|
|
||||||
// immediate local synchronous dispatching
|
|
||||||
_LocalModuleSkel->highRezGraphUpdate(_ModuleProxy->getModuleGateway()->getPluggedModuleProxy(sender), graphDatas);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// send the message for remote dispatching and execution or local queing
|
|
||||||
NLNET::CMessage __message;
|
|
||||||
|
|
||||||
buildMessageFor_highRezGraphUpdate(__message, graphDatas);
|
|
||||||
|
|
||||||
_ModuleProxy->sendModuleMessage(sender, __message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// A service send an update of of it's status string
|
|
||||||
void CAdminExecutorServiceProxy::serviceStatusUpdate(NLNET::IModule *sender, const std::string &status)
|
|
||||||
{
|
|
||||||
if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported())
|
|
||||||
{
|
|
||||||
// immediate local synchronous dispatching
|
|
||||||
_LocalModuleSkel->serviceStatusUpdate(_ModuleProxy->getModuleGateway()->getPluggedModuleProxy(sender), status);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// send the message for remote dispatching and execution or local queing
|
|
||||||
NLNET::CMessage __message;
|
|
||||||
|
|
||||||
buildMessageFor_serviceStatusUpdate(__message, status);
|
|
||||||
|
|
||||||
_ModuleProxy->sendModuleMessage(sender, __message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Message serializer. Return the message received in reference for easier integration
|
|
||||||
const NLNET::CMessage &CAdminExecutorServiceProxy::buildMessageFor_setShardOrders(NLNET::CMessage &__message, const std::string &shardName, const TShardOrders &shardOrders)
|
|
||||||
{
|
|
||||||
__message.setType("SCO");
|
|
||||||
nlWrite(__message, serial, const_cast < std::string& > (shardName));
|
|
||||||
nlWrite(__message, serial, shardOrders);
|
|
||||||
|
|
||||||
|
|
||||||
return __message;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Message serializer. Return the message received in reference for easier integration
|
|
||||||
const NLNET::CMessage &CAdminExecutorServiceProxy::buildMessageFor_shutdownShard(NLNET::CMessage &__message, const std::string &shardName, uint32 delay)
|
|
||||||
{
|
|
||||||
__message.setType("SDS");
|
|
||||||
nlWrite(__message, serial, const_cast < std::string& > (shardName));
|
|
||||||
nlWrite(__message, serial, delay);
|
|
||||||
|
|
||||||
|
|
||||||
return __message;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Message serializer. Return the message received in reference for easier integration
|
|
||||||
const NLNET::CMessage &CAdminExecutorServiceProxy::buildMessageFor_controlCmd(NLNET::CMessage &__message, uint32 commandId, const std::string &serviceAlias, const std::string &command)
|
|
||||||
{
|
|
||||||
__message.setType("CC");
|
|
||||||
nlWrite(__message, serial, commandId);
|
|
||||||
nlWrite(__message, serial, const_cast < std::string& > (serviceAlias));
|
|
||||||
nlWrite(__message, serial, const_cast < std::string& > (command));
|
|
||||||
|
|
||||||
|
|
||||||
return __message;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Message serializer. Return the message received in reference for easier integration
|
|
||||||
const NLNET::CMessage &CAdminExecutorServiceProxy::buildMessageFor_serviceCmd(NLNET::CMessage &__message, uint32 commandId, const std::string &serviceAlias, const std::string &command)
|
|
||||||
{
|
|
||||||
__message.setType("SCMD");
|
|
||||||
nlWrite(__message, serial, commandId);
|
|
||||||
nlWrite(__message, serial, const_cast < std::string& > (serviceAlias));
|
|
||||||
nlWrite(__message, serial, const_cast < std::string& > (command));
|
|
||||||
|
|
||||||
|
|
||||||
return __message;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Message serializer. Return the message received in reference for easier integration
|
|
||||||
const NLNET::CMessage &CAdminExecutorServiceProxy::buildMessageFor_commandResult(NLNET::CMessage &__message, uint32 commandId, const std::string &serviceAlias, const std::string &result)
|
|
||||||
{
|
|
||||||
__message.setType("CR");
|
|
||||||
nlWrite(__message, serial, commandId);
|
|
||||||
nlWrite(__message, serial, const_cast < std::string& > (serviceAlias));
|
|
||||||
nlWrite(__message, serial, const_cast < std::string& > (result));
|
|
||||||
|
|
||||||
|
|
||||||
return __message;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Message serializer. Return the message received in reference for easier integration
|
|
||||||
const NLNET::CMessage &CAdminExecutorServiceProxy::buildMessageFor_graphUpdate(NLNET::CMessage &__message, const TGraphDatas &graphDatas)
|
|
||||||
{
|
|
||||||
__message.setType("GU");
|
|
||||||
nlWrite(__message, serial, const_cast < TGraphDatas& > (graphDatas));
|
|
||||||
|
|
||||||
|
|
||||||
return __message;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Message serializer. Return the message received in reference for easier integration
|
|
||||||
const NLNET::CMessage &CAdminExecutorServiceProxy::buildMessageFor_highRezGraphUpdate(NLNET::CMessage &__message, const THighRezDatas &graphDatas)
|
|
||||||
{
|
|
||||||
__message.setType("HRGU");
|
|
||||||
nlWrite(__message, serial, const_cast < THighRezDatas& > (graphDatas));
|
|
||||||
|
|
||||||
|
|
||||||
return __message;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Message serializer. Return the message received in reference for easier integration
|
|
||||||
const NLNET::CMessage &CAdminExecutorServiceProxy::buildMessageFor_serviceStatusUpdate(NLNET::CMessage &__message, const std::string &status)
|
|
||||||
{
|
|
||||||
__message.setType("SSU");
|
|
||||||
nlWrite(__message, serial, const_cast < std::string& > (status));
|
|
||||||
|
|
||||||
|
|
||||||
return __message;
|
|
||||||
}
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
|
||||||
// WARNING : this is a generated file, don't change it !
|
|
||||||
/////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
const CAdminExecutorServiceClientSkel::TMessageHandlerMap &CAdminExecutorServiceClientSkel::getMessageHandlers() const
|
|
||||||
{
|
|
||||||
static TMessageHandlerMap handlers;
|
|
||||||
static bool init = false;
|
|
||||||
|
|
||||||
if (!init)
|
|
||||||
{
|
|
||||||
std::pair < TMessageHandlerMap::iterator, bool > res;
|
|
||||||
|
|
||||||
res = handlers.insert(std::make_pair(std::string("SCMD"), &CAdminExecutorServiceClientSkel::serviceCmd_skel));
|
|
||||||
// if this assert, you have a doubly message name in your interface definition !
|
|
||||||
nlassert(res.second);
|
|
||||||
|
|
||||||
res = handlers.insert(std::make_pair(std::string("SCMDNR"), &CAdminExecutorServiceClientSkel::serviceCmdNoReturn_skel));
|
|
||||||
// if this assert, you have a doubly message name in your interface definition !
|
|
||||||
nlassert(res.second);
|
|
||||||
|
|
||||||
init = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
bool CAdminExecutorServiceClientSkel::fwdOnProcessModuleMessage(NLNET::IModuleProxy *sender, const NLNET::CMessage &message)
|
|
||||||
{
|
|
||||||
const TMessageHandlerMap &mh = getMessageHandlers();
|
|
||||||
|
|
||||||
TMessageHandlerMap::const_iterator it(mh.find(message.getName()));
|
|
||||||
|
|
||||||
if (it == mh.end())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
TMessageHandler cmd = it->second;
|
|
||||||
(this->*cmd)(sender, message);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void CAdminExecutorServiceClientSkel::serviceCmd_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message)
|
|
||||||
{
|
|
||||||
H_AUTO(CAdminExecutorServiceClientSkel_serviceCmd_SCMD);
|
|
||||||
uint32 commandId;
|
|
||||||
nlRead(__message, serial, commandId);
|
|
||||||
std::string command;
|
|
||||||
nlRead(__message, serial, command);
|
|
||||||
serviceCmd(sender, commandId, command);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CAdminExecutorServiceClientSkel::serviceCmdNoReturn_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message)
|
|
||||||
{
|
|
||||||
H_AUTO(CAdminExecutorServiceClientSkel_serviceCmdNoReturn_SCMDNR);
|
|
||||||
std::string command;
|
|
||||||
nlRead(__message, serial, command);
|
|
||||||
serviceCmdNoReturn(sender, command);
|
|
||||||
}
|
|
||||||
// execute a command and return the result.
|
|
||||||
void CAdminExecutorServiceClientProxy::serviceCmd(NLNET::IModule *sender, uint32 commandId, const std::string &command)
|
|
||||||
{
|
|
||||||
if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported())
|
|
||||||
{
|
|
||||||
// immediate local synchronous dispatching
|
|
||||||
_LocalModuleSkel->serviceCmd(_ModuleProxy->getModuleGateway()->getPluggedModuleProxy(sender), commandId, command);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// send the message for remote dispatching and execution or local queing
|
|
||||||
NLNET::CMessage __message;
|
|
||||||
|
|
||||||
buildMessageFor_serviceCmd(__message, commandId, command);
|
|
||||||
|
|
||||||
_ModuleProxy->sendModuleMessage(sender, __message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Send a command to a service without waiting for the return value.
|
|
||||||
void CAdminExecutorServiceClientProxy::serviceCmdNoReturn(NLNET::IModule *sender, const std::string &command)
|
|
||||||
{
|
|
||||||
if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported())
|
|
||||||
{
|
|
||||||
// immediate local synchronous dispatching
|
|
||||||
_LocalModuleSkel->serviceCmdNoReturn(_ModuleProxy->getModuleGateway()->getPluggedModuleProxy(sender), command);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// send the message for remote dispatching and execution or local queing
|
|
||||||
NLNET::CMessage __message;
|
|
||||||
|
|
||||||
buildMessageFor_serviceCmdNoReturn(__message, command);
|
|
||||||
|
|
||||||
_ModuleProxy->sendModuleMessage(sender, __message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Message serializer. Return the message received in reference for easier integration
|
|
||||||
const NLNET::CMessage &CAdminExecutorServiceClientProxy::buildMessageFor_serviceCmd(NLNET::CMessage &__message, uint32 commandId, const std::string &command)
|
|
||||||
{
|
|
||||||
__message.setType("SCMD");
|
|
||||||
nlWrite(__message, serial, commandId);
|
|
||||||
nlWrite(__message, serial, const_cast < std::string& > (command));
|
|
||||||
|
|
||||||
|
|
||||||
return __message;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Message serializer. Return the message received in reference for easier integration
|
|
||||||
const NLNET::CMessage &CAdminExecutorServiceClientProxy::buildMessageFor_serviceCmdNoReturn(NLNET::CMessage &__message, const std::string &command)
|
|
||||||
{
|
|
||||||
__message.setType("SCMDNR");
|
|
||||||
nlWrite(__message, serial, const_cast < std::string& > (command));
|
|
||||||
|
|
||||||
|
|
||||||
return __message;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
@ -1,417 +0,0 @@
|
|||||||
<generator header_tag="ADMIN_MODULES_ITF">
|
|
||||||
|
|
||||||
<include file="nel/misc/time_nl.h"/>
|
|
||||||
|
|
||||||
<namespace name="ADMIN">
|
|
||||||
|
|
||||||
<!-- PHP interface of the admin service module-->
|
|
||||||
<!-- ############################################################## -->
|
|
||||||
<callback_interface name="CAdminServiceWeb" caller="php">
|
|
||||||
<doc line="This is the interface used by PHP to call methods"/>
|
|
||||||
<doc line="on the Admin service module"/>
|
|
||||||
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<!-- globalCmd -->
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<invoke name="globalCmd" msg="GCMD">
|
|
||||||
<doc line="Send a command to the AS."/>
|
|
||||||
<doc line="This is used to issue global commands like 'as.allStart' or 'as.allStop'."/>
|
|
||||||
<doc line="The result is returned by the return message"/>
|
|
||||||
<doc line="serviceCmdResult."/>
|
|
||||||
|
|
||||||
<param type="std::string" name="command" php_serial="String" byref="true"/>
|
|
||||||
</invoke>
|
|
||||||
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<!-- controlCmd -->
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<invoke name="controlCmd" msg="CCMD">
|
|
||||||
<doc line="Send a service related command to the executor "/>
|
|
||||||
<doc line="(not to the controled service)"/>
|
|
||||||
<doc line="The result is returned by the return message"/>
|
|
||||||
<doc line="controlCmdResult."/>
|
|
||||||
|
|
||||||
|
|
||||||
<param type="std::string" name="serviceAlias" php_serial="String" byref="true"/>
|
|
||||||
<param type="std::string" name="command" php_serial="String" byref="true"/>
|
|
||||||
</invoke>
|
|
||||||
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<!-- serviceCmd -->
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<invoke name="serviceCmd" msg="SCMD">
|
|
||||||
<doc line="Send a command to a service."/>
|
|
||||||
<doc line="The result is returned by the return message"/>
|
|
||||||
<doc line="serviceCmdResult."/>
|
|
||||||
|
|
||||||
<param type="std::string" name="serviceAlias" php_serial="String" byref="true"/>
|
|
||||||
<param type="std::string" name="command" php_serial="String" byref="true"/>
|
|
||||||
</invoke>
|
|
||||||
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<!-- commandResult -->
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<return name="commandResult" msg="CMDR">
|
|
||||||
<param type="std::string" name="serviceAlias" php_serial="String" byref="true"/>
|
|
||||||
<param type="std::string" name="result" php_serial="String" byref="true"/>
|
|
||||||
</return>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<!-- getShardOrders -->
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<invoke name="getShardOrders" msg="GSO">
|
|
||||||
<doc line="Get the orders of each known shard."/>
|
|
||||||
<doc line="The return value is a vector of string, one entry by shard"/>
|
|
||||||
|
|
||||||
<return type="std::string" php_serial="String" array="true"/>
|
|
||||||
|
|
||||||
</invoke>
|
|
||||||
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<!-- getStates -->
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<invoke name="getStates" msg="GS">
|
|
||||||
<doc line="Get the last known state of all services."/>
|
|
||||||
<doc line="The return value is a vector of string, one entry by service"/>
|
|
||||||
|
|
||||||
<return type="std::string" php_serial="String" array="true"/>
|
|
||||||
|
|
||||||
</invoke>
|
|
||||||
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<!-- getHighRezGraphInfo -->
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<invoke name="getHighRezGraphInfo" msg="GHRGI">
|
|
||||||
<doc line="Get information about a high rez graph."/>
|
|
||||||
<doc line="The return is a string array containing"/>
|
|
||||||
<doc line="the name of the var, the available sample"/>
|
|
||||||
<doc line="period as two unix date (start dans end)"/>
|
|
||||||
<doc line="and the number of samples available"/>
|
|
||||||
<doc line="If the var is not found, an empty array is returned"/>
|
|
||||||
|
|
||||||
|
|
||||||
<return type="std::string" php_serial="String" array="true"/>
|
|
||||||
|
|
||||||
<param type="std::string" name="varAddr" php_serial="String" byref="true"/>
|
|
||||||
|
|
||||||
</invoke>
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<!-- getHighRezGraph -->
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<invoke name="getHighRezGraph" msg="GHRG">
|
|
||||||
<doc line="Get the data for a high resolution graph."/>
|
|
||||||
<doc line="The return is a string array, each"/>
|
|
||||||
<doc line="string containing 'time:milliOffset:value"/>
|
|
||||||
<doc line="Set endDate to 0 to specify a start date relative"/>
|
|
||||||
<doc line="to the last sample date. In this case, start date"/>
|
|
||||||
<doc line="is interpreted as the number of second before"/>
|
|
||||||
<doc line="the last sample."/>
|
|
||||||
|
|
||||||
<return type="std::string" php_serial="String" array="true"/>
|
|
||||||
|
|
||||||
<param type="std::string" name="varAddr" php_serial="String" byref="true"/>
|
|
||||||
<param type="uint32" name="startDate" />
|
|
||||||
<param type="uint32" name="endDate" />
|
|
||||||
<param type="uint32" name="milliStep" />
|
|
||||||
|
|
||||||
</invoke>
|
|
||||||
|
|
||||||
</callback_interface>
|
|
||||||
|
|
||||||
<!-- ############################################################## -->
|
|
||||||
<!-- Item data for graph -->
|
|
||||||
<!-- ############################################################## -->
|
|
||||||
<class name="TGraphData">
|
|
||||||
<serial/>
|
|
||||||
|
|
||||||
<property type="std::string" name="ServiceAlias" byref="true"/>
|
|
||||||
<property type="std::string" name="VarName" byref="true"/>
|
|
||||||
<property type="uint32" name="SamplePeriod"/>
|
|
||||||
<property type="double" name="Value"/>
|
|
||||||
</class>
|
|
||||||
|
|
||||||
<!-- ############################################################## -->
|
|
||||||
<!-- Group of data for graph -->
|
|
||||||
<!-- ############################################################## -->
|
|
||||||
<class name="TGraphDatas">
|
|
||||||
<serial/>
|
|
||||||
|
|
||||||
<property type="uint32" name="CurrentTime"/>
|
|
||||||
<property type="std::vector < TGraphData >" name="Datas" byref="true" serial="Cont"/>
|
|
||||||
</class>
|
|
||||||
|
|
||||||
<!-- ############################################################## -->
|
|
||||||
<!-- Item data for high rez graph -->
|
|
||||||
<!-- ############################################################## -->
|
|
||||||
<class name="THighRezData">
|
|
||||||
<serial/>
|
|
||||||
|
|
||||||
<property type="NLMISC::TTime" name="SampleTick"/>
|
|
||||||
<property type="double" name="Value"/>
|
|
||||||
</class>
|
|
||||||
<!-- ############################################################## -->
|
|
||||||
<!-- Group of data for high rez graph -->
|
|
||||||
<!-- ############################################################## -->
|
|
||||||
<class name="THighRezDatas">
|
|
||||||
<serial/>
|
|
||||||
|
|
||||||
<property type="std::string" name="ServiceAlias" byref="true"/>
|
|
||||||
<property type="std::string" name="VarName" byref="true"/>
|
|
||||||
<property type="uint32" name="CurrentTime"/>
|
|
||||||
|
|
||||||
<property type="std::vector < THighRezData >" name="Datas" byref="true" serial="Cont"/>
|
|
||||||
</class>
|
|
||||||
|
|
||||||
<!-- ############################################################## -->
|
|
||||||
<!-- Shard orders enum -->
|
|
||||||
<!-- ############################################################## -->
|
|
||||||
<enum name="TShardOrders">
|
|
||||||
<item name="so_autostart_on"/>
|
|
||||||
<item name="so_autostart_off"/>
|
|
||||||
</enum>
|
|
||||||
|
|
||||||
<!-- ############################################################## -->
|
|
||||||
<!-- Service orders enum -->
|
|
||||||
<!-- ############################################################## -->
|
|
||||||
<enum name="TRunningOrders">
|
|
||||||
<item name="ro_deactivated"/>
|
|
||||||
<item name="ro_activated"/>
|
|
||||||
</enum>
|
|
||||||
|
|
||||||
<!-- ############################################################## -->
|
|
||||||
<!-- Service running state enum-->
|
|
||||||
<!-- ############################################################## -->
|
|
||||||
<enum name="TRunningState">
|
|
||||||
<item name="rs_stopped"/>
|
|
||||||
<item name="rs_running"/>
|
|
||||||
<item name="rs_online"/>
|
|
||||||
<!-- <item name="rs_stopped"/>
|
|
||||||
<item name="rs_starting"/>
|
|
||||||
-->
|
|
||||||
<!-- <item name="rs_connected"/>-->
|
|
||||||
<!-- <item name="rs_online"/>
|
|
||||||
<item name="rs_stopping"/>
|
|
||||||
--> </enum>
|
|
||||||
|
|
||||||
<!-- ############################################################## -->
|
|
||||||
<!-- Service running tag -->
|
|
||||||
<!-- ############################################################## -->
|
|
||||||
<enum name="TRunningTag">
|
|
||||||
<item name="rt_chain_crashing"/>
|
|
||||||
<item name="rt_locally_started"/>
|
|
||||||
<item name="rt_locally_stopped"/>
|
|
||||||
<item name="rt_globally_stopped"/>
|
|
||||||
<item name="rt_stopped_for_patch"/>
|
|
||||||
<item name="rt_externaly_started"/>
|
|
||||||
<item name="rt_slow_to_stop"/>
|
|
||||||
<item name="rt_slow_to_start"/>
|
|
||||||
</enum>
|
|
||||||
|
|
||||||
<!-- ############################################################## -->
|
|
||||||
<!-- Service status -->
|
|
||||||
<!-- ############################################################## -->
|
|
||||||
<class name="TServiceStatus">
|
|
||||||
<serial/>
|
|
||||||
|
|
||||||
<property type="std::string" name="ShardName" byref="true"/>
|
|
||||||
<property type="std::string" name="ServiceLongName" byref="true"/>
|
|
||||||
<property type="std::string" name="ServiceShortName" byref="true"/>
|
|
||||||
<property type="std::string" name="ServiceAliasName" byref="true"/>
|
|
||||||
<property type="TRunningState" name="RunningState" enum="smart"/>
|
|
||||||
<property type="TRunningOrders" name="RunningOrders" enum="smart"/>
|
|
||||||
<property type="std::set < TRunningTag >" name="RunningTags" serial="Cont" enum="smart" byref="true"/>
|
|
||||||
<property type="std::string" name="Status" byref="true"/>
|
|
||||||
</class>
|
|
||||||
|
|
||||||
<!-- ############################################################## -->
|
|
||||||
<!-- Module interface of the admin service module-->
|
|
||||||
<!-- ############################################################## -->
|
|
||||||
<module_interface name="CAdminService">
|
|
||||||
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<!-- up service update -->
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<method name="upServiceUpdate" msg="USU">
|
|
||||||
<doc line="An AES send an update of the list of service up"/>
|
|
||||||
|
|
||||||
<param type="std::vector < TServiceStatus >" name="serviceStatus" byref="true" serial="Cont"/>
|
|
||||||
</method>
|
|
||||||
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<!-- graphUpdate -->
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<method name="graphUpdate" msg="GU">
|
|
||||||
<doc line="An AES send graph data update"/>
|
|
||||||
|
|
||||||
<param type="TGraphDatas" name="graphDatas" byref="true"/>
|
|
||||||
</method>
|
|
||||||
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<!-- HR graphUpdate -->
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<method name="highRezGraphUpdate" msg="HRGU">
|
|
||||||
<doc line="An AES send high rez graph data update"/>
|
|
||||||
|
|
||||||
<param type="THighRezDatas" name="graphDatas" byref="true"/>
|
|
||||||
</method>
|
|
||||||
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<!-- updateAESStates -->
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<!-- <method name="updateAESStates" msg="UAS">
|
|
||||||
<doc line="An AES send it's updated state strings"/>
|
|
||||||
|
|
||||||
<param type="std::vector < std::string >" name="states" byref="true" serial="Cont"/>
|
|
||||||
</method>
|
|
||||||
-->
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<!-- aes return command result -->
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<method name="commandResult" msg="CR">
|
|
||||||
<doc line="AES send back the result of execution of a command"/>
|
|
||||||
|
|
||||||
<param type="uint32" name="commandId" />
|
|
||||||
<param type="std::string" name="serviceAlias" byref="true"/>
|
|
||||||
<param type="std::string" name="result" byref="true"/>
|
|
||||||
</method>
|
|
||||||
</module_interface>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ############################################################## -->
|
|
||||||
<!-- Module interface of the admin executor service module-->
|
|
||||||
<!-- ############################################################## -->
|
|
||||||
<module_interface name="CAdminExecutorService">
|
|
||||||
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<!-- global state from AS -->
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<!-- <method name="setGlobalOrders" msg="SGO" broadcast="true">
|
|
||||||
<doc line="AS send it's global running orders"/>
|
|
||||||
|
|
||||||
<param type="TRunningOrders" name="globalOrders" enum="smart"/>
|
|
||||||
</method>
|
|
||||||
-->
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<!-- shard state from AS -->
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<method name="setShardOrders" msg="SCO" broadcast="true">
|
|
||||||
<doc line="AS send orders for a shard"/>
|
|
||||||
|
|
||||||
<param type="std::string" name="shardName" byref="true"/>
|
|
||||||
<param type="TShardOrders" name="shardOrders" enum="smart"/>
|
|
||||||
</method>
|
|
||||||
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<!-- shutdown shard from AS -->
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<method name="shutdownShard" msg="SDS" broadcast="true">
|
|
||||||
<doc line="AS send a command to shutdown a shard with a delay"/>
|
|
||||||
|
|
||||||
<param type="std::string" name="shardName" byref="true"/>
|
|
||||||
<param type="uint32" name="delay"/>
|
|
||||||
</method>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<!-- controlCmd -->
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<method name="controlCmd" msg="CC" broadcast="true">
|
|
||||||
<doc line="AS send a control command to this AES"/>
|
|
||||||
|
|
||||||
<param type="uint32" name="commandId" />
|
|
||||||
<param type="std::string" name="serviceAlias" byref="true"/>
|
|
||||||
<param type="std::string" name="command" byref="true"/>
|
|
||||||
</method>
|
|
||||||
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<!-- service command -->
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<method name="serviceCmd" msg="SCMD">
|
|
||||||
<doc line="Send a command to a service."/>
|
|
||||||
|
|
||||||
<param type="uint32" name="commandId" />
|
|
||||||
<param type="std::string" name="serviceAlias" php_serial="String" byref="true"/>
|
|
||||||
<param type="std::string" name="command" php_serial="String" byref="true"/>
|
|
||||||
</method>
|
|
||||||
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<!-- aes client return command result -->
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<method name="commandResult" msg="CR">
|
|
||||||
<doc line="AES client send back the result of execution of a command"/>
|
|
||||||
|
|
||||||
<param type="uint32" name="commandId" />
|
|
||||||
<param type="std::string" name="serviceAlias" byref="true"/>
|
|
||||||
<param type="std::string" name="result" byref="true"/>
|
|
||||||
</method>
|
|
||||||
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<!-- graphUpdate -->
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<method name="graphUpdate" msg="GU">
|
|
||||||
<doc line="A service send graph data update"/>
|
|
||||||
|
|
||||||
<param type="TGraphDatas" name="graphDatas" byref="true"/>
|
|
||||||
</method>
|
|
||||||
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<!-- HR graphUpdate -->
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<method name="highRezGraphUpdate" msg="HRGU">
|
|
||||||
<doc line="A service high rez graph data update"/>
|
|
||||||
|
|
||||||
<param type="THighRezDatas" name="graphDatas" byref="true"/>
|
|
||||||
</method>
|
|
||||||
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<!-- serviceConnected-->
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<!-- <method name="serviceConnected" msg="SR">
|
|
||||||
<doc line="A service inform the AES that it is connected"/>
|
|
||||||
|
|
||||||
<param type="std::string" name="longName" byref="true"/>
|
|
||||||
<param type="std::string" name="shortName" byref="true"/>
|
|
||||||
<param type="std::string" name="aliasName" byref="true"/>
|
|
||||||
<param type="uint32" name="pid"/>
|
|
||||||
</method>
|
|
||||||
-->
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<!-- service status update -->
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<method name="serviceStatusUpdate" msg="SSU">
|
|
||||||
<doc line="A service send an update of of it's status string"/>
|
|
||||||
|
|
||||||
<param type="std::string" name="status" byref="true"/>
|
|
||||||
</method>
|
|
||||||
|
|
||||||
</module_interface>
|
|
||||||
|
|
||||||
<!-- ############################################################## -->
|
|
||||||
<!-- Module interface of the admin executor service client module-->
|
|
||||||
<!-- ############################################################## -->
|
|
||||||
<module_interface name="CAdminExecutorServiceClient">
|
|
||||||
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<!-- service command -->
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<method name="serviceCmd" msg="SCMD">
|
|
||||||
<doc line="execute a command and return the result."/>
|
|
||||||
|
|
||||||
<param type="uint32" name="commandId" />
|
|
||||||
<param type="std::string" name="command" byref="true"/>
|
|
||||||
</method>
|
|
||||||
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<!-- service command (one way)-->
|
|
||||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
||||||
<method name="serviceCmdNoReturn" msg="SCMDNR">
|
|
||||||
<doc line="Send a command to a service without waiting for the return value."/>
|
|
||||||
|
|
||||||
<param type="std::string" name="command" byref="true"/>
|
|
||||||
</method>
|
|
||||||
|
|
||||||
|
|
||||||
</module_interface>
|
|
||||||
</namespace>
|
|
||||||
</generator>
|
|
@ -1,478 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
#include "stdpch.h"
|
|
||||||
#include "nel/misc/singleton.h"
|
|
||||||
#include "nel/net/module.h"
|
|
||||||
#include "nel/net/module_builder_parts.h"
|
|
||||||
#include "nel/net/unified_network.h"
|
|
||||||
#include "nel/net/service.h"
|
|
||||||
|
|
||||||
#include "admin_modules_itf.h"
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
using namespace NLMISC;
|
|
||||||
using namespace NLNET;
|
|
||||||
|
|
||||||
void aesclient_forceLink() {}
|
|
||||||
|
|
||||||
namespace ADMIN
|
|
||||||
{
|
|
||||||
class CAdminExecutorServiceClient
|
|
||||||
: /*public CManualSingleton<CAdminExecutorService>,*/
|
|
||||||
public CEmptyModuleServiceBehav<CEmptyModuleCommBehav<CEmptySocketBehav<CModuleBase> > >,
|
|
||||||
public CAdminExecutorServiceClientSkel
|
|
||||||
{
|
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
// Maximum time without sending report string (a kind of 'keep alive')
|
|
||||||
MAX_DELAY_BETWEEN_REPORT = 30, // 30 seconds
|
|
||||||
};
|
|
||||||
|
|
||||||
/// Flag to inform AES that we don't want to be affected by shard orders
|
|
||||||
bool _DontUseShardOrders;
|
|
||||||
|
|
||||||
/// Admin executor service module
|
|
||||||
TModuleProxyPtr _AdminExecutorService;
|
|
||||||
|
|
||||||
/// Date of last state reporting to AES
|
|
||||||
uint32 _LastStateReport;
|
|
||||||
|
|
||||||
/// Last date of status string update
|
|
||||||
uint32 _LastStatusStringReport;
|
|
||||||
/// Last status string sent (to avoid double send)
|
|
||||||
string _LastSentStatus;
|
|
||||||
|
|
||||||
/// The service alias (must be an unique name)
|
|
||||||
string _ServiceAlias;
|
|
||||||
|
|
||||||
/// A cache of the value because reading it is very slow
|
|
||||||
uint32 _ProcessUsedMemory;
|
|
||||||
|
|
||||||
struct TGraphSample
|
|
||||||
{
|
|
||||||
// The date of the sample (in second)
|
|
||||||
uint32 TimeStamp;
|
|
||||||
// The date of the sample (in ms)
|
|
||||||
TTime HighRezTimeStamp;
|
|
||||||
// sample value
|
|
||||||
double SampleValue;
|
|
||||||
};
|
|
||||||
struct TGraphVarInfo
|
|
||||||
{
|
|
||||||
/// Name of the graphed var
|
|
||||||
string VarName;
|
|
||||||
/** Mean time between two sample in ms
|
|
||||||
* (in fact, if will be the min period)
|
|
||||||
* Set it to 1 to have a sample at each tick
|
|
||||||
* If the period is set less than 1000 ms,
|
|
||||||
* then the var is considered 'high rez'.
|
|
||||||
* Otherwise, the period is rounded at the
|
|
||||||
* nearest integer second.
|
|
||||||
* For 'high rez' var, the service buffer
|
|
||||||
* the relative timestamp in ms at each
|
|
||||||
* tick loop and send update every seconds
|
|
||||||
* to the AES service.
|
|
||||||
* In addition, HighRez var are also sent
|
|
||||||
* every second as normal sample.
|
|
||||||
*/
|
|
||||||
uint32 MeanSamplePeriod;
|
|
||||||
|
|
||||||
/// Date of last sample (low rez)
|
|
||||||
uint32 LastSampleTimeStamp;
|
|
||||||
/// Date of last sample (high rez)
|
|
||||||
TTime LastHighRezTimeStamp;
|
|
||||||
|
|
||||||
/// The vector of buffered samples
|
|
||||||
vector<TGraphSample> Samples;
|
|
||||||
|
|
||||||
TGraphVarInfo()
|
|
||||||
: MeanSamplePeriod(1000),
|
|
||||||
LastSampleTimeStamp(0),
|
|
||||||
LastHighRezTimeStamp(0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/// The list of variable to graph (build from service config file var 'GraphVars')
|
|
||||||
vector<TGraphVarInfo> _GraphVars;
|
|
||||||
|
|
||||||
/// Date of last graph
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
CAdminExecutorServiceClient()
|
|
||||||
: _DontUseShardOrders(false),
|
|
||||||
_LastStateReport(0),
|
|
||||||
_LastStatusStringReport(0),
|
|
||||||
_ProcessUsedMemory(0)
|
|
||||||
{
|
|
||||||
CAdminExecutorServiceClientSkel::init(this);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string makeServiceAlias()
|
|
||||||
{
|
|
||||||
string serviceAlias = IService::getInstance()->getServiceAliasName();
|
|
||||||
if (serviceAlias.empty())
|
|
||||||
{
|
|
||||||
serviceAlias = IService::getInstance()->getHostName()+"."+IService::getInstance()->getServiceUnifiedName();
|
|
||||||
}
|
|
||||||
return serviceAlias;
|
|
||||||
}
|
|
||||||
|
|
||||||
string getModuleManifest() const
|
|
||||||
{
|
|
||||||
uint32 pid = getpid ();
|
|
||||||
|
|
||||||
string serviceAlias = _ServiceAlias;
|
|
||||||
|
|
||||||
CSString manifest;
|
|
||||||
|
|
||||||
manifest << "LongName=" << IService::getInstance()->getServiceLongName()
|
|
||||||
<< " ShortName=" << IService::getInstance()->getServiceShortName()
|
|
||||||
<< " AliasName=" << serviceAlias
|
|
||||||
<< " PID=" << pid
|
|
||||||
<< " DontUseShardOrders=" << _DontUseShardOrders;
|
|
||||||
|
|
||||||
return manifest;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool initModule(const TParsedCommandLine &pcl)
|
|
||||||
{
|
|
||||||
if (!CModuleBase::initModule(pcl))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// try to read the config file
|
|
||||||
IService *service = IService::getInstance();
|
|
||||||
if (service == NULL)
|
|
||||||
{
|
|
||||||
nlwarning("Failed to get the IService singleton instance");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
CConfigFile::CVar *gv = service->ConfigFile.getVarPtr("GraphVars");
|
|
||||||
if (gv)
|
|
||||||
{
|
|
||||||
_GraphVars.clear();
|
|
||||||
for (uint i =0; i<gv->size()/2; ++i)
|
|
||||||
{
|
|
||||||
TGraphVarInfo gvi;
|
|
||||||
|
|
||||||
gvi.VarName = gv->asString(i*2);
|
|
||||||
gvi.MeanSamplePeriod = max(1, gv->asInt((i*2)+1));
|
|
||||||
|
|
||||||
_GraphVars.push_back(gvi);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// precompute the service name
|
|
||||||
_ServiceAlias = makeServiceAlias();
|
|
||||||
|
|
||||||
// loop for an optional 'dontUseShardOrders' flag in init params
|
|
||||||
const TParsedCommandLine *duso = pcl.getParam("dontUseShardOrders");
|
|
||||||
if (duso != NULL)
|
|
||||||
_DontUseShardOrders = (duso->ParamValue == "true" || duso->ParamName == "1");
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void onModuleUp(IModuleProxy *proxy)
|
|
||||||
{
|
|
||||||
if (proxy->getModuleClassName() == "AdminExecutorService")
|
|
||||||
{
|
|
||||||
nldebug("CAdminExecutorServiceClient : admin executor service up as '%s'", proxy->getModuleName().c_str());
|
|
||||||
// we found the manager of AES
|
|
||||||
if (_AdminExecutorService != NULL)
|
|
||||||
{
|
|
||||||
nlwarning("CAdminExecutorServiceClient : admin executor service already known as '%s', replacing with new one", _AdminExecutorService->getModuleName().c_str());
|
|
||||||
}
|
|
||||||
_AdminExecutorService = proxy;
|
|
||||||
|
|
||||||
// // send basic service info to AES
|
|
||||||
// CAdminExecutorServiceProxy aes(proxy);
|
|
||||||
//
|
|
||||||
// uint32 pid = getpid ();
|
|
||||||
//
|
|
||||||
// string serviceAlias = IService::getInstance()->getServiceAliasName();
|
|
||||||
// if (serviceAlias.empty())
|
|
||||||
// serviceAlias = getModuleFullyQualifiedName();
|
|
||||||
//
|
|
||||||
// aes.serviceConnected(this,
|
|
||||||
// IService::getInstance()->getServiceLongName(),
|
|
||||||
// IService::getInstance()->getServiceShortName(),
|
|
||||||
// serviceAlias,
|
|
||||||
// pid);
|
|
||||||
// for resend of the current status to the new AES
|
|
||||||
_LastSentStatus = "";
|
|
||||||
sendServiceStatus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void onModuleDown(IModuleProxy *proxy)
|
|
||||||
{
|
|
||||||
if (proxy == _AdminExecutorService)
|
|
||||||
{
|
|
||||||
nldebug("CAdminExecutorServiceClient : admin executor service '%s' is down", proxy->getModuleName().c_str());
|
|
||||||
|
|
||||||
_AdminExecutorService = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void onModuleUpdate()
|
|
||||||
{
|
|
||||||
H_AUTO(CAdminExecutorServiceClient_onModuleUpdate);
|
|
||||||
|
|
||||||
uint32 now = CTime::getSecondsSince1970();
|
|
||||||
TTime timer = CTime::getLocalTime();
|
|
||||||
|
|
||||||
// update every HR variables
|
|
||||||
for (uint i=0; i<_GraphVars.size(); ++i)
|
|
||||||
{
|
|
||||||
if (_GraphVars[i].MeanSamplePeriod < 1000)
|
|
||||||
{
|
|
||||||
// this is a HR var
|
|
||||||
TGraphVarInfo &gvi = _GraphVars[i];
|
|
||||||
if (gvi.LastHighRezTimeStamp + gvi.MeanSamplePeriod < timer)
|
|
||||||
{
|
|
||||||
// it's time to get a sample
|
|
||||||
// create a sample
|
|
||||||
gvi.Samples.push_back(TGraphSample());
|
|
||||||
TGraphSample &gs = gvi.Samples.back();
|
|
||||||
// inialise it
|
|
||||||
gs.TimeStamp = now;
|
|
||||||
gs.HighRezTimeStamp = timer;
|
|
||||||
IVariable *var = dynamic_cast<IVariable*>(ICommand::getCommand(gvi.VarName));
|
|
||||||
if (var != NULL)
|
|
||||||
NLMISC::fromString(var->toString(), gs.SampleValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_LastStateReport != now)
|
|
||||||
{
|
|
||||||
|
|
||||||
if ((now & 0xf) == 0)
|
|
||||||
{
|
|
||||||
// every 16 seconds because very slow
|
|
||||||
IVariable *var = dynamic_cast<IVariable*>(ICommand::getCommand("ProcessUsedMemory"));
|
|
||||||
if (var != NULL)
|
|
||||||
NLMISC::fromString(var->toString(), _ProcessUsedMemory);
|
|
||||||
}
|
|
||||||
|
|
||||||
// at least one second as passed, check for updates to send to
|
|
||||||
// AES
|
|
||||||
|
|
||||||
TGraphDatas graphDatas;
|
|
||||||
graphDatas.setCurrentTime(now);
|
|
||||||
|
|
||||||
THighRezDatas highRezDatas;
|
|
||||||
highRezDatas.setServiceAlias(_ServiceAlias);
|
|
||||||
highRezDatas.setCurrentTime(now);
|
|
||||||
|
|
||||||
vector<TGraphData> &datas = graphDatas.getDatas();
|
|
||||||
|
|
||||||
for (uint i=0; i<_GraphVars.size(); ++i)
|
|
||||||
{
|
|
||||||
if (_GraphVars[i].LastSampleTimeStamp+(_GraphVars[i].MeanSamplePeriod/1000) < now)
|
|
||||||
{
|
|
||||||
TGraphVarInfo &gvi = _GraphVars[i];
|
|
||||||
// it's time to send update for this var
|
|
||||||
// create a new sample entry
|
|
||||||
datas.push_back(TGraphData());
|
|
||||||
// and fill it
|
|
||||||
TGraphData &gd = datas.back();
|
|
||||||
gd.setServiceAlias(_ServiceAlias);
|
|
||||||
gd.setVarName(gvi.VarName);
|
|
||||||
gd.setSamplePeriod(max(uint32(1), uint32(gvi.MeanSamplePeriod/1000)));
|
|
||||||
if (gvi.Samples.empty())
|
|
||||||
{
|
|
||||||
// no sample collected yet, just ask a new one
|
|
||||||
IVariable *var = dynamic_cast<IVariable*>(ICommand::getCommand(gvi.VarName));
|
|
||||||
if (var != NULL)
|
|
||||||
{
|
|
||||||
float val;
|
|
||||||
NLMISC::fromString(var->toString(), val);
|
|
||||||
gd.setValue(val);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// we have some sample collected, just use the last one
|
|
||||||
gd.setValue(gvi.Samples.back().SampleValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
// if it's a high rez sampler, send the complete buffer
|
|
||||||
if (gvi.MeanSamplePeriod < 1000 && _AdminExecutorService != NULL)
|
|
||||||
{
|
|
||||||
// build the message
|
|
||||||
highRezDatas.setVarName(gvi.VarName);
|
|
||||||
highRezDatas.getDatas().clear();
|
|
||||||
|
|
||||||
for (uint j=0; j<gvi.Samples.size(); ++j)
|
|
||||||
{
|
|
||||||
highRezDatas.getDatas().push_back(THighRezData());
|
|
||||||
THighRezData &hrd = highRezDatas.getDatas().back();
|
|
||||||
hrd.setSampleTick(gvi.Samples[j].HighRezTimeStamp);
|
|
||||||
hrd.setValue(gvi.Samples[j].SampleValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!highRezDatas.getDatas().empty() && _AdminExecutorService != NULL)
|
|
||||||
{
|
|
||||||
// send the high rez data
|
|
||||||
CAdminExecutorServiceProxy aes(_AdminExecutorService);
|
|
||||||
aes.highRezGraphUpdate(this, highRezDatas);
|
|
||||||
}
|
|
||||||
|
|
||||||
// we don't send normal update for high rez sampler
|
|
||||||
datas.pop_back();
|
|
||||||
}
|
|
||||||
|
|
||||||
// update the time stamp
|
|
||||||
gvi.LastSampleTimeStamp = now;
|
|
||||||
// clear the buffer
|
|
||||||
gvi.Samples.clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// if we have some data to send, send them
|
|
||||||
if (!datas.empty() && _AdminExecutorService != NULL)
|
|
||||||
{
|
|
||||||
CAdminExecutorServiceProxy aes(_AdminExecutorService);
|
|
||||||
aes.graphUpdate(this, graphDatas);
|
|
||||||
}
|
|
||||||
|
|
||||||
// update the last report date
|
|
||||||
_LastStateReport = now;
|
|
||||||
}
|
|
||||||
|
|
||||||
// send an update of the status (if needed)
|
|
||||||
sendServiceStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
void sendServiceStatus()
|
|
||||||
{
|
|
||||||
CSString status;
|
|
||||||
uint32 now = NLMISC::CTime::getSecondsSince1970();
|
|
||||||
|
|
||||||
status << "\tServiceAlias=" << _ServiceAlias;
|
|
||||||
|
|
||||||
// build the status string
|
|
||||||
IVariable *var = dynamic_cast<IVariable*>(ICommand::getCommand("State"));
|
|
||||||
if (var != NULL)
|
|
||||||
status << "\tState=" <<var->toString();
|
|
||||||
|
|
||||||
var = dynamic_cast<IVariable*>(ICommand::getCommand("UserSpeedLoop"));
|
|
||||||
if (var != NULL)
|
|
||||||
status << "\tUserSpeedLoop=" <<var->toString();
|
|
||||||
|
|
||||||
var = dynamic_cast<IVariable*>(ICommand::getCommand("TickSpeedLoop"));
|
|
||||||
if (var != NULL)
|
|
||||||
status << "\tTickSpeedLoop=" <<var->toString();
|
|
||||||
|
|
||||||
if (_ProcessUsedMemory != 0)
|
|
||||||
status << "\tProcessUsedMemory=" <<_ProcessUsedMemory;
|
|
||||||
|
|
||||||
var = dynamic_cast<IVariable*>(ICommand::getCommand("Uptime"));
|
|
||||||
if (var != NULL)
|
|
||||||
status << "\tUpTime=" <<var->toString();
|
|
||||||
|
|
||||||
var = dynamic_cast<IVariable*>(ICommand::getCommand("NbPlayers"));
|
|
||||||
if (var != NULL)
|
|
||||||
status << "\tNbPlayers=" <<var->toString();
|
|
||||||
|
|
||||||
var = dynamic_cast<IVariable*>(ICommand::getCommand("NbEntities"));
|
|
||||||
if (var != NULL)
|
|
||||||
status << "\tNbEntities=" <<var->toString();
|
|
||||||
|
|
||||||
var = dynamic_cast<IVariable*>(ICommand::getCommand("LocalEntities"));
|
|
||||||
if (var != NULL)
|
|
||||||
status << "\tLocalEntities=" <<var->toString();
|
|
||||||
|
|
||||||
uint32 shardId = IService::getInstance()->getShardId();
|
|
||||||
status << "\tShardId=" <<toString(shardId);
|
|
||||||
|
|
||||||
// add any service specific info
|
|
||||||
if (IService::isServiceInitialized())
|
|
||||||
{
|
|
||||||
status << "\t" << IService::getInstance()->getServiceStatusString();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((status != _LastSentStatus || (now - _LastStatusStringReport) > MAX_DELAY_BETWEEN_REPORT)
|
|
||||||
&& _AdminExecutorService != NULL)
|
|
||||||
{
|
|
||||||
CAdminExecutorServiceProxy aes(_AdminExecutorService);
|
|
||||||
aes.serviceStatusUpdate(this, status);
|
|
||||||
|
|
||||||
_LastSentStatus = status;
|
|
||||||
_LastStatusStringReport = now;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////
|
|
||||||
// implementation from Admin executor service client
|
|
||||||
///////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
// execute a command and return the result.
|
|
||||||
virtual void serviceCmd(NLNET::IModuleProxy *sender, uint32 commandId, const std::string &command)
|
|
||||||
{
|
|
||||||
// create a displayer to gather the output of the command
|
|
||||||
class CStringDisplayer: public IDisplayer
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
virtual void doDisplay( const CLog::TDisplayInfo& args, const char *message)
|
|
||||||
{
|
|
||||||
_Data += message;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string _Data;
|
|
||||||
};
|
|
||||||
CStringDisplayer stringDisplayer;
|
|
||||||
IService::getInstance()->CommandLog.addDisplayer(&stringDisplayer);
|
|
||||||
|
|
||||||
// retrieve the command from the input message and execute it
|
|
||||||
nlinfo ("ADMIN: Executing command from network : '%s'", command.c_str());
|
|
||||||
ICommand::execute (command, IService::getInstance()->CommandLog);
|
|
||||||
|
|
||||||
// unhook our displayer as it's work is now done
|
|
||||||
IService::getInstance()->CommandLog.removeDisplayer(&stringDisplayer);
|
|
||||||
|
|
||||||
string serviceAlias = IService::getInstance()->getServiceAliasName();
|
|
||||||
if (serviceAlias.empty())
|
|
||||||
serviceAlias = getModuleFullyQualifiedName();
|
|
||||||
|
|
||||||
// return the result to AES
|
|
||||||
CAdminExecutorServiceProxy aes(sender);
|
|
||||||
aes.commandResult(this, commandId, serviceAlias, stringDisplayer._Data);
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute a command without result
|
|
||||||
virtual void serviceCmdNoReturn(NLNET::IModuleProxy *sender, const std::string &command)
|
|
||||||
{
|
|
||||||
// retrieve the command from the input message and execute it
|
|
||||||
nlinfo ("ADMIN: Executing command from network : '%s'", command.c_str());
|
|
||||||
ICommand::execute (command, IService::getInstance()->CommandLog);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
NLNET_REGISTER_MODULE_FACTORY(CAdminExecutorServiceClient, "AdminExecutorServiceClient");
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace ADMIN
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,17 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
#include "stdpch.h"
|
|
@ -1,45 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
#ifndef ADMIN_MODULES_STDPCH_H
|
|
||||||
#define ADMIN_MODULES_STDPCH_H
|
|
||||||
|
|
||||||
#include <time.h>
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
#include "nel/misc/types_nl.h"
|
|
||||||
|
|
||||||
#include "nel/misc/file.h"
|
|
||||||
#include "nel/misc/hierarchical_timer.h"
|
|
||||||
#include "nel/misc/mutable_container.h"
|
|
||||||
#include "nel/misc/path.h"
|
|
||||||
#include "nel/misc/singleton.h"
|
|
||||||
#include "nel/misc/sstring.h"
|
|
||||||
#include "nel/misc/string_conversion.h"
|
|
||||||
#include "nel/misc/time_nl.h"
|
|
||||||
#include "nel/net/message.h"
|
|
||||||
#include "nel/net/module.h"
|
|
||||||
#include "nel/net/module_builder_parts.h"
|
|
||||||
#include "nel/net/module_gateway.h"
|
|
||||||
#include "nel/net/module_manager.h"
|
|
||||||
#include "nel/net/module_message.h"
|
|
||||||
#include "nel/net/service.h"
|
|
||||||
#include "nel/net/unified_network.h"
|
|
||||||
|
|
||||||
#include "game_share/callback_adaptor.h"
|
|
||||||
#include "game_share/utils.h"
|
|
||||||
|
|
||||||
#endif
|
|
File diff suppressed because it is too large
Load Diff
@ -1,286 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef GD_ACTOR_H
|
|
||||||
#define GD_ACTOR_H
|
|
||||||
|
|
||||||
// Nel Misc
|
|
||||||
#include "nel/misc/types_nl.h"
|
|
||||||
#include "nel/misc/sheet_id.h"
|
|
||||||
#include "nel/misc/entity_id.h"
|
|
||||||
#include "nel/misc/vectord.h"
|
|
||||||
|
|
||||||
// Nel Pacs
|
|
||||||
#include "nel/pacs/u_move_primitive.h"
|
|
||||||
#include "nel/pacs/u_move_container.h"
|
|
||||||
// Nel Ligo
|
|
||||||
#include "nel/ligo/primitive.h"
|
|
||||||
|
|
||||||
|
|
||||||
// Game share
|
|
||||||
#include "game_share/mode_and_behaviour.h"
|
|
||||||
#include "game_share/mirror_prop_value.h"
|
|
||||||
#include "game_share/ryzom_mirror_properties.h"
|
|
||||||
#include "game_share/player_visual_properties.h"
|
|
||||||
|
|
||||||
// AgS test
|
|
||||||
#include "move_manager.h"
|
|
||||||
#include "ags_timer.h"
|
|
||||||
#include "mirrors.h"
|
|
||||||
|
|
||||||
namespace AGS_TEST
|
|
||||||
{
|
|
||||||
// external refs
|
|
||||||
class CActorGroup;
|
|
||||||
|
|
||||||
// the class
|
|
||||||
class CActor
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
enum EActivity {
|
|
||||||
UNKNOWN=-1,
|
|
||||||
NOTHING=0,
|
|
||||||
SQUARE,
|
|
||||||
FIGHT,
|
|
||||||
WANDER,
|
|
||||||
FAUNA_WANDER,
|
|
||||||
FAUNA_WAIT,
|
|
||||||
FAUNA_EAT,
|
|
||||||
FAUNA_SLEEP,
|
|
||||||
ATTACK,
|
|
||||||
FLEE
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
enum ECycleState
|
|
||||||
{
|
|
||||||
STATE_WANDER,
|
|
||||||
STATE_HUNGRY,
|
|
||||||
STATE_VERY_HUNGRY,
|
|
||||||
STATE_STARVING,
|
|
||||||
STATE_EATING,
|
|
||||||
STATE_DIGESTING,
|
|
||||||
STATE_TIRED,
|
|
||||||
STATE_VERY_TIRED,
|
|
||||||
STATE_EXHAUSTED,
|
|
||||||
STATE_SLEEPING,
|
|
||||||
STATE_SHAKING
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
|
|
||||||
enum ECycleState
|
|
||||||
{
|
|
||||||
STATE_WANDER,
|
|
||||||
STATE_HUNGRY,
|
|
||||||
STATE_VERY_HUNGRY,
|
|
||||||
STATE_STARVING,
|
|
||||||
STATE_DIGESTING,
|
|
||||||
STATE_TIRED,
|
|
||||||
STATE_VERY_TIRED,
|
|
||||||
STATE_EXHAUSTED,
|
|
||||||
STATE_SHAKING,
|
|
||||||
STATE_LAST
|
|
||||||
};
|
|
||||||
|
|
||||||
// The only legal constructor
|
|
||||||
CActor(const std::string &type, const std::string &name, const NLMISC::CEntityId &id, bool &success);
|
|
||||||
|
|
||||||
//
|
|
||||||
~CActor();
|
|
||||||
|
|
||||||
// Removing x-refs to other actors if they are deleted
|
|
||||||
void removeRefs(CActor *actor);
|
|
||||||
|
|
||||||
// some basic read accessors
|
|
||||||
std::string getName() { return _name; }
|
|
||||||
std::string getType() { return _sheetId.toString(); }
|
|
||||||
sint32 getSheetID() { return _sheetId.asInt(); }
|
|
||||||
const NLMISC::CEntityId &getSid() { return _id; }
|
|
||||||
|
|
||||||
sint32 getX() { return _x(); }
|
|
||||||
sint32 getY() { return _y(); }
|
|
||||||
sint32 getZ() { return _z(); }
|
|
||||||
float getAngle() { return _angle(); }
|
|
||||||
// uint8 getMode() { return (uint8)(_mode().Mode); }
|
|
||||||
// void initMode() { _mode.init( TheDataset, _id, "Mode" ); }
|
|
||||||
|
|
||||||
//bool positionChanged() { return _positionChanged; }
|
|
||||||
|
|
||||||
// some basic write accessors
|
|
||||||
void setPos(sint32 x, sint32 y, sint32 z); // { _x=x; _y=y; _z=z; _positionChanged=true; } // commented by ben, uses pacs now
|
|
||||||
void setAngle(float angle) { _angle=angle; /*_positionChanged=true;*/ }
|
|
||||||
void setMagnetPos(const NLMISC::CVector &pos) { _Magnet = pos; }
|
|
||||||
void setMagnetRange(float range,float decay) { _MagnetDistance=range; _MagnetDecayDistance=decay; }
|
|
||||||
void setSpawnTime(float min,float max) { _MinSpawnDelay=min; _MaxSpawnDelay=max; }
|
|
||||||
void setAttackDistance(float distance)
|
|
||||||
{
|
|
||||||
_AttackDistance = distance;
|
|
||||||
nlinfo("Set attack distance for <%s> to %f meters",_name.c_str(),_AttackDistance);
|
|
||||||
}
|
|
||||||
void setPrimZone(NLLIGO::CPrimZone *primZone) { _PrimZone = primZone; }
|
|
||||||
void setBehaviour(std::string behaviourName);
|
|
||||||
/* void setMode(std::string behaviourName);
|
|
||||||
void setMode(MBEHAV::EMode mode);*/
|
|
||||||
void setLeftHand(NLMISC::CSheetId sheetId);
|
|
||||||
void setRightHand(NLMISC::CSheetId sheetId);
|
|
||||||
void setGroup(CActorGroup *group);
|
|
||||||
void setVPA(const SAltLookProp &vpa);
|
|
||||||
void setActivity(EActivity activity);
|
|
||||||
void setDefaultActivity(EActivity activity) { _DefaultActivity = activity; }
|
|
||||||
void setChatSet(sint32 set) { _ChatSet = set; }
|
|
||||||
sint32 getChatSet() const { return _ChatSet; }
|
|
||||||
|
|
||||||
// connections to the other game services
|
|
||||||
void addToOtherServices();
|
|
||||||
void removeFromOtherServices();
|
|
||||||
|
|
||||||
// the following used to connect to a specific service identified by service ID
|
|
||||||
//void addToGPMS(uint8 serviceID);
|
|
||||||
//void addToIOS(uint8 serviceID);
|
|
||||||
|
|
||||||
// some complex movement - involving GPMS update
|
|
||||||
void initMovePrimitive(sint32 x, sint32 y, sint32 z);
|
|
||||||
void moveBy(sint32 x, sint32 y, sint32 z);
|
|
||||||
//void addPositionChangesToMessage(NLNET::CMessage &msg);
|
|
||||||
void teleportTo(sint32 x, sint32 y, sint32 z);
|
|
||||||
|
|
||||||
// displaying the actor's current state
|
|
||||||
void display(NLMISC::CLog *log = NLMISC::InfoLog);
|
|
||||||
const char *getActivityName() { switch(_activity) { case FIGHT: return "FIGHT"; case NOTHING: return "IDLE"; case SQUARE: return "SQUARE"; case WANDER: return "WANDER"; } return ""; }
|
|
||||||
|
|
||||||
// changeing the actor's activity
|
|
||||||
void resetActivity() { setActivity(_DefaultActivity); }
|
|
||||||
void doNothing();
|
|
||||||
void doSquare();
|
|
||||||
void doWander();
|
|
||||||
void doEat();
|
|
||||||
void doSleep();
|
|
||||||
void doFight(CActor *target);
|
|
||||||
void doFight(const NLMISC::CEntityId &id);
|
|
||||||
void doFight(CActorGroup *target);
|
|
||||||
void doAttacked(CActor *target);
|
|
||||||
void doAttack();
|
|
||||||
void doFlee();
|
|
||||||
bool fighting() { return _activity==FIGHT; }
|
|
||||||
|
|
||||||
void stopFight();
|
|
||||||
|
|
||||||
void checkRespawn();
|
|
||||||
bool checkAttack( NLMISC::CVectorD & );
|
|
||||||
|
|
||||||
|
|
||||||
// Functions called at each update depending on the current _activity
|
|
||||||
bool processSquare();
|
|
||||||
bool processFight();
|
|
||||||
bool processEat();
|
|
||||||
bool processSleep();
|
|
||||||
|
|
||||||
bool computeMove( NLMISC::CVectorD &pos);
|
|
||||||
bool computeFlee( NLMISC::CVectorD &pos);
|
|
||||||
|
|
||||||
// the update routine that moves the actor and does other stuff
|
|
||||||
// returns false if the actor is dead, remote controled, etc
|
|
||||||
bool update();
|
|
||||||
|
|
||||||
// script management
|
|
||||||
/*
|
|
||||||
static void addScript(std::string name, std::vector<std::string> args, sint32 firstArg);
|
|
||||||
void assignScript(std::string name);
|
|
||||||
*/
|
|
||||||
|
|
||||||
// utility functions
|
|
||||||
double calcDist(CActor &target) { return (_x-target.getX()) * (_x-target.getX()) + (_y-target.getY()) * (_y-target.getY()); }
|
|
||||||
bool testPositionInPatat(const NLMISC::CVector &pos) { return (_PrimZone) ? _PrimZone->contains(pos) : true; } // if no prim zone, always true
|
|
||||||
|
|
||||||
//private:
|
|
||||||
CActor();
|
|
||||||
|
|
||||||
// basic identity
|
|
||||||
NLMISC::CEntityId _id;
|
|
||||||
NLMISC::CSheetId _sheetId;
|
|
||||||
std::string _name;
|
|
||||||
std::string _visualName;
|
|
||||||
|
|
||||||
|
|
||||||
// Eat and rest cycles
|
|
||||||
CAGSTimer _Timer; // Timer for eat and sleep cycles ( synchronized with TICK service)
|
|
||||||
ECycleState _CyclesState; // Current eat and sleep cycles
|
|
||||||
void updateCycles(); // State machine computing transitions between timer states (eat and sleep)
|
|
||||||
void checkTimers(); // called at each update to see if the last timer delay has expired (if true calls updateCycles)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// position
|
|
||||||
CMirrorPropValue1DS<TYPE_POSX> _x;
|
|
||||||
CMirrorPropValue1DS<TYPE_POSY> _y;
|
|
||||||
CMirrorPropValue1DS<TYPE_POSZ> _z;
|
|
||||||
CMirrorPropValue1DS<TYPE_ORIENTATION> _angle;
|
|
||||||
CMirrorPropValue1DS<TYPE_VPA> _vpa;
|
|
||||||
CMirrorPropValue1DS<TYPE_WHO_SEES_ME> _whoseesme;
|
|
||||||
CMirrorPropValue1DS<TYPE_BEHAVIOUR> _behaviour;
|
|
||||||
CMirrorPropValue1DS<TYPE_MODE> _mode;
|
|
||||||
//bool _positionChanged; // to know whether need to send position to GPS
|
|
||||||
|
|
||||||
// properties used to govern the update() code
|
|
||||||
EActivity _activity; // behavioural activity
|
|
||||||
EActivity _DefaultActivity; // the activity we were firt attributed and return to when nothing better to do
|
|
||||||
CActor *_target; // target for combat
|
|
||||||
|
|
||||||
// continent the entity spawned in
|
|
||||||
uint8 _Continent;
|
|
||||||
|
|
||||||
// pacs move container for the actor
|
|
||||||
NLPACS::UMoveContainer *_MoveContainer;
|
|
||||||
|
|
||||||
// pacs primitive for the actor
|
|
||||||
NLPACS::UMovePrimitive *_MovePrimitive;
|
|
||||||
|
|
||||||
// iterator for the move grid
|
|
||||||
CMoveManager::TObstacleGrid::CIterator _GridIterator;
|
|
||||||
|
|
||||||
// magnet
|
|
||||||
NLMISC::CVector _Magnet;
|
|
||||||
float _MagnetDistance;
|
|
||||||
float _MagnetDecayDistance;
|
|
||||||
|
|
||||||
// attack distance
|
|
||||||
float _AttackDistance;
|
|
||||||
|
|
||||||
// prim zone
|
|
||||||
NLLIGO::CPrimZone* _PrimZone;
|
|
||||||
|
|
||||||
// actor group
|
|
||||||
CActorGroup* _Group;
|
|
||||||
|
|
||||||
// bot page set
|
|
||||||
sint32 _ChatSet;
|
|
||||||
|
|
||||||
// respawn counter
|
|
||||||
sint32 _RespawnCounter;
|
|
||||||
float _MinSpawnDelay;
|
|
||||||
float _MaxSpawnDelay;
|
|
||||||
|
|
||||||
// added on services
|
|
||||||
bool _AlreadyAdded;
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
} // end of namespace AGS_TEST
|
|
||||||
|
|
||||||
#endif // GD_ACTOR_H
|
|
@ -1,144 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Nel Misc
|
|
||||||
#include "nel/misc/command.h"
|
|
||||||
#include "nel/misc/path.h"
|
|
||||||
#include "nel/net/message.h"
|
|
||||||
#include "nel/net/unified_network.h"
|
|
||||||
|
|
||||||
// Game share
|
|
||||||
#include "game_share/tick_event_handler.h"
|
|
||||||
//#include "game_share/msg_brick_service.h"
|
|
||||||
|
|
||||||
// Local includes
|
|
||||||
#include "actor.h"
|
|
||||||
#include "actor_group.h"
|
|
||||||
#include "actor_manager.h"
|
|
||||||
#include "sheets.h"
|
|
||||||
|
|
||||||
using namespace NLMISC;
|
|
||||||
using namespace NLNET;
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
namespace AGS_TEST
|
|
||||||
{
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
|
||||||
void CActorGroup::removeActor(CActor *actor)
|
|
||||||
{
|
|
||||||
if (this==0) return;
|
|
||||||
|
|
||||||
for (int i=_actors.size();i--;)
|
|
||||||
if (_actors[i]==actor)
|
|
||||||
{
|
|
||||||
_actors[i]=_actors[_actors.size()-1];
|
|
||||||
_actors.pop_back();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
|
||||||
// displaying the actor's current state
|
|
||||||
void CActorGroup::display()
|
|
||||||
{
|
|
||||||
if (this==0) return;
|
|
||||||
|
|
||||||
nlinfo("");
|
|
||||||
nlinfo("ActorGroup: %s",_name.c_str());
|
|
||||||
|
|
||||||
// diaply the group's actors' stats
|
|
||||||
for (int i=_actors.size();i--;)
|
|
||||||
_actors[i]->display();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CActorGroup::doFight(CActorGroup *target)
|
|
||||||
{
|
|
||||||
if (this==0) return;
|
|
||||||
if (target->actorCount()==0) return;
|
|
||||||
|
|
||||||
// tell each actor in the group to fight the opposing group member with matching ID
|
|
||||||
for (int i=_actors.size();i--;)
|
|
||||||
_actors[i]->doFight((*target)[i%target->actorCount()]);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CActorGroup::doFight(CActor *target)
|
|
||||||
{
|
|
||||||
if (this==0) return;
|
|
||||||
|
|
||||||
// tell all the actors in the group to attack the target chap
|
|
||||||
for (int i=_actors.size();i--;)
|
|
||||||
_actors[i]->doFight(target);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CActorGroup::stopFight()
|
|
||||||
{
|
|
||||||
if (this==0) return;
|
|
||||||
|
|
||||||
for (int i=_actors.size();i--;)
|
|
||||||
_actors[i]->stopFight();
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
|
||||||
// magnet state control
|
|
||||||
void CActorGroup::fadeMagnet(const NLMISC::CVector &pos, float distance, float decay, NLMISC::TGameCycle endTime)
|
|
||||||
{
|
|
||||||
_ToStartMagnet = _Magnet;
|
|
||||||
_ToStartMagnetDistance = _MagnetDistance;
|
|
||||||
_ToStartMagnetDecay = _MagnetDecay;
|
|
||||||
_ToStopMagnet = pos;
|
|
||||||
_ToStopMagnetDistance = distance;
|
|
||||||
_ToStopMagnetDecay= decay;
|
|
||||||
_ToStartCycle = CTickEventHandler::getGameCycle();
|
|
||||||
_ToStopCycle = endTime;
|
|
||||||
_ToFade = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
|
||||||
// overall actors update
|
|
||||||
void CActorGroup::update()
|
|
||||||
{
|
|
||||||
if (_ToFade)
|
|
||||||
{
|
|
||||||
TGameCycle cycle = CTickEventHandler::getGameCycle();
|
|
||||||
if (cycle > _ToStopCycle)
|
|
||||||
{
|
|
||||||
cycle = _ToStopCycle;
|
|
||||||
_ToFade = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
float ratio = (float)(cycle-_ToStartCycle)/(float)(_ToStopCycle-_ToStartCycle);
|
|
||||||
|
|
||||||
_Magnet = _ToStartMagnet*(1.0f-ratio) + _ToStopMagnet*ratio;
|
|
||||||
_MagnetDistance = _ToStartMagnetDistance*(1.0f-ratio) + _ToStopMagnetDistance*ratio;
|
|
||||||
_MagnetDecay = _ToStartMagnetDecay*(1.0f-ratio) + _ToStopMagnetDecay*ratio;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_MagnetActors)
|
|
||||||
{
|
|
||||||
uint i;
|
|
||||||
for (i=0; i<_actors.size(); ++i)
|
|
||||||
{
|
|
||||||
_actors[i]->setMagnetPos(_Magnet);
|
|
||||||
_actors[i]->setMagnetRange(_MagnetDistance, _MagnetDecay);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} // end of namespace AGS_TEST
|
|
@ -1,102 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef GD_ACTOR_GROUP_H
|
|
||||||
#define GD_ACTOR_GROUP_H
|
|
||||||
|
|
||||||
// Nel Misc
|
|
||||||
#include "nel/misc/types_nl.h"
|
|
||||||
#include "nel/misc/vector.h"
|
|
||||||
|
|
||||||
// Game share
|
|
||||||
#include "game_share/ryzom_entity_id.h"
|
|
||||||
#include "nel/misc/sheet_id.h"
|
|
||||||
#include "game_share/mode_and_behaviour.h"
|
|
||||||
|
|
||||||
namespace AGS_TEST
|
|
||||||
{
|
|
||||||
// external refs
|
|
||||||
class CActor;
|
|
||||||
|
|
||||||
// the class
|
|
||||||
class CActorGroup
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
// Constructor - must have a name for the group
|
|
||||||
CActorGroup(const std::string &name): _name(name), _MagnetActors(false) {}
|
|
||||||
|
|
||||||
// adding actors to the group
|
|
||||||
void addActor(CActor *actor) { _actors.push_back(actor); }
|
|
||||||
|
|
||||||
// Remove actor from the group (ignore if not found)
|
|
||||||
void removeActor(CActor *actor);
|
|
||||||
|
|
||||||
// some basic read accessors
|
|
||||||
std::string getName() { return _name; }
|
|
||||||
unsigned actorCount() { return (unsigned)_actors.size(); }
|
|
||||||
CActor *operator[](unsigned index) { return _actors[index]; }
|
|
||||||
|
|
||||||
// displaying the actor's current state
|
|
||||||
void display();
|
|
||||||
|
|
||||||
// changeing the actor's activity
|
|
||||||
void doNothing();
|
|
||||||
void doSquare();
|
|
||||||
void doFight(CActor *target);
|
|
||||||
void doFight(CActorGroup *target);
|
|
||||||
void stopFight();
|
|
||||||
|
|
||||||
//
|
|
||||||
void update();
|
|
||||||
|
|
||||||
// magnet moving/attraction scripting setup
|
|
||||||
void magnetActors(bool control=true) { _MagnetActors = control; }
|
|
||||||
void setMagnet(const NLMISC::CVector &pos, float distance, float decay) { _Magnet = pos; _MagnetDistance = distance; _MagnetDecay = decay; _ToFade = false; }
|
|
||||||
void fadeMagnet(const NLMISC::CVector &pos, float distance, float decay, NLMISC::TGameCycle endTime);
|
|
||||||
bool fadeComplete() const { return !_ToFade; }
|
|
||||||
const NLMISC::CVector &getMagnetPos() const { return _Magnet; }
|
|
||||||
float getMagnetDistance() const { return _MagnetDistance; }
|
|
||||||
float getMagnetDecay() const { return _MagnetDecay; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
CActorGroup(); // forbid default constructor
|
|
||||||
|
|
||||||
std::string _name;
|
|
||||||
std::vector<CActor *> _actors;
|
|
||||||
|
|
||||||
NLMISC::CVector _Magnet;
|
|
||||||
float _MagnetDistance;
|
|
||||||
float _MagnetDecay;
|
|
||||||
bool _MagnetActors;
|
|
||||||
|
|
||||||
NLMISC::CVector _ToStartMagnet;
|
|
||||||
float _ToStartMagnetDistance;
|
|
||||||
float _ToStartMagnetDecay;
|
|
||||||
NLMISC::CVector _ToStopMagnet;
|
|
||||||
float _ToStopMagnetDistance;
|
|
||||||
float _ToStopMagnetDecay;
|
|
||||||
NLMISC::TGameCycle _ToStartCycle, _ToStopCycle;
|
|
||||||
bool _ToFade;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
} // end of namespace AGS_TEST
|
|
||||||
|
|
||||||
#endif // GD_ACTOR_GROUP_H
|
|
||||||
/* End of actor_group.h */
|
|
@ -1,440 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
// Nel
|
|
||||||
//#include "nel/net/service.h"
|
|
||||||
|
|
||||||
|
|
||||||
// Local headers
|
|
||||||
#include "position_generator.h"
|
|
||||||
#include "actor_manager.h"
|
|
||||||
#include "sheets.h"
|
|
||||||
#include <nel/net/unified_network.h>
|
|
||||||
#include "game_share/people.h"
|
|
||||||
#include "game_share/synchronised_message.h"
|
|
||||||
|
|
||||||
#include "nel/misc/variable.h"
|
|
||||||
|
|
||||||
#include <set>
|
|
||||||
|
|
||||||
using namespace NLMISC;
|
|
||||||
using namespace NLNET;
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
|
|
||||||
namespace AGS_TEST
|
|
||||||
{
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
// Some global variables
|
|
||||||
extern uint32 GlobalActorCount;
|
|
||||||
extern uint32 GlobalActorUpdates;
|
|
||||||
extern uint32 GlobalActorMoves;
|
|
||||||
|
|
||||||
CEntityId LastActorId;
|
|
||||||
|
|
||||||
NLMISC_DYNVARIABLE(string, LastActorId, "Last created actor")
|
|
||||||
{
|
|
||||||
if (get)
|
|
||||||
*pointer = LastActorId.toString();
|
|
||||||
else
|
|
||||||
LastActorId.fromString((*pointer).c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
// Some function prototypes
|
|
||||||
|
|
||||||
static void cbServiceUp( const string& serviceName, uint16 serviceId, void * );
|
|
||||||
static void cbServiceDown( const string& serviceName, uint16 serviceId, void * );
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
// static data for CActorManager
|
|
||||||
|
|
||||||
std::vector<CActor*> CActorManager::_actors;
|
|
||||||
std::vector<CActorGroup*> CActorManager::_actorGroups;
|
|
||||||
int CActorManager::_nextActorID=0;
|
|
||||||
std::set<uint> CActorManager::_visionHandlingServices;
|
|
||||||
CActorGroup *CActorManager::_defaultActorGroup;
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
// basic functionality for CActorManager singleton
|
|
||||||
|
|
||||||
void CActorManager::init()
|
|
||||||
{
|
|
||||||
static bool first_time=true;
|
|
||||||
|
|
||||||
if (first_time)
|
|
||||||
{
|
|
||||||
// Init callback for service up / down
|
|
||||||
CUnifiedNetwork::getInstance()->setServiceUpCallback ("*", cbServiceUp, NULL);
|
|
||||||
CUnifiedNetwork::getInstance()->setServiceDownCallback("*", cbServiceDown, NULL);
|
|
||||||
first_time=false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
release();
|
|
||||||
|
|
||||||
_nextActorID=0;
|
|
||||||
/*
|
|
||||||
CPositionGenerator::setPattern(std::string("grid"));
|
|
||||||
CPositionGenerator::setPosition(17981,-33200);
|
|
||||||
CPositionGenerator::setSpacing(2000);
|
|
||||||
*/
|
|
||||||
_defaultActorGroup = newActorGroup("defaultGroup");
|
|
||||||
}
|
|
||||||
|
|
||||||
void CActorManager::update()
|
|
||||||
{
|
|
||||||
set< pair<sint32, sint32> > iaZones;
|
|
||||||
|
|
||||||
std::vector<CActorGroup*>::iterator itg;
|
|
||||||
for (itg=_actorGroups.begin(); itg!=_actorGroups.end(); ++itg)
|
|
||||||
(*itg)->update();
|
|
||||||
|
|
||||||
|
|
||||||
// iterate through all known actors, calling their update
|
|
||||||
uint16 positionChangeCount=0;
|
|
||||||
uint16 updateCount=0;
|
|
||||||
std::vector<CActor*>::iterator it;
|
|
||||||
for (it=_actors.begin(); it!=_actors.end(); ++it)
|
|
||||||
{
|
|
||||||
bool updated= (*it)->update();
|
|
||||||
if (updated)
|
|
||||||
updateCount++;
|
|
||||||
/*
|
|
||||||
if ((*it)->positionChanged())
|
|
||||||
positionChangeCount++;
|
|
||||||
|
|
||||||
sint32 zx = (*it)->getX()/160000;
|
|
||||||
sint32 zy = -(*it)->getY()/160000;
|
|
||||||
|
|
||||||
iaZones.insert(make_pair<sint32,sint32>(zx, zy));
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// for all entities, request vision zones
|
|
||||||
/*CMessage msg("AGENT_VISON");
|
|
||||||
sint64 fakeId = 0;
|
|
||||||
msg.serial(fakeId);
|
|
||||||
sint32 pos = msg.getPos();
|
|
||||||
set< pair<sint32, sint32> >::iterator itz;
|
|
||||||
for (itz=iaZones.begin(); itz!=iaZones.end(); ++itz)
|
|
||||||
{
|
|
||||||
sint32 x = (*itz).first,
|
|
||||||
y = (*itz).second;
|
|
||||||
msg.serial(x);
|
|
||||||
msg.serial(y);
|
|
||||||
}
|
|
||||||
if (msg.getPos() > pos)
|
|
||||||
CUnifiedNetwork::getInstance()->send("GPMS", msg);*/
|
|
||||||
/*
|
|
||||||
// build the position changed message and send it to GPMS
|
|
||||||
if (positionChangeCount>0)
|
|
||||||
{
|
|
||||||
NLNET::CMessage gpmPosMsg("UPDATE_ENTITIES_POSITIONS");
|
|
||||||
gpmPosMsg.serial(positionChangeCount);
|
|
||||||
for (it=_actors.begin(); it!=_actors.end(); ++it)
|
|
||||||
(*it)->addPositionChangesToMessage(gpmPosMsg);
|
|
||||||
|
|
||||||
sendMessageViaMirror( "GPMS", gpmPosMsg );
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
GlobalActorUpdates=updateCount;
|
|
||||||
//GlobalActorMoves=positionChangeCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CActorManager::release()
|
|
||||||
{
|
|
||||||
std::vector<CActor*>::iterator it;
|
|
||||||
for (it=_actors.begin(); it!=_actors.end(); ++it)
|
|
||||||
{
|
|
||||||
(*it)->removeFromOtherServices();
|
|
||||||
}
|
|
||||||
_actors.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Callback called at service connexion
|
|
||||||
static void cbServiceUp( const string& serviceName, uint16 serviceId, void * )
|
|
||||||
{
|
|
||||||
/*if (serviceName==std::string("EGS"))
|
|
||||||
CActorManager::reconnectEGS((uint8)serviceId);
|
|
||||||
|
|
||||||
if (serviceName==std::string("IOS"))
|
|
||||||
CActorManager::reconnectIOS((uint8)serviceId);
|
|
||||||
|
|
||||||
if (serviceName==std::string("GPMS"))
|
|
||||||
CActorManager::reconnectGPMS((uint8)serviceId);*/
|
|
||||||
|
|
||||||
/*CMessage reqVision("ASK_VISION_ZONE");
|
|
||||||
CUnifiedNetwork::getInstance()->send(serviceId, reqVision);*/
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
static void cbServiceDown( const string& serviceName, uint16 serviceId, void * )
|
|
||||||
{
|
|
||||||
CActorManager::removeVisionService(serviceId);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------
|
|
||||||
// methods for dealing with tardy connection of a key service
|
|
||||||
/*void CActorManager::reconnectEGS(uint8 serviceId)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void CActorManager::reconnectIOS(uint8 serviceId)
|
|
||||||
{
|
|
||||||
std::vector<CActor*>::iterator it;
|
|
||||||
for (it=_actors.begin(); it!=_actors.end(); ++it)
|
|
||||||
{
|
|
||||||
(*it)->addToIOS(serviceId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CActorManager::reconnectGPMS(uint8 serviceId)
|
|
||||||
{
|
|
||||||
std::vector<CActor*>::iterator it;
|
|
||||||
for (it=_actors.begin(); it!=_actors.end(); ++it)
|
|
||||||
{
|
|
||||||
(*it)->addToGPMS(serviceId);
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------
|
|
||||||
// CActorManager methods for creating and killing actors
|
|
||||||
|
|
||||||
// method for adding a new actor to the scene
|
|
||||||
CActor *CActorManager::newActor(const std::string &type, const std::string &name)
|
|
||||||
{
|
|
||||||
LastActorId = CEntityId::Unknown;
|
|
||||||
|
|
||||||
if (getActor(name)!=NULL)
|
|
||||||
{
|
|
||||||
nlinfo("Actor already exists: %s",name.c_str());
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
CSheetId sheetId(type);
|
|
||||||
const CSheets::CSheet *sheet=CSheets::lookup(sheetId);
|
|
||||||
if (!sheet)
|
|
||||||
{
|
|
||||||
nlwarning("ERROR: Can't find static type data for '%s'(%d) for entity %s", type.c_str(), sheetId.asInt(), name.c_str());
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// create a new actor record and COPY it into the actor vector
|
|
||||||
|
|
||||||
// EGSPD::CPeople::TPeople p_type = EGSPD::CPeople::fromString( type );
|
|
||||||
bool success = false;
|
|
||||||
CActor *aNewActor;
|
|
||||||
if ( sheet->isNpc /*EGSPD::CPeople::isPlayableRace( p_type )*/ )
|
|
||||||
aNewActor = new CActor(type,name,CEntityId(RYZOMID::npc,_nextActorID++),success);
|
|
||||||
else
|
|
||||||
aNewActor = new CActor(type,name,CEntityId(RYZOMID::creature,_nextActorID++),success);
|
|
||||||
|
|
||||||
if ( ! success )
|
|
||||||
{
|
|
||||||
if (aNewActor)
|
|
||||||
delete aNewActor;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
LastActorId = aNewActor->_id;
|
|
||||||
|
|
||||||
int x,y;
|
|
||||||
CPositionGenerator::next(x,y);
|
|
||||||
aNewActor->setPos(x, y, 0);
|
|
||||||
aNewActor->setAngle(0);
|
|
||||||
_actors.push_back(aNewActor);
|
|
||||||
|
|
||||||
// get hold of a pointer of the copy of the actor in the actor vector
|
|
||||||
CActor *theActor=getActor(name);
|
|
||||||
|
|
||||||
// add the actor to the GPMS, the IOS, etc
|
|
||||||
if (theActor!=0)
|
|
||||||
theActor->addToOtherServices();
|
|
||||||
/*
|
|
||||||
CMessage msgMode("SET_MODE");
|
|
||||||
TDataSetRow index = CMirrors::DataSet->getDataSetRow(theActor->_id);
|
|
||||||
msgMode.serial(index);
|
|
||||||
MBEHAV::TMode mode(MBEHAV::NORMAL, x, y);
|
|
||||||
msgMode.serial(mode);
|
|
||||||
sendMessageViaMirror("EGS", msgMode);
|
|
||||||
*/
|
|
||||||
CMirrors::initSheet( aNewActor->getSid(), sheetId ); // initialize out the sheet
|
|
||||||
// Let the position & angle & tick be sent ("UPDATE_ENTITIES_POSITIONS") in update
|
|
||||||
//aNewActor->initMode();
|
|
||||||
|
|
||||||
MBEHAV::TMode mode(MBEHAV::NORMAL, x, y);
|
|
||||||
theActor->_mode = mode.RawModeAndParam;
|
|
||||||
|
|
||||||
aNewActor->display();
|
|
||||||
theActor->setGroup(_defaultActorGroup);
|
|
||||||
|
|
||||||
GlobalActorCount++;
|
|
||||||
return theActor;
|
|
||||||
}
|
|
||||||
|
|
||||||
// method for retrievng a pointer to a named actor
|
|
||||||
// returns NULL if the actor doesn't exist
|
|
||||||
CActor *CActorManager::getActor(const std::string &name)
|
|
||||||
{
|
|
||||||
std::vector<CActor*>::iterator it;
|
|
||||||
for (it=_actors.begin(); it!=_actors.end(); ++it)
|
|
||||||
{
|
|
||||||
if ((*it)->getName()==name)
|
|
||||||
return (*it);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// method for retrievng a pointer to given actor
|
|
||||||
CActor *CActorManager::getActor(unsigned index)
|
|
||||||
{
|
|
||||||
if (index>=_actors.size())
|
|
||||||
return NULL;
|
|
||||||
else
|
|
||||||
return (_actors[index]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// method for retrievng a pointer to given actor
|
|
||||||
CActor *CActorManager::getActor(const NLMISC::CEntityId &id)
|
|
||||||
{
|
|
||||||
std::vector<CActor*>::iterator it;
|
|
||||||
for (it=_actors.begin(); it!=_actors.end(); ++it)
|
|
||||||
{
|
|
||||||
if ((*it)->getSid()==id)
|
|
||||||
return (*it);
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CActorManager::killActor(const std::string &name)
|
|
||||||
{
|
|
||||||
std::vector<CActor*>::iterator it;
|
|
||||||
for (it=_actors.begin(); it!=_actors.end(); ++it)
|
|
||||||
{
|
|
||||||
if ((*it)->getName()==name)
|
|
||||||
{
|
|
||||||
// remove from net refferences
|
|
||||||
(*it)->removeFromOtherServices();
|
|
||||||
|
|
||||||
// remove from vision xrefs
|
|
||||||
std::vector<CActor*>::iterator it2;
|
|
||||||
for (it2=_actors.begin(); it2!=_actors.end(); ++it2)
|
|
||||||
{
|
|
||||||
(*it2)->removeRefs(*it);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i=_actorGroups.size();i--;)
|
|
||||||
_actorGroups[i]->removeActor(*it);
|
|
||||||
|
|
||||||
// remove from container
|
|
||||||
delete *it;
|
|
||||||
_actors.erase(it);
|
|
||||||
GlobalActorCount--;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
// basic functionality for actor group management
|
|
||||||
|
|
||||||
// method for adding a new actorGroup to the scene
|
|
||||||
CActorGroup *CActorManager::newActorGroup(const std::string &name)
|
|
||||||
{
|
|
||||||
if (!getActorGroup(name))
|
|
||||||
{
|
|
||||||
// create a new actorGroup record and COPY it into the actorGroup vector
|
|
||||||
CActorGroup *aNewActorGroup = new CActorGroup(name);
|
|
||||||
_actorGroups.push_back(aNewActorGroup);
|
|
||||||
aNewActorGroup->display();
|
|
||||||
}
|
|
||||||
|
|
||||||
// get hold of a pointer of the copy of the actorGroup in the actorGroup vector
|
|
||||||
return getActorGroup(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
// method for retrievng a pointer to a named actorGroup
|
|
||||||
// returns NULL if the actorGroup doesn't exist
|
|
||||||
CActorGroup *CActorManager::getActorGroup(const std::string &name)
|
|
||||||
{
|
|
||||||
std::vector<CActorGroup*>::iterator it;
|
|
||||||
for (it=_actorGroups.begin(); it!=_actorGroups.end(); ++it)
|
|
||||||
{
|
|
||||||
if ((*it)->getName()==name)
|
|
||||||
return (*it);
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// method for retrievng a pointer to given actorGroup
|
|
||||||
CActorGroup *CActorManager::getActorGroup(unsigned index)
|
|
||||||
{
|
|
||||||
if (index>=_actorGroups.size())
|
|
||||||
return NULL;
|
|
||||||
else
|
|
||||||
return (_actorGroups[index]);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CActorManager::removeActorGroup(const std::string &name)
|
|
||||||
{
|
|
||||||
std::vector<CActorGroup*>::iterator it;
|
|
||||||
for (it=_actorGroups.begin(); it!=_actorGroups.end(); ++it)
|
|
||||||
{
|
|
||||||
if ((*it)->getName()==name)
|
|
||||||
{
|
|
||||||
// remove all actors from this group into default group
|
|
||||||
uint i;
|
|
||||||
for (i=0; i<(*it)->actorCount(); ++i)
|
|
||||||
(*(*it))[i]->setGroup(_defaultActorGroup);
|
|
||||||
|
|
||||||
// remove from container
|
|
||||||
delete (*it);
|
|
||||||
_actorGroups.erase(it);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
void CActorManager::setActorsToGroup(const std::string &sourceActorGroup, const std::string &destActorGroup)
|
|
||||||
{
|
|
||||||
CActorGroup *srcGroup = getActorGroup(sourceActorGroup);
|
|
||||||
if (srcGroup == NULL)
|
|
||||||
{
|
|
||||||
nlwarning("source actor group '%s' is unknown, abort setActorsToGroup(%s, %s)", sourceActorGroup.c_str(), sourceActorGroup.c_str(), destActorGroup.c_str());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
CActorGroup *destGroup = getActorGroup(destActorGroup);
|
|
||||||
if (destGroup == NULL)
|
|
||||||
{
|
|
||||||
nlwarning("destination actor group '%s' is unknown, abort setActorsToGroup(%s, %s)", destActorGroup.c_str(), sourceActorGroup.c_str(), destActorGroup.c_str());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint i;
|
|
||||||
for (i=0; i<srcGroup->actorCount(); ++i)
|
|
||||||
(*srcGroup)[i]->setGroup(destGroup);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} // end of namespace AGS_TEST
|
|
@ -1,107 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef GD_ACTOR_MANAGER_H
|
|
||||||
#define GD_ACTOR_MANAGER_H
|
|
||||||
|
|
||||||
|
|
||||||
// Nel
|
|
||||||
#include "nel/misc/types_nl.h"
|
|
||||||
//#include "nel/net/message.h"
|
|
||||||
//#include "nel/net/unified_network.h"
|
|
||||||
|
|
||||||
// Local headers
|
|
||||||
#include "actor.h"
|
|
||||||
#include "actor_group.h"
|
|
||||||
|
|
||||||
#include <set>
|
|
||||||
|
|
||||||
namespace AGS_TEST
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Singleton, for managing the actors in a scene
|
|
||||||
* \author Sadge
|
|
||||||
* \author Nevrax France
|
|
||||||
* \date 2002
|
|
||||||
*/
|
|
||||||
class CActorManager
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
// initialisation and housekeeping for the singleton
|
|
||||||
static void init();
|
|
||||||
static void release();
|
|
||||||
|
|
||||||
// methods for dealing with tardy connection of a key service
|
|
||||||
static void reconnectEGS(uint8 serviceId);
|
|
||||||
static void reconnectIOS(uint8 serviceId);
|
|
||||||
static void reconnectGPMS(uint8 serviceId);
|
|
||||||
|
|
||||||
static void addVisionService(uint serviceId) { _visionHandlingServices.insert(serviceId); }
|
|
||||||
static void removeVisionService(uint serviceId) { _visionHandlingServices.erase(serviceId); }
|
|
||||||
|
|
||||||
// methods managing the actor set
|
|
||||||
// getActor() returns NULL if the actor doesn't exist
|
|
||||||
static CActor *newActor(const std::string &type, const std::string &name);
|
|
||||||
static void killActor(const std::string &name);
|
|
||||||
static CActor *getActor(const std::string &name);
|
|
||||||
static CActor *getActor(const NLMISC::CEntityId &id);
|
|
||||||
static CActor *getActor(unsigned index);
|
|
||||||
static uint32 numActors() { return _actors.size(); }
|
|
||||||
|
|
||||||
// Movement script management
|
|
||||||
static void update();
|
|
||||||
|
|
||||||
private:
|
|
||||||
// forbid instantiation
|
|
||||||
CActorManager();
|
|
||||||
|
|
||||||
// changed by ben -- std::vector<CActor> replaced by std::vector<CActor*> because highly unsafe (reallocs might occur)
|
|
||||||
// to avoid memory fragmentation, use NLMISC::CBlockMemory<CActor> instead
|
|
||||||
static std::vector<CActor*> _actors;
|
|
||||||
static int _nextActorID;
|
|
||||||
|
|
||||||
static std::set<uint> _visionHandlingServices;
|
|
||||||
|
|
||||||
public:
|
|
||||||
// changed by ben -- std::vector<CActorGroup> replaced by std::vector<CActorGroup*> because highly unsafe (reallocs might occur)
|
|
||||||
// to avoid memory fragmentation, use NLMISC::CBlockMemory<CActorGroup> instead
|
|
||||||
static std::vector<CActorGroup*> _actorGroups;
|
|
||||||
static CActorGroup * _defaultActorGroup;
|
|
||||||
|
|
||||||
static CActorGroup * newActorGroup(const std::string &name);
|
|
||||||
static CActorGroup * getActorGroup(const std::string &name);
|
|
||||||
static CActorGroup * getActorGroup(unsigned index);
|
|
||||||
static void removeActorGroup(const std::string &name);
|
|
||||||
|
|
||||||
static uint32 numActorGroups() { return _actorGroups.size(); }
|
|
||||||
|
|
||||||
static CActorGroup* getDefaultActorGroup() { return _defaultActorGroup; }
|
|
||||||
|
|
||||||
// move all actors from a group to another group
|
|
||||||
static void setActorsToGroup(const std::string &sourceActorGroup, const std::string &destActorGroup);
|
|
||||||
|
|
||||||
static sint32 getNextActorId() { return ++_nextActorID; }
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
} // end of namespace AGS_TEST
|
|
||||||
|
|
||||||
#endif // GD_ACTOR_MANAGER_H
|
|
||||||
/* End of actor_manager.h */
|
|
@ -1,149 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Nel Misc
|
|
||||||
#include "nel/misc/command.h"
|
|
||||||
#include "nel/misc/path.h"
|
|
||||||
|
|
||||||
// Game share
|
|
||||||
#include "game_share/container_property_receiver.h"
|
|
||||||
#include "game_share/msg_brick_service.h"
|
|
||||||
|
|
||||||
// Local includes
|
|
||||||
#include "ags_test.h"
|
|
||||||
#include "actor.h"
|
|
||||||
#include "actor_manager.h"
|
|
||||||
|
|
||||||
#include "../src/agent_game/combat_interface.h"
|
|
||||||
|
|
||||||
using namespace NLMISC;
|
|
||||||
using namespace NLNET;
|
|
||||||
using namespace std;
|
|
||||||
using namespace AGS_TEST;
|
|
||||||
|
|
||||||
|
|
||||||
CAgsTest* pAgsTest = NULL;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CallbackArray
|
|
||||||
*/
|
|
||||||
TUnifiedCallbackItem CallbackArray[] =
|
|
||||||
{
|
|
||||||
{ "AZERTY", NULL },
|
|
||||||
};
|
|
||||||
|
|
||||||
//---------------------------------------------------
|
|
||||||
// Service Init :
|
|
||||||
//
|
|
||||||
//---------------------------------------------------
|
|
||||||
void CAgsTest::init (void)
|
|
||||||
{
|
|
||||||
// Load the sheet id lookup table
|
|
||||||
|
|
||||||
// Initialise the actor manager
|
|
||||||
CActorManager::init();
|
|
||||||
|
|
||||||
// For windows speed update
|
|
||||||
setUpdateTimeout(100);
|
|
||||||
|
|
||||||
// keep the pointer on class if need use a methode
|
|
||||||
pAgsTest = this;
|
|
||||||
|
|
||||||
// init the Tick Event Handler
|
|
||||||
CTickEventHandler::init( serviceUpdate, cbSync );
|
|
||||||
|
|
||||||
// initialise the property receiver set
|
|
||||||
CContainerPropertyReceiver::initPropertyReceiver();
|
|
||||||
|
|
||||||
// init the combat interface
|
|
||||||
CCombatInterface::init();
|
|
||||||
|
|
||||||
// Init callback for service up / down
|
|
||||||
CUnifiedNetwork::getInstance()->setServiceUpCallback ("*", cbServiceUp, NULL);
|
|
||||||
CUnifiedNetwork::getInstance()->setServiceDownCallback( string("*"), cbServiceDown, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------
|
|
||||||
// Service update :
|
|
||||||
//
|
|
||||||
//---------------------------------------------------
|
|
||||||
bool CAgsTest::update (void)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------
|
|
||||||
// Service release :
|
|
||||||
//
|
|
||||||
//---------------------------------------------------
|
|
||||||
void CAgsTest::release (void)
|
|
||||||
{
|
|
||||||
CContainerPropertyReceiver::releaseAllPropertiesManagers();
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------
|
|
||||||
// Service update : Call at every ticks
|
|
||||||
//
|
|
||||||
//---------------------------------------------------
|
|
||||||
void CAgsTest::serviceUpdate(void)
|
|
||||||
{
|
|
||||||
CActorManager::update();
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************************************\
|
|
||||||
****************************************************************
|
|
||||||
Callback functions
|
|
||||||
****************************************************************
|
|
||||||
\****************************************************************/
|
|
||||||
// Callback called at service connexion
|
|
||||||
void cbServiceUp( const string& serviceName, uint16 serviceId, void * )
|
|
||||||
{
|
|
||||||
/*if (serviceName==std::string("EGS"))
|
|
||||||
CActorManager::reconnectEGS((uint8)serviceId);
|
|
||||||
|
|
||||||
if (serviceName==std::string("IOS"))
|
|
||||||
CActorManager::reconnectIOS((uint8)serviceId);
|
|
||||||
|
|
||||||
if (serviceName==std::string("GPMS"))
|
|
||||||
CActorManager::reconnectGPMS((uint8)serviceId);*/
|
|
||||||
}
|
|
||||||
|
|
||||||
// Callback called at service down
|
|
||||||
void cbServiceDown( const string& serviceName, uint16 serviceId, void * )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------
|
|
||||||
// cbSync, for service init with current time/tick if needed
|
|
||||||
//
|
|
||||||
//---------------------------------------------------
|
|
||||||
void cbSync()
|
|
||||||
{
|
|
||||||
} // cbSync //
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************\
|
|
||||||
****************************************************************
|
|
||||||
Service register
|
|
||||||
****************************************************************
|
|
||||||
\****************************************************************/
|
|
||||||
NLNET_SERVICE_MAIN (CAgsTest, "AgG", "ags_test_service", 0, CallbackArray, "", "")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
@ -1,66 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef GD_AGS_TEST_H
|
|
||||||
#define GD_AGS_TEST_H
|
|
||||||
|
|
||||||
// Nel Misc
|
|
||||||
#include "nel/misc/types_nl.h"
|
|
||||||
|
|
||||||
// Nel Net
|
|
||||||
#include "nel/net/service.h"
|
|
||||||
|
|
||||||
// Game share
|
|
||||||
#include "game_share/tick_event_handler.h"
|
|
||||||
|
|
||||||
|
|
||||||
// Callback called at service connexion
|
|
||||||
void cbServiceUp( const std::string& serviceName, uint16 serviceId, void * );
|
|
||||||
|
|
||||||
// Callback called at service down
|
|
||||||
void cbServiceDown( const std::string& serviceName, uint16 serviceId, void * );
|
|
||||||
|
|
||||||
// "Callbacks" for Tick service
|
|
||||||
void cbSync();
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <Class description>
|
|
||||||
* \author Alain Saffray
|
|
||||||
* \author Nevrax France
|
|
||||||
* \date 2001
|
|
||||||
*/
|
|
||||||
class CAgsTest : public NLNET::IService
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
// Initialisation of service
|
|
||||||
void init (void);
|
|
||||||
|
|
||||||
// Update net processing
|
|
||||||
bool update (void);
|
|
||||||
|
|
||||||
// Update service processing
|
|
||||||
static void serviceUpdate(void);
|
|
||||||
|
|
||||||
// Release the service
|
|
||||||
void release (void);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // GD_AGS_TEST_H
|
|
||||||
/* End of ags_test.h */
|
|
@ -1,51 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "ags_timer.h"
|
|
||||||
#include "game_share/tick_event_handler.h"
|
|
||||||
|
|
||||||
namespace AGS_TEST
|
|
||||||
{
|
|
||||||
CAGSTimer::CAGSTimer(uint32 dt /*= 0*/)
|
|
||||||
{
|
|
||||||
_dt = dt;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CAGSTimer::set(uint32 dt)
|
|
||||||
{
|
|
||||||
_start = (uint32)CTickEventHandler::getGameCycle();
|
|
||||||
_dt = dt;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CAGSTimer::add(uint32 dt)
|
|
||||||
{
|
|
||||||
_start = (uint32)CTickEventHandler::getGameCycle();
|
|
||||||
_dt += dt;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CAGSTimer::test()
|
|
||||||
{
|
|
||||||
uint32 curent = (uint32) CTickEventHandler::getGameCycle();
|
|
||||||
|
|
||||||
uint32 elapsed = curent - _start;
|
|
||||||
|
|
||||||
return ( elapsed >= _dt );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "nel/misc/types_nl.h"
|
|
||||||
|
|
||||||
namespace AGS_TEST
|
|
||||||
{
|
|
||||||
class CAGSTimer
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
uint32 _start;
|
|
||||||
uint32 _dt;
|
|
||||||
public:
|
|
||||||
CAGSTimer(uint32 dt = 0);
|
|
||||||
void set(uint32 dt);
|
|
||||||
void add(uint32 dt);
|
|
||||||
bool test();
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -1,440 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
#include "ai_mgr.h"
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
|
||||||
// singleton data declaration
|
|
||||||
|
|
||||||
std::vector <CAiMgrFile *> CAiMgr::_files;
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
|
||||||
// Utility functions
|
|
||||||
|
|
||||||
// generate indentation strings
|
|
||||||
static std::string tab(uint indent)
|
|
||||||
{
|
|
||||||
std::string s;
|
|
||||||
s.resize(indent,'\t');
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
// opening a STRUCT clause in output XML file
|
|
||||||
static void writeOpenStruct(FILE *outf, uint indent, std::string name=std::string())
|
|
||||||
{
|
|
||||||
if (name.empty())
|
|
||||||
fprintf(outf,"%s<STRUCT>\n",tab(1).c_str());
|
|
||||||
else
|
|
||||||
fprintf(outf,"%s<STRUCT Name=\"%s\">\n",tab(1).c_str(),name.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
// closing a STRUCT clause in output XML file
|
|
||||||
static void writeCloseStruct(FILE *outf, uint indent)
|
|
||||||
{
|
|
||||||
fprintf(outf,"%s</STRUCT>\n",tab(1).c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
// opening an ARRAY clause in output XML file
|
|
||||||
static void writeOpenArray(FILE *outf, uint indent, std::string name=std::string())
|
|
||||||
{
|
|
||||||
if (name.empty())
|
|
||||||
fprintf(outf,"%s<ARRAY>\n",tab(1).c_str());
|
|
||||||
else
|
|
||||||
fprintf(outf,"%s<ARRAY Name=\"%s\">\n",tab(1).c_str(),name.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
// closing an ARRAY clause in output XML file
|
|
||||||
static void writeCloseArray(FILE *outf, uint indent)
|
|
||||||
{
|
|
||||||
fprintf(outf,"%s</ARRAY>\n",tab(1).c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
// writing an ATOM clause in output XML file
|
|
||||||
static void writeAtom(FILE *outf, uint indent, std::string name, std::string value)
|
|
||||||
{
|
|
||||||
if (name.empty())
|
|
||||||
fprintf(outf,"%s<ATOM Value=\"%s\"/>\n",tab(indent).c_str(),value.c_str());
|
|
||||||
else
|
|
||||||
fprintf(outf,"%s<ATOM Name=\"%s\" Value=\"%s\"/>\n",tab(indent).c_str(),name.c_str(),value.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
static void writeAtom(FILE *outf, uint indent, std::string name, int value)
|
|
||||||
{
|
|
||||||
if (name.empty())
|
|
||||||
fprintf(outf,"%s<ATOMValue=\"%d\"/>\n",tab(indent).c_str(),value);
|
|
||||||
else
|
|
||||||
fprintf(outf,"%s<ATOM Name=\"%s\" Value=\"%d\"/>\n",tab(indent).c_str(),name.c_str(),value);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void writeAtom(FILE *outf, uint indent, std::string name, double value)
|
|
||||||
{
|
|
||||||
if (name.empty())
|
|
||||||
fprintf(outf,"%s<ATOM Value=\"%f\"/>\n",tab(indent).c_str(),value);
|
|
||||||
else
|
|
||||||
fprintf(outf,"%s<ATOM Name=\"%s\" Value=\"%f\"/>\n",tab(indent).c_str(),name.c_str(),value);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
|
||||||
// Display
|
|
||||||
// display contents of hierarchy
|
|
||||||
|
|
||||||
void CAiMgrSpawn::display(uint indent, NLMISC::CLog *log)
|
|
||||||
{
|
|
||||||
log->displayNL("%sSPAWN:",tab(indent).c_str());
|
|
||||||
log->displayNL("%s%s",tab(indent+1).c_str(),_place.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
void CAiMgrPopulation::display(uint indent, NLMISC::CLog *log)
|
|
||||||
{
|
|
||||||
log->displayNL("%sPOPULATION: %s",tab(indent).c_str(),_name.c_str());
|
|
||||||
|
|
||||||
log->displayNL("%stype: %s",tab(indent+1).c_str(),_creatureType.toString().c_str());
|
|
||||||
log->displayNL("%scount: %i",tab(indent+1).c_str(),_quantity);
|
|
||||||
log->displayNL("%sface: pi * %4.2f",tab(indent+1).c_str(),_orientation/3.14159265359);
|
|
||||||
log->displayNL("%sspawn: %i..%i ms",tab(indent+1).c_str(),_minTime,_maxTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CAiMgrLocation::display(uint indent, NLMISC::CLog *log)
|
|
||||||
{
|
|
||||||
log->displayNL("%sLOCATION: %s",tab(indent).c_str(),_name.c_str());
|
|
||||||
|
|
||||||
log->displayNL("%stype: %s",tab(indent+1).c_str(),_type.c_str());
|
|
||||||
log->displayNL("%spatat: %s",tab(indent+1).c_str(),_boundary.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
void CAiMgrInstance::display(uint indent, NLMISC::CLog *log)
|
|
||||||
{
|
|
||||||
log->displayNL("%sMANAGER: %s",tab(indent).c_str(),_name.c_str());
|
|
||||||
|
|
||||||
log->displayNL("%spatat: %s",tab(indent+1).c_str(),_boundary.c_str());
|
|
||||||
log->displayNL("%slimit: %i",tab(indent+1).c_str(),_creatureLimit);
|
|
||||||
|
|
||||||
uint i;
|
|
||||||
for (i=0;i<_spawn.size();i++) _spawn[i]->display(indent+1);
|
|
||||||
for (i=0;i<_population.size();i++) _population[i]->display(indent+1);
|
|
||||||
for (i=0;i<_location.size();i++) _location[i]->display(indent+1);
|
|
||||||
|
|
||||||
for (i=0;i<_children.size();i++) _children[i]->display(indent+1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CAiMgrFile::display(uint indent, NLMISC::CLog *log)
|
|
||||||
{
|
|
||||||
log->displayNL("%sFILE: %s",tab(indent).c_str(),_filename.c_str());
|
|
||||||
|
|
||||||
log->displayNL("%sprim file: %s",tab(indent+1).c_str(),_primFilename.c_str());
|
|
||||||
|
|
||||||
uint i;
|
|
||||||
for (i=0;i<_children.size();i++) _children[i]->display(indent+1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CAiMgr::display(uint indent, NLMISC::CLog *log)
|
|
||||||
{
|
|
||||||
log->displayNL("%sDISPLAYING PARSED AI_MANAGER FILE CONTENTS",tab(indent).c_str());
|
|
||||||
|
|
||||||
uint i;
|
|
||||||
for (i=0;i<_files.size();i++) _files[i]->display(indent+1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
|
||||||
// Read
|
|
||||||
// read .AI_MGR 'george' files
|
|
||||||
|
|
||||||
void CAiMgrSpawn::read()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void CAiMgrPopulation::read()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void CAiMgrLocation::read()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void CAiMgrInstance::read()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void CAiMgrFile::read()
|
|
||||||
{
|
|
||||||
// read a .AI_MGR file and parse the contents
|
|
||||||
}
|
|
||||||
|
|
||||||
void CAiMgr::read(std::string path,bool recursive)
|
|
||||||
{
|
|
||||||
// recurse through sub directories looking for ai manager files to read
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
|
||||||
// Write
|
|
||||||
// write .AI_MGR 'george' files
|
|
||||||
|
|
||||||
void CAiMgrSpawn::write(FILE *outf,uint indent)
|
|
||||||
{
|
|
||||||
writeAtom(outf,indent,"",_place.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
void CAiMgrPopulation::write(FILE *outf,uint indent)
|
|
||||||
{
|
|
||||||
writeOpenStruct(outf,indent,_name);
|
|
||||||
|
|
||||||
// writing the static fields
|
|
||||||
writeAtom(outf,indent+1,"Name",_name);
|
|
||||||
writeAtom(outf,indent+1,"CreatureType",_creatureType.toString());
|
|
||||||
writeAtom(outf,indent+1,"Population",_quantity);
|
|
||||||
writeAtom(outf,indent+1,"MinSpawnTime",_minTime);
|
|
||||||
writeAtom(outf,indent+1,"MaxSpawnTime",_maxTime);
|
|
||||||
writeAtom(outf,indent+1,"Orientation",_orientation);
|
|
||||||
|
|
||||||
writeCloseStruct(outf,indent);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CAiMgrLocation::write(FILE *outf,uint indent)
|
|
||||||
{
|
|
||||||
writeOpenStruct(outf,indent,_name);
|
|
||||||
|
|
||||||
// writing the static fields
|
|
||||||
writeAtom(outf,indent+1,"Name",_name);
|
|
||||||
writeAtom(outf,indent+1,"LocationType",_type);
|
|
||||||
writeAtom(outf,indent+1,"Boundary",_boundary);
|
|
||||||
|
|
||||||
writeCloseStruct(outf,indent);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CAiMgrInstance::write(FILE *outf,uint indent)
|
|
||||||
{
|
|
||||||
uint i;
|
|
||||||
|
|
||||||
writeOpenStruct(outf,indent,_name);
|
|
||||||
|
|
||||||
// writing the static fields
|
|
||||||
writeAtom(outf,indent+1,"Name",_name);
|
|
||||||
writeAtom(outf,indent+1,"Boundary",_boundary);
|
|
||||||
writeAtom(outf,indent+1,"CreatureLimit",_creatureLimit);
|
|
||||||
|
|
||||||
// writing spawn points
|
|
||||||
if (!_spawn.empty())
|
|
||||||
{
|
|
||||||
writeOpenArray(outf,indent+1,"Spawn");
|
|
||||||
for (i=0;i<_spawn.size();i++) _spawn[i]->write(outf,indent+2);
|
|
||||||
writeCloseArray(outf,indent+1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// writing populations
|
|
||||||
if (!_population.empty())
|
|
||||||
{
|
|
||||||
writeOpenArray(outf,indent+1,"Population");
|
|
||||||
for (i=0;i<_population.size();i++) _population[i]->write(outf,indent+2);
|
|
||||||
writeCloseArray(outf,indent+1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// writing locations
|
|
||||||
if (!_location.empty())
|
|
||||||
{
|
|
||||||
writeOpenArray(outf,indent+1,"Location");
|
|
||||||
for (i=0;i<_location.size();i++) _location[i]->write(outf,indent+2);
|
|
||||||
writeCloseArray(outf,indent+1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// writing children
|
|
||||||
if (!_children.empty())
|
|
||||||
{
|
|
||||||
writeOpenArray(outf,indent+1,"Children");
|
|
||||||
for (i=0;i<_children.size();i++) _children[i]->write(outf,indent+2);
|
|
||||||
writeCloseArray(outf,indent+1);
|
|
||||||
}
|
|
||||||
|
|
||||||
writeCloseStruct(outf,indent);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CAiMgrFile::write()
|
|
||||||
{
|
|
||||||
// opening the file
|
|
||||||
FILE *outf=fopen(_filename.c_str(),"wt");
|
|
||||||
if (outf==0)
|
|
||||||
{
|
|
||||||
nlwarning("Failed to open file for writing: %s",_filename.c_str());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
nlinfo("WRITING: %s",_filename.c_str());
|
|
||||||
|
|
||||||
// writing the file header
|
|
||||||
fprintf(outf,"<?xml version=\"1.0\"?>\n");
|
|
||||||
fprintf(outf,"<FORM Version=\"0.1\" State=\"modified\">\n");
|
|
||||||
writeOpenStruct(outf,1);
|
|
||||||
|
|
||||||
// writing the static fields
|
|
||||||
writeAtom(outf,2,"Name",_filename);
|
|
||||||
writeAtom(outf,2,"Prim",_primFilename);
|
|
||||||
|
|
||||||
// iterating through the managers to be written to the file
|
|
||||||
uint i;
|
|
||||||
writeOpenArray(outf,2,"Child");
|
|
||||||
for (i=0;i<_children.size();i++)
|
|
||||||
_children[i]->write(outf,3);
|
|
||||||
writeCloseArray(outf,2);
|
|
||||||
|
|
||||||
// writing the file footer
|
|
||||||
writeCloseStruct(outf,1);
|
|
||||||
fprintf(outf,"</FORM>\n");
|
|
||||||
|
|
||||||
// closing the file
|
|
||||||
fclose(outf);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CAiMgr::write()
|
|
||||||
{
|
|
||||||
uint i;
|
|
||||||
for (i=0;i<_files.size();i++)
|
|
||||||
_files[i]->write();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
|
||||||
// Test
|
|
||||||
// test code to test the interfaces of the different classes
|
|
||||||
|
|
||||||
void CAiMgrSpawn::test()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void CAiMgrPopulation::test()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void CAiMgrLocation::test()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void CAiMgrInstance::test()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void CAiMgrFile::test()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void CAiMgr::test()
|
|
||||||
{
|
|
||||||
CAiMgrSpawn *aiMgrSpawn0 = new CAiMgrSpawn;
|
|
||||||
CAiMgrSpawn *aiMgrSpawn1 = new CAiMgrSpawn;
|
|
||||||
CAiMgrSpawn *aiMgrSpawn2 = new CAiMgrSpawn;
|
|
||||||
CAiMgrPopulation *aiMgrPopulation0 = new CAiMgrPopulation;
|
|
||||||
CAiMgrPopulation *aiMgrPopulation1 = new CAiMgrPopulation;
|
|
||||||
CAiMgrPopulation *aiMgrPopulation2 = new CAiMgrPopulation;
|
|
||||||
CAiMgrLocation *aiMgrLocation0 = new CAiMgrLocation;
|
|
||||||
CAiMgrLocation *aiMgrLocation1 = new CAiMgrLocation;
|
|
||||||
CAiMgrLocation *aiMgrLocation2 = new CAiMgrLocation;
|
|
||||||
CAiMgrInstance *aiMgrInstance0 = new CAiMgrInstance;
|
|
||||||
CAiMgrInstance *aiMgrInstance1 = new CAiMgrInstance;
|
|
||||||
CAiMgrInstance *aiMgrInstance2 = new CAiMgrInstance;
|
|
||||||
CAiMgrFile *aiMgrFile0 = new CAiMgrFile;
|
|
||||||
CAiMgrFile *aiMgrFile1 = new CAiMgrFile;
|
|
||||||
CAiMgrFile *aiMgrFile2 = new CAiMgrFile;
|
|
||||||
|
|
||||||
//--------------------------------------
|
|
||||||
|
|
||||||
aiMgrSpawn0->setPlace("aiMgrSpawn0");
|
|
||||||
aiMgrSpawn1->setPlace("aiMgrSpawn1");
|
|
||||||
aiMgrSpawn2->setPlace("aiMgrSpawn2");
|
|
||||||
|
|
||||||
//--------------------------------------
|
|
||||||
|
|
||||||
aiMgrPopulation0->setName("aiMgrPopulation0_name");
|
|
||||||
aiMgrPopulation0->setType(NLMISC::CSheetId("aiMgrPopulation0_type"));
|
|
||||||
aiMgrPopulation0->setQuantity(0);
|
|
||||||
aiMgrPopulation0->setOrientation(0);
|
|
||||||
aiMgrPopulation0->setSpawnRate(0,1);
|
|
||||||
|
|
||||||
aiMgrPopulation1->setName("aiMgrPopulation1_name");
|
|
||||||
aiMgrPopulation1->setType(NLMISC::CSheetId("aiMgrPopulation1_type"));
|
|
||||||
aiMgrPopulation1->setQuantity(1);
|
|
||||||
aiMgrPopulation1->setOrientation(3.14159265359f/2.0f);
|
|
||||||
aiMgrPopulation1->setSpawnRate(2,3);
|
|
||||||
|
|
||||||
aiMgrPopulation2->setName("aiMgrPopulation2_name");
|
|
||||||
aiMgrPopulation2->setType(NLMISC::CSheetId("aiMgrPopulation2_type"));
|
|
||||||
aiMgrPopulation2->setQuantity(2);
|
|
||||||
aiMgrPopulation2->setOrientation(3.14159265359f);
|
|
||||||
aiMgrPopulation2->setSpawnRate(4,5);
|
|
||||||
|
|
||||||
//--------------------------------------
|
|
||||||
|
|
||||||
aiMgrLocation0->setName("aiMgrLocation0_name");
|
|
||||||
aiMgrLocation0->setType("aiMgrLocation0_type");
|
|
||||||
aiMgrLocation0->setBoundary("aiMgrLocation0_boundary");
|
|
||||||
|
|
||||||
aiMgrLocation1->setName("aiMgrLocation1_name");
|
|
||||||
aiMgrLocation1->setType("aiMgrLocation1_type");
|
|
||||||
aiMgrLocation1->setBoundary("aiMgrLocation1_boundary");
|
|
||||||
|
|
||||||
aiMgrLocation2->setName("aiMgrLocation2_name");
|
|
||||||
aiMgrLocation2->setType("aiMgrLocation2_type");
|
|
||||||
aiMgrLocation2->setBoundary("aiMgrLocation2_boundary");
|
|
||||||
|
|
||||||
//--------------------------------------
|
|
||||||
|
|
||||||
aiMgrInstance0->setName("aiMgrInstance0");
|
|
||||||
aiMgrInstance0->setBoundary("boundary0");
|
|
||||||
aiMgrInstance0->setCreatureLimit(0);
|
|
||||||
|
|
||||||
aiMgrInstance1->setName("aiMgrInstance1");
|
|
||||||
aiMgrInstance1->setBoundary("boundary1");
|
|
||||||
aiMgrInstance1->setCreatureLimit(1);
|
|
||||||
|
|
||||||
aiMgrInstance2->setName("aiMgrInstance2");
|
|
||||||
aiMgrInstance2->setBoundary("boundary2");
|
|
||||||
aiMgrInstance2->setCreatureLimit(2);
|
|
||||||
|
|
||||||
aiMgrInstance1->addSpawn(aiMgrSpawn0);
|
|
||||||
aiMgrInstance1->addSpawn(aiMgrSpawn1);
|
|
||||||
aiMgrInstance1->addSpawn(aiMgrSpawn2);
|
|
||||||
|
|
||||||
aiMgrInstance1->addPopulation(aiMgrPopulation0);
|
|
||||||
aiMgrInstance1->addPopulation(aiMgrPopulation1);
|
|
||||||
aiMgrInstance1->addPopulation(aiMgrPopulation2);
|
|
||||||
|
|
||||||
aiMgrInstance1->addLocation(aiMgrLocation0);
|
|
||||||
aiMgrInstance1->addLocation(aiMgrLocation1);
|
|
||||||
aiMgrInstance1->addLocation(aiMgrLocation2);
|
|
||||||
|
|
||||||
aiMgrInstance1->addChild(aiMgrInstance2);
|
|
||||||
|
|
||||||
//--------------------------------------
|
|
||||||
|
|
||||||
aiMgrFile0->setName("aiMgrFile0");
|
|
||||||
aiMgrFile0->setPrim("prim0.prim");
|
|
||||||
|
|
||||||
aiMgrFile1->setName("aiMgrFile1");
|
|
||||||
aiMgrFile0->setPrim("prim1.prim");
|
|
||||||
|
|
||||||
aiMgrFile2->setName("aiMgrFile2");
|
|
||||||
aiMgrFile0->setPrim("prim2.prim");
|
|
||||||
|
|
||||||
aiMgrFile1->addChild(aiMgrInstance0);
|
|
||||||
aiMgrFile1->addChild(aiMgrInstance1);
|
|
||||||
|
|
||||||
//--------------------------------------
|
|
||||||
|
|
||||||
CAiMgr::addFile(aiMgrFile0);
|
|
||||||
CAiMgr::addFile(aiMgrFile1);
|
|
||||||
CAiMgr::addFile(aiMgrFile2);
|
|
||||||
}
|
|
||||||
|
|
@ -1,207 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
// some stuff for manageing the output of AI_MANAGER files
|
|
||||||
|
|
||||||
/*
|
|
||||||
===========================================================================
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------
|
|
||||||
** Common methods of the following classes:
|
|
||||||
|
|
||||||
display(uint indent=0)
|
|
||||||
display the class and all of its child classes recursively
|
|
||||||
the indent parameter gives the display indentation depth
|
|
||||||
|
|
||||||
read()
|
|
||||||
read the class and its child classes from a file recursively
|
|
||||||
|
|
||||||
write()
|
|
||||||
write the class and its child classes to an output file recursively
|
|
||||||
|
|
||||||
test()
|
|
||||||
runs the class' test routine
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------
|
|
||||||
** The list of classes includes:
|
|
||||||
|
|
||||||
CAiMgrSpawn - A spawn point or spawn zone within an ai manager
|
|
||||||
CAiMgrPopulation - A population of creatures within an ai manager
|
|
||||||
CAiMgrLocation - A location with type (eg grass, denn, etc) within an ai manager
|
|
||||||
CAiMgrInstance - An individual AI manager
|
|
||||||
CAiMgrFile - The collection of AI managers loaded from or to be saved to a file
|
|
||||||
|
|
||||||
CAiMgr - The singleton that contains the collection of CAiMgrFiles
|
|
||||||
|
|
||||||
===========================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
// includes
|
|
||||||
|
|
||||||
#include "nel/misc/types_nl.h"
|
|
||||||
#include "nel/misc/sheet_id.h"
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
// class to manage a spawn point or patat for an ai manager
|
|
||||||
|
|
||||||
class CAiMgrSpawn
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
void setPlace(std::string place) {_place=place;}
|
|
||||||
public:
|
|
||||||
void display(uint indent=0,NLMISC::CLog *log = NLMISC::InfoLog);
|
|
||||||
void read();
|
|
||||||
void write(FILE *outf,uint indent);
|
|
||||||
void test();
|
|
||||||
private:
|
|
||||||
std::string _place; // names of patat or point (or x y z)
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
// class to manage a bot population for an ai manager
|
|
||||||
|
|
||||||
class CAiMgrPopulation
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
void setName(std::string name) {_name=name;}
|
|
||||||
void setType(NLMISC::CSheetId creatureType) {_creatureType=creatureType;}
|
|
||||||
void setQuantity(int quantity) {_quantity=quantity;}
|
|
||||||
void setOrientation(float orientation) {_orientation=orientation;}
|
|
||||||
void setSpawnRate(int minTimeMS, int maxTimeMS) {_minTime=minTimeMS; _maxTime=maxTimeMS;}
|
|
||||||
public:
|
|
||||||
void display(uint indent=0,NLMISC::CLog *log = NLMISC::InfoLog);
|
|
||||||
void read();
|
|
||||||
void write(FILE *outf,uint indent);
|
|
||||||
void test();
|
|
||||||
private:
|
|
||||||
std::string _name;
|
|
||||||
NLMISC::CSheetId _creatureType;
|
|
||||||
int _quantity;
|
|
||||||
float _orientation;
|
|
||||||
int _minTime;
|
|
||||||
int _maxTime;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
// class to manage a location patat for an ai manager
|
|
||||||
|
|
||||||
class CAiMgrLocation
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
void setName(std::string name) {_name=name;}
|
|
||||||
void setType(std::string type) {_type=type;}
|
|
||||||
void setBoundary(std::string boundary) {_boundary=boundary;}
|
|
||||||
public:
|
|
||||||
void display(uint indent=0,NLMISC::CLog *log = NLMISC::InfoLog);
|
|
||||||
void read();
|
|
||||||
void write(FILE *outf,uint indent);
|
|
||||||
void test();
|
|
||||||
private:
|
|
||||||
std::string _name;
|
|
||||||
std::string _type;
|
|
||||||
std::string _boundary;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
// class to manage an instance of an ai manager
|
|
||||||
|
|
||||||
class CAiMgrInstance
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
void setName(const std::string &name) {_name=name;}
|
|
||||||
void setBoundary(const std::string &boundary) {_boundary=boundary;}
|
|
||||||
void setCreatureLimit(int creatureLimit) {_creatureLimit=creatureLimit;}
|
|
||||||
|
|
||||||
void addSpawn(CAiMgrSpawn *spawn) {_spawn.push_back(spawn);}
|
|
||||||
void addPopulation(CAiMgrPopulation *population) {_population.push_back(population);}
|
|
||||||
void addLocation(CAiMgrLocation *location) {_location.push_back(location);}
|
|
||||||
|
|
||||||
void addChild(CAiMgrInstance *mgr) {_children.push_back(mgr);}
|
|
||||||
public:
|
|
||||||
void display(uint indent=0,NLMISC::CLog *log = NLMISC::InfoLog);
|
|
||||||
void read();
|
|
||||||
void write(FILE *outf,uint indent);
|
|
||||||
void test();
|
|
||||||
private:
|
|
||||||
std::string _name;
|
|
||||||
std::string _boundary;
|
|
||||||
int _creatureLimit;
|
|
||||||
|
|
||||||
std::vector <CAiMgrSpawn *> _spawn;
|
|
||||||
std::vector <CAiMgrPopulation *> _population;
|
|
||||||
std::vector <CAiMgrLocation *> _location;
|
|
||||||
|
|
||||||
std::vector <CAiMgrInstance *> _children;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
// class to manage the set of ai managers stored in a given file
|
|
||||||
|
|
||||||
class CAiMgrFile
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
void setName(std::string filename) {_filename=filename;}
|
|
||||||
void setPrim(std::string primFilename) {_primFilename=primFilename;}
|
|
||||||
void addChild(CAiMgrInstance *mgr) {_children.push_back(mgr);}
|
|
||||||
public:
|
|
||||||
const std::string &getName() {return _filename;}
|
|
||||||
const std::string &getPrim() {return _primFilename;}
|
|
||||||
const CAiMgrInstance *getChild(uint i) {return _children[i];}
|
|
||||||
uint getChildCount() {return _children.size();}
|
|
||||||
public:
|
|
||||||
void display(uint indent=0,NLMISC::CLog *log = NLMISC::InfoLog);
|
|
||||||
void read();
|
|
||||||
void write();
|
|
||||||
void test();
|
|
||||||
private:
|
|
||||||
std::string _filename;
|
|
||||||
std::string _primFilename;
|
|
||||||
|
|
||||||
std::vector <CAiMgrInstance *> _children;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
// singleton manager of CAiMgrFile instances
|
|
||||||
|
|
||||||
class CAiMgr
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static void addFile(CAiMgrFile *file) {_files.push_back(file);}
|
|
||||||
public:
|
|
||||||
static void display(uint indent=0,NLMISC::CLog *log = NLMISC::InfoLog);
|
|
||||||
static void read(std::string path,bool recursive=true);
|
|
||||||
static void write();
|
|
||||||
static void test();
|
|
||||||
private:
|
|
||||||
static std::vector <CAiMgrFile *> _files;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
File diff suppressed because it is too large
Load Diff
@ -1,230 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef NL_COMMAND_EVENT_MANAGER_H
|
|
||||||
#define NL_COMMAND_EVENT_MANAGER_H
|
|
||||||
|
|
||||||
#include "nel/misc/types_nl.h"
|
|
||||||
#include "nel/misc/common.h"
|
|
||||||
#include "nel/misc/debug.h"
|
|
||||||
#include "nel/misc/command.h"
|
|
||||||
#include "nel/misc/eval_num_expr.h"
|
|
||||||
#include "nel/net/unified_network.h"
|
|
||||||
|
|
||||||
#include <map>
|
|
||||||
#include <vector>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A Manager that triggers events and is receptive to events
|
|
||||||
* \author Benjamin Legros
|
|
||||||
* \author Nevrax France
|
|
||||||
* \date 2001
|
|
||||||
*/
|
|
||||||
class CCommandEventManager
|
|
||||||
{
|
|
||||||
friend void cbProcessScriptEvent( NLNET::CMessage& msgin, const std::string &serviceName, uint16 serviceId );
|
|
||||||
|
|
||||||
public:
|
|
||||||
/// A type of variable, basically consisting in a name and a value (as a string)
|
|
||||||
typedef std::pair<std::string, std::string> TVar;
|
|
||||||
|
|
||||||
/// The variable environment of a script
|
|
||||||
class CEnvironment : public NLMISC::CEvalNumExpr
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
/// The map type of vars
|
|
||||||
typedef std::map<std::string, std::string> TVarMap;
|
|
||||||
|
|
||||||
/// The map of vars itself
|
|
||||||
TVarMap _Map;
|
|
||||||
|
|
||||||
/// The empty string
|
|
||||||
std::string _Empty;
|
|
||||||
|
|
||||||
public:
|
|
||||||
CEnvironment() : _Empty("") {}
|
|
||||||
|
|
||||||
/// Clear the whole environment
|
|
||||||
void clear() { _Map.clear(); }
|
|
||||||
/// Checks if var exists
|
|
||||||
bool exists(const std::string &var) { return _Map.find(var) != _Map.end(); }
|
|
||||||
/// Get the value of a var
|
|
||||||
const std::string &get(const std::string &var) { TVarMap::iterator it=_Map.find(var); return (it!=_Map.end()) ? (*it).second : _Empty; }
|
|
||||||
/// Set the value of a var
|
|
||||||
const std::string &set(const std::string &var, const std::string &value)
|
|
||||||
{
|
|
||||||
std::pair<TVarMap::iterator, bool> res = _Map.insert(std::make_pair(var, value));
|
|
||||||
if (!res.second)
|
|
||||||
(*(res.first)).second = value;
|
|
||||||
return (*(res.first)).second;
|
|
||||||
}
|
|
||||||
/// Erases a var
|
|
||||||
void erase(const std::string &var) { _Map.erase(var); }
|
|
||||||
/// Replaces text by value in string (variable must have the form $(variable) to be replaced by their value)
|
|
||||||
std::string replace(const std::string &text);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual NLMISC::CEvalNumExpr::TReturnState evalValue(const char *value, double &result)
|
|
||||||
{
|
|
||||||
TVarMap::iterator it;
|
|
||||||
if (*value == '?')
|
|
||||||
{
|
|
||||||
it = _Map.find(value+1);
|
|
||||||
if (it == _Map.end())
|
|
||||||
result = 0.0;
|
|
||||||
else
|
|
||||||
result = 1.0;
|
|
||||||
return NLMISC::CEvalNumExpr::NoError;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
it = _Map.find(value);
|
|
||||||
if (it == _Map.end())
|
|
||||||
return NLMISC::CEvalNumExpr::UnkownValue;
|
|
||||||
result = atof((*it).second.c_str());
|
|
||||||
return NLMISC::CEvalNumExpr::NoError;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class CScript;
|
|
||||||
|
|
||||||
/// A script node
|
|
||||||
class CScriptNode
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
enum EState
|
|
||||||
{
|
|
||||||
Ok,
|
|
||||||
Error,
|
|
||||||
Halt,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// The line in the script for this node
|
|
||||||
uint Line;
|
|
||||||
|
|
||||||
/// Current running script
|
|
||||||
CScriptNode *CurrentRun;
|
|
||||||
|
|
||||||
/// The root script
|
|
||||||
CScript *Root;
|
|
||||||
|
|
||||||
public:
|
|
||||||
/// default constructor
|
|
||||||
CScriptNode() : Line(0), CurrentRun(NULL) {}
|
|
||||||
|
|
||||||
/// virtual destructor
|
|
||||||
virtual ~CScriptNode() {}
|
|
||||||
|
|
||||||
/// Execute the script node, returns the next node to be executed, or NULL if script finished
|
|
||||||
virtual EState execute(CEnvironment &env) = 0;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
/// Execute current node (previous run returned halt)
|
|
||||||
EState goOnCurrentRun(CEnvironment &env)
|
|
||||||
{
|
|
||||||
if (!CurrentRun)
|
|
||||||
return Error;
|
|
||||||
|
|
||||||
EState state = CurrentRun->execute(env);
|
|
||||||
if (state == Ok)
|
|
||||||
CurrentRun = NULL;
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Execute child
|
|
||||||
EState executeChild(CScriptNode* child, CEnvironment &env)
|
|
||||||
{
|
|
||||||
EState state = child->execute(env);
|
|
||||||
if (state == Halt || state == Error)
|
|
||||||
CurrentRun = child;
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/// The script class that receives events, generates events, and triggers commands
|
|
||||||
class CScript
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
/// The name of the script
|
|
||||||
std::string Name;
|
|
||||||
/// The script environment
|
|
||||||
CEnvironment Environment;
|
|
||||||
/// The script text
|
|
||||||
CScriptNode *Root;
|
|
||||||
/// Verbosity
|
|
||||||
bool Verbose;
|
|
||||||
|
|
||||||
/// Constructor.
|
|
||||||
CScript(const std::string &name) : Name(name), Verbose(false) {}
|
|
||||||
|
|
||||||
///
|
|
||||||
bool parse(const char *text);
|
|
||||||
|
|
||||||
/// Inits script before execution with no default parameters
|
|
||||||
void init() { init(std::vector<TVar>()); }
|
|
||||||
|
|
||||||
/// Inits script before execution, using default parameters
|
|
||||||
void init(const std::vector<TVar> &initVars)
|
|
||||||
{
|
|
||||||
uint i;
|
|
||||||
for (i=0; i<initVars.size(); ++i)
|
|
||||||
Environment.set(initVars[i].first, initVars[i].second);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Runs script till it is finished or it waits for an event
|
|
||||||
bool run();
|
|
||||||
};
|
|
||||||
|
|
||||||
private:
|
|
||||||
typedef std::map<std::string, CScript*> TScriptMap;
|
|
||||||
static TScriptMap _RunningScripts;
|
|
||||||
static std::string _Empty;
|
|
||||||
|
|
||||||
public:
|
|
||||||
static void init();
|
|
||||||
static void release();
|
|
||||||
|
|
||||||
static bool update();
|
|
||||||
|
|
||||||
static bool runScript(const std::string &scriptName, const std::string &scriptFile, bool verbose=false);
|
|
||||||
static bool stopScript(const std::string &scriptName);
|
|
||||||
static const std::string &getVarInScript(const std::string &scriptName, const std::string &varName);
|
|
||||||
static void setVarInScript(const std::string &scriptName, const std::string &varName, const std::string &value);
|
|
||||||
static void eraseVarInScript(const std::string &scriptName, const std::string &varName);
|
|
||||||
|
|
||||||
static void sendEvent(const std::string &var, const std::string &value);
|
|
||||||
|
|
||||||
static void setScriptVerbose(const std::string &scriptName, bool verbosity=true);
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
/// Constructor
|
|
||||||
CCommandEventManager();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
//
|
|
||||||
static void processEvent(const std::string &var, const std::string &value);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif // NL_COMMAND_EVENT_MANAGER_H
|
|
||||||
|
|
||||||
/* End of command_event_manager.h */
|
|
File diff suppressed because it is too large
Load Diff
@ -1,105 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Misc
|
|
||||||
#include "nel/misc/path.h"
|
|
||||||
#include "nel/misc/file.h"
|
|
||||||
#include "nel/misc/smart_ptr.h"
|
|
||||||
#include "nel/misc/command.h"
|
|
||||||
// Georges
|
|
||||||
//#include "nel/georges/u_form.h"
|
|
||||||
//#include "nel/georges/u_form_elm.h"
|
|
||||||
//#include "nel/georges/u_form_loader.h"
|
|
||||||
#include "nel/georges/load_form.h"
|
|
||||||
// Local
|
|
||||||
#include "creatures.h"
|
|
||||||
|
|
||||||
|
|
||||||
///////////
|
|
||||||
// USING //
|
|
||||||
///////////
|
|
||||||
using namespace NLMISC;
|
|
||||||
using namespace std;
|
|
||||||
using namespace NLGEORGES;
|
|
||||||
|
|
||||||
namespace AGS_TEST
|
|
||||||
{
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
// the singleton data
|
|
||||||
|
|
||||||
std::map<CSheetId,CCreatures::CCreatureRecord> CCreatures::_creatures;
|
|
||||||
bool CCreatures::_initialised=false;
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
// init
|
|
||||||
|
|
||||||
void CCreatures::init()
|
|
||||||
{
|
|
||||||
if (_initialised)
|
|
||||||
return;
|
|
||||||
|
|
||||||
std::vector<std::string> filters;
|
|
||||||
filters.push_back("creature");
|
|
||||||
filters.push_back("player");
|
|
||||||
|
|
||||||
loadForm(filters, "ags.packed_sheets", _creatures);
|
|
||||||
|
|
||||||
_initialised=true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
// display
|
|
||||||
|
|
||||||
void CCreatures::display()
|
|
||||||
{
|
|
||||||
nlassert(_initialised);
|
|
||||||
|
|
||||||
std::map<CSheetId,CCreatures::CCreatureRecord>::iterator it;
|
|
||||||
for(it=_creatures.begin();it!=_creatures.end();++it)
|
|
||||||
{
|
|
||||||
nlinfo("CREATURE: %s Walk: %f Run: %f",(*it).first.toString().c_str(),
|
|
||||||
(*it).second._walkSpeed,(*it).second._runSpeed);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
// lookup
|
|
||||||
|
|
||||||
const CCreatures::CCreatureRecord *CCreatures::lookup( CSheetId id )
|
|
||||||
{
|
|
||||||
nlassert(_initialised);
|
|
||||||
|
|
||||||
// setup an iterator and lookup the sheet id in the map
|
|
||||||
std::map<CSheetId,CCreatures::CCreatureRecord>::iterator it;
|
|
||||||
it=_creatures.find(id);
|
|
||||||
|
|
||||||
// if we found a valid entry return a pointer to the creature record otherwise 0
|
|
||||||
if (it!=_creatures.end())
|
|
||||||
return &((*it).second);
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} // end of namespace AGS_TEST
|
|
@ -1,88 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef AGST_CREATURE_H
|
|
||||||
#define AGST_CREATURE_H
|
|
||||||
|
|
||||||
// Nel Misc
|
|
||||||
#include "nel/misc/types_nl.h"
|
|
||||||
#include "nel/misc/smart_ptr.h"
|
|
||||||
|
|
||||||
#include "nel/georges/u_form.h"
|
|
||||||
#include "nel/georges/u_form_elm.h"
|
|
||||||
|
|
||||||
// Game share
|
|
||||||
#include "nel/misc/sheet_id.h"
|
|
||||||
|
|
||||||
namespace AGS_TEST
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Singleton containing database on information on creatures
|
|
||||||
* \author Sadge
|
|
||||||
* \author Nevrax France
|
|
||||||
* \date 2002
|
|
||||||
*/
|
|
||||||
class CCreatures
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
class CCreatureRecord
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
CCreatureRecord () : _walkSpeed(1.3f), _runSpeed(6.0f) {}
|
|
||||||
|
|
||||||
float _walkSpeed;
|
|
||||||
float _runSpeed;
|
|
||||||
|
|
||||||
void readGeorges (const NLMISC::CSmartPtr<NLGEORGES::UForm> &form, const NLMISC::CSheetId &sheetId)
|
|
||||||
{
|
|
||||||
// the form was found so read the true values from George
|
|
||||||
form->getRootNode ().getValueByName (_walkSpeed, "Basics.MovementSpeeds.WalkSpeed");
|
|
||||||
form->getRootNode ().getValueByName (_runSpeed, "Basics.MovementSpeeds.RunSpeed");
|
|
||||||
}
|
|
||||||
|
|
||||||
void serial (NLMISC::IStream &s)
|
|
||||||
{
|
|
||||||
s.serial (_walkSpeed, _runSpeed);
|
|
||||||
}
|
|
||||||
|
|
||||||
static uint getVersion () { return 1; }
|
|
||||||
};
|
|
||||||
|
|
||||||
// load the creature data from the george files
|
|
||||||
static void init();
|
|
||||||
|
|
||||||
// display the creature data for all known creature types
|
|
||||||
static void display();
|
|
||||||
|
|
||||||
// get a creature data record from the database
|
|
||||||
static const CCreatureRecord *lookup( NLMISC::CSheetId id );
|
|
||||||
|
|
||||||
private:
|
|
||||||
// prohibit cnstructor as this is a singleton
|
|
||||||
CCreatures();
|
|
||||||
|
|
||||||
static std::map<NLMISC::CSheetId,CCreatureRecord> _creatures;
|
|
||||||
static bool _initialised;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // end of namespace AGS_TEST
|
|
||||||
|
|
||||||
#endif // AGST_CREATURE_H
|
|
||||||
/* End of creatures.h */
|
|
@ -1,579 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
typedef char * TFileName;
|
|
||||||
|
|
||||||
TFileName IGFiles[]=
|
|
||||||
{
|
|
||||||
"10_ai.ig",
|
|
||||||
"10_aj.ig",
|
|
||||||
"10_ak.ig",
|
|
||||||
"10_al.ig",
|
|
||||||
"10_am.ig",
|
|
||||||
"10_an.ig",
|
|
||||||
"10_ao.ig",
|
|
||||||
"10_ap.ig",
|
|
||||||
"10_aq.ig",
|
|
||||||
"10_ar.ig",
|
|
||||||
"10_as.ig",
|
|
||||||
"10_at.ig",
|
|
||||||
"10_au.ig",
|
|
||||||
"10_av.ig",
|
|
||||||
"10_aw.ig",
|
|
||||||
"10_ax.ig",
|
|
||||||
"10_ay.ig",
|
|
||||||
"10_az.ig",
|
|
||||||
"10_ba.ig",
|
|
||||||
"10_bb.ig",
|
|
||||||
"10_bc.ig",
|
|
||||||
"10_bd.ig",
|
|
||||||
"10_be.ig",
|
|
||||||
"11_ai.ig",
|
|
||||||
"11_aj.ig",
|
|
||||||
"11_ak.ig",
|
|
||||||
"11_al.ig",
|
|
||||||
"11_am.ig",
|
|
||||||
"11_an.ig",
|
|
||||||
"11_ao.ig",
|
|
||||||
"11_ap.ig",
|
|
||||||
"11_aq.ig",
|
|
||||||
"11_ar.ig",
|
|
||||||
"11_as.ig",
|
|
||||||
"11_at.ig",
|
|
||||||
"11_au.ig",
|
|
||||||
"11_av.ig",
|
|
||||||
"11_aw.ig",
|
|
||||||
"11_ax.ig",
|
|
||||||
"11_ay.ig",
|
|
||||||
"11_az.ig",
|
|
||||||
"11_ba.ig",
|
|
||||||
"11_bb.ig",
|
|
||||||
"11_bc.ig",
|
|
||||||
"11_bd.ig",
|
|
||||||
"11_be.ig",
|
|
||||||
"12_ai.ig",
|
|
||||||
"12_aj.ig",
|
|
||||||
"12_ak.ig",
|
|
||||||
"12_al.ig",
|
|
||||||
"12_am.ig",
|
|
||||||
"12_an.ig",
|
|
||||||
"12_ao.ig",
|
|
||||||
"12_ap.ig",
|
|
||||||
"12_aq.ig",
|
|
||||||
"12_ar.ig",
|
|
||||||
"12_as.ig",
|
|
||||||
"12_at.ig",
|
|
||||||
"12_au.ig",
|
|
||||||
"12_av.ig",
|
|
||||||
"12_aw.ig",
|
|
||||||
"12_ax.ig",
|
|
||||||
"12_ay.ig",
|
|
||||||
"12_az.ig",
|
|
||||||
"12_ba.ig",
|
|
||||||
"12_bb.ig",
|
|
||||||
"12_bc.ig",
|
|
||||||
"12_bd.ig",
|
|
||||||
"13_ai.ig",
|
|
||||||
"13_aj.ig",
|
|
||||||
"13_ak.ig",
|
|
||||||
"13_al.ig",
|
|
||||||
"13_am.ig",
|
|
||||||
"13_an.ig",
|
|
||||||
"13_ao.ig",
|
|
||||||
"13_ap.ig",
|
|
||||||
"13_aq.ig",
|
|
||||||
"13_ar.ig",
|
|
||||||
"13_as.ig",
|
|
||||||
"13_at.ig",
|
|
||||||
"13_au.ig",
|
|
||||||
"13_av.ig",
|
|
||||||
"13_aw.ig",
|
|
||||||
"13_ax.ig",
|
|
||||||
"13_ay.ig",
|
|
||||||
"13_az.ig",
|
|
||||||
"13_ba.ig",
|
|
||||||
"14_aj.ig",
|
|
||||||
"14_ak.ig",
|
|
||||||
"14_al.ig",
|
|
||||||
"14_am.ig",
|
|
||||||
"14_an.ig",
|
|
||||||
"14_ao.ig",
|
|
||||||
"14_ap.ig",
|
|
||||||
"14_aq.ig",
|
|
||||||
"14_ar.ig",
|
|
||||||
"14_as.ig",
|
|
||||||
"14_at.ig",
|
|
||||||
"14_au.ig",
|
|
||||||
"14_av.ig",
|
|
||||||
"14_aw.ig",
|
|
||||||
"14_ax.ig",
|
|
||||||
"15_al.ig",
|
|
||||||
"15_am.ig",
|
|
||||||
"15_an.ig",
|
|
||||||
"15_ao.ig",
|
|
||||||
"15_ap.ig",
|
|
||||||
"15_aq.ig",
|
|
||||||
"15_ar.ig",
|
|
||||||
"15_as.ig",
|
|
||||||
"15_at.ig",
|
|
||||||
"15_au.ig",
|
|
||||||
"15_av.ig",
|
|
||||||
"15_aw.ig",
|
|
||||||
"16_am.ig",
|
|
||||||
"16_an.ig",
|
|
||||||
"16_ao.ig",
|
|
||||||
"16_ap.ig",
|
|
||||||
"16_aq.ig",
|
|
||||||
"16_ar.ig",
|
|
||||||
"16_as.ig",
|
|
||||||
"16_at.ig",
|
|
||||||
"16_au.ig",
|
|
||||||
"16_av.ig",
|
|
||||||
"16_aw.ig",
|
|
||||||
"17_am.ig",
|
|
||||||
"17_an.ig",
|
|
||||||
"17_ao.ig",
|
|
||||||
"17_ap.ig",
|
|
||||||
"17_as.ig",
|
|
||||||
"17_at.ig",
|
|
||||||
"17_au.ig",
|
|
||||||
"17_av.ig",
|
|
||||||
"17_aw.ig",
|
|
||||||
"17_ax.ig",
|
|
||||||
"17_ay.ig",
|
|
||||||
"17_az.ig",
|
|
||||||
"18_at.ig",
|
|
||||||
"18_au.ig",
|
|
||||||
"18_av.ig",
|
|
||||||
"18_aw.ig",
|
|
||||||
"18_ax.ig",
|
|
||||||
"18_ay.ig",
|
|
||||||
"18_az.ig",
|
|
||||||
"19_at.ig",
|
|
||||||
"19_au.ig",
|
|
||||||
"19_av.ig",
|
|
||||||
"19_aw.ig",
|
|
||||||
"19_ax.ig",
|
|
||||||
"19_ay.ig",
|
|
||||||
"19_az.ig",
|
|
||||||
"19_ba.ig",
|
|
||||||
"19_bb.ig",
|
|
||||||
"20_au.ig",
|
|
||||||
"20_av.ig",
|
|
||||||
"20_aw.ig",
|
|
||||||
"20_ax.ig",
|
|
||||||
"20_ay.ig",
|
|
||||||
"20_az.ig",
|
|
||||||
"20_ba.ig",
|
|
||||||
"20_bb.ig",
|
|
||||||
"20_bc.ig",
|
|
||||||
"20_bd.ig",
|
|
||||||
"20_be.ig",
|
|
||||||
"21_aw.ig",
|
|
||||||
"21_ax.ig",
|
|
||||||
"21_ay.ig",
|
|
||||||
"21_az.ig",
|
|
||||||
"21_ba.ig",
|
|
||||||
"21_bb.ig",
|
|
||||||
"21_bc.ig",
|
|
||||||
"21_bd.ig",
|
|
||||||
"21_be.ig",
|
|
||||||
"22_aw.ig",
|
|
||||||
"22_ax.ig",
|
|
||||||
"22_ay.ig",
|
|
||||||
"22_az.ig",
|
|
||||||
"22_ba.ig",
|
|
||||||
"22_bb.ig",
|
|
||||||
"22_bc.ig",
|
|
||||||
"22_bd.ig",
|
|
||||||
"22_be.ig",
|
|
||||||
"23_av.ig",
|
|
||||||
"23_aw.ig",
|
|
||||||
"23_ax.ig",
|
|
||||||
"23_ay.ig",
|
|
||||||
"23_az.ig",
|
|
||||||
"23_ba.ig",
|
|
||||||
"23_bb.ig",
|
|
||||||
"23_bc.ig",
|
|
||||||
"23_bd.ig",
|
|
||||||
"23_be.ig",
|
|
||||||
"24_av.ig",
|
|
||||||
"24_aw.ig",
|
|
||||||
"24_ax.ig",
|
|
||||||
"24_ay.ig",
|
|
||||||
"24_az.ig",
|
|
||||||
"24_ba.ig",
|
|
||||||
"24_bb.ig",
|
|
||||||
"24_bc.ig",
|
|
||||||
"24_bd.ig",
|
|
||||||
"24_be.ig",
|
|
||||||
"25_av.ig",
|
|
||||||
"25_aw.ig",
|
|
||||||
"25_ax.ig",
|
|
||||||
"25_ay.ig",
|
|
||||||
"25_az.ig",
|
|
||||||
"25_ba.ig",
|
|
||||||
"25_bb.ig",
|
|
||||||
"25_bc.ig",
|
|
||||||
"26_az.ig",
|
|
||||||
"26_ba.ig",
|
|
||||||
"26_bb.ig",
|
|
||||||
"26_bc.ig",
|
|
||||||
"26_bd.ig",
|
|
||||||
"26_be.ig",
|
|
||||||
"26_bf.ig",
|
|
||||||
"27_az.ig",
|
|
||||||
"27_ba.ig",
|
|
||||||
"27_bb.ig",
|
|
||||||
"27_bc.ig",
|
|
||||||
"27_bd.ig",
|
|
||||||
"27_be.ig",
|
|
||||||
"27_bf.ig",
|
|
||||||
"28_az.ig",
|
|
||||||
"28_ba.ig",
|
|
||||||
"28_bb.ig",
|
|
||||||
"28_bc.ig",
|
|
||||||
"28_bd.ig",
|
|
||||||
"28_be.ig",
|
|
||||||
"28_bf.ig",
|
|
||||||
"29_bb.ig",
|
|
||||||
"29_bc.ig",
|
|
||||||
"29_bd.ig",
|
|
||||||
"29_be.ig",
|
|
||||||
"29_bf.ig",
|
|
||||||
"30_bb.ig",
|
|
||||||
"30_bc.ig",
|
|
||||||
"30_bd.ig",
|
|
||||||
"30_be.ig",
|
|
||||||
"30_bf.ig",
|
|
||||||
"31_ay.ig",
|
|
||||||
"31_az.ig",
|
|
||||||
"31_ba.ig",
|
|
||||||
"31_bb.ig",
|
|
||||||
"31_bc.ig",
|
|
||||||
"31_bd.ig",
|
|
||||||
"31_be.ig",
|
|
||||||
"32_ax.ig",
|
|
||||||
"32_ay.ig",
|
|
||||||
"32_az.ig",
|
|
||||||
"32_ba.ig",
|
|
||||||
"32_bb.ig",
|
|
||||||
"32_bc.ig",
|
|
||||||
"32_bd.ig",
|
|
||||||
"32_be.ig",
|
|
||||||
"32_bf.ig",
|
|
||||||
"33_aw.ig",
|
|
||||||
"33_ax.ig",
|
|
||||||
"33_ay.ig",
|
|
||||||
"33_az.ig",
|
|
||||||
"33_ba.ig",
|
|
||||||
"33_bb.ig",
|
|
||||||
"33_bc.ig",
|
|
||||||
"33_bd.ig",
|
|
||||||
"33_be.ig",
|
|
||||||
"33_bf.ig",
|
|
||||||
"34_aw.ig",
|
|
||||||
"34_ax.ig",
|
|
||||||
"34_ay.ig",
|
|
||||||
"34_az.ig",
|
|
||||||
"34_ba.ig",
|
|
||||||
"34_bb.ig",
|
|
||||||
"34_bc.ig",
|
|
||||||
"34_bd.ig",
|
|
||||||
"34_be.ig",
|
|
||||||
"34_bf.ig",
|
|
||||||
"34_bg.ig",
|
|
||||||
"35_av.ig",
|
|
||||||
"35_aw.ig",
|
|
||||||
"35_ax.ig",
|
|
||||||
"35_ay.ig",
|
|
||||||
"35_az.ig",
|
|
||||||
"35_ba.ig",
|
|
||||||
"35_bb.ig",
|
|
||||||
"35_bc.ig",
|
|
||||||
"35_bd.ig",
|
|
||||||
"35_be.ig",
|
|
||||||
"35_bf.ig",
|
|
||||||
"35_bg.ig",
|
|
||||||
"36_av.ig",
|
|
||||||
"36_aw.ig",
|
|
||||||
"36_ax.ig",
|
|
||||||
"36_ay.ig",
|
|
||||||
"36_az.ig",
|
|
||||||
"36_ba.ig",
|
|
||||||
"36_bb.ig",
|
|
||||||
"36_bc.ig",
|
|
||||||
"36_bd.ig",
|
|
||||||
"36_be.ig",
|
|
||||||
"36_bf.ig",
|
|
||||||
"36_bg.ig",
|
|
||||||
"36_bh.ig",
|
|
||||||
"36_bi.ig",
|
|
||||||
"36_bj.ig",
|
|
||||||
"36_bk.ig",
|
|
||||||
"36_bl.ig",
|
|
||||||
"36_bm.ig",
|
|
||||||
"37_aw.ig",
|
|
||||||
"37_ax.ig",
|
|
||||||
"37_ay.ig",
|
|
||||||
"37_az.ig",
|
|
||||||
"37_ba.ig",
|
|
||||||
"37_bb.ig",
|
|
||||||
"37_bc.ig",
|
|
||||||
"37_bd.ig",
|
|
||||||
"37_be.ig",
|
|
||||||
"37_bf.ig",
|
|
||||||
"37_bg.ig",
|
|
||||||
"37_bh.ig",
|
|
||||||
"37_bi.ig",
|
|
||||||
"37_bj.ig",
|
|
||||||
"37_bk.ig",
|
|
||||||
"37_bl.ig",
|
|
||||||
"37_bm.ig",
|
|
||||||
"38_aw.ig",
|
|
||||||
"38_ax.ig",
|
|
||||||
"38_ay.ig",
|
|
||||||
"38_az.ig",
|
|
||||||
"38_ba.ig",
|
|
||||||
"38_bb.ig",
|
|
||||||
"38_bd.ig",
|
|
||||||
"38_be.ig",
|
|
||||||
"38_bf.ig",
|
|
||||||
"38_bg.ig",
|
|
||||||
"38_bh.ig",
|
|
||||||
"38_bi.ig",
|
|
||||||
"38_bj.ig",
|
|
||||||
"38_bk.ig",
|
|
||||||
"38_bl.ig",
|
|
||||||
"38_bm.ig",
|
|
||||||
"39_aw.ig",
|
|
||||||
"39_ax.ig",
|
|
||||||
"39_ay.ig",
|
|
||||||
"39_az.ig",
|
|
||||||
"39_ba.ig",
|
|
||||||
"39_bb.ig",
|
|
||||||
"39_bf.ig",
|
|
||||||
"39_bg.ig",
|
|
||||||
"39_bh.ig",
|
|
||||||
"39_bi.ig",
|
|
||||||
"39_bj.ig",
|
|
||||||
"39_bk.ig",
|
|
||||||
"39_bl.ig",
|
|
||||||
"39_bm.ig",
|
|
||||||
"3_af.ig",
|
|
||||||
"3_ag.ig",
|
|
||||||
"3_ah.ig",
|
|
||||||
"3_ai.ig",
|
|
||||||
"3_aj.ig",
|
|
||||||
"3_ak.ig",
|
|
||||||
"3_bc.ig",
|
|
||||||
"3_bd.ig",
|
|
||||||
"3_be.ig",
|
|
||||||
"40_aw.ig",
|
|
||||||
"40_ax.ig",
|
|
||||||
"40_ay.ig",
|
|
||||||
"40_az.ig",
|
|
||||||
"40_ba.ig",
|
|
||||||
"40_bb.ig",
|
|
||||||
"40_bc.ig",
|
|
||||||
"40_bf.ig",
|
|
||||||
"40_bg.ig",
|
|
||||||
"40_bh.ig",
|
|
||||||
"40_bi.ig",
|
|
||||||
"40_bj.ig",
|
|
||||||
"40_bk.ig",
|
|
||||||
"40_bl.ig",
|
|
||||||
"40_bm.ig",
|
|
||||||
"41_aw.ig",
|
|
||||||
"41_ax.ig",
|
|
||||||
"41_ay.ig",
|
|
||||||
"41_az.ig",
|
|
||||||
"41_ba.ig",
|
|
||||||
"41_bb.ig",
|
|
||||||
"41_bc.ig",
|
|
||||||
"41_be.ig",
|
|
||||||
"41_bf.ig",
|
|
||||||
"41_bg.ig",
|
|
||||||
"41_bh.ig",
|
|
||||||
"41_bi.ig",
|
|
||||||
"41_bj.ig",
|
|
||||||
"41_bk.ig",
|
|
||||||
"42_ax.ig",
|
|
||||||
"42_ay.ig",
|
|
||||||
"42_az.ig",
|
|
||||||
"42_ba.ig",
|
|
||||||
"42_bb.ig",
|
|
||||||
"42_be.ig",
|
|
||||||
"42_bf.ig",
|
|
||||||
"42_bg.ig",
|
|
||||||
"42_bh.ig",
|
|
||||||
"42_bi.ig",
|
|
||||||
"42_bj.ig",
|
|
||||||
"42_bk.ig",
|
|
||||||
"43_ax.ig",
|
|
||||||
"43_ay.ig",
|
|
||||||
"43_az.ig",
|
|
||||||
"43_ba.ig",
|
|
||||||
"43_bb.ig",
|
|
||||||
"43_be.ig",
|
|
||||||
"43_bf.ig",
|
|
||||||
"43_bg.ig",
|
|
||||||
"43_bh.ig",
|
|
||||||
"43_bi.ig",
|
|
||||||
"43_bj.ig",
|
|
||||||
"43_bk.ig",
|
|
||||||
"44_bf.ig",
|
|
||||||
"44_bg.ig",
|
|
||||||
"44_bh.ig",
|
|
||||||
"44_bi.ig",
|
|
||||||
"44_bj.ig",
|
|
||||||
"44_bk.ig",
|
|
||||||
"45_bg.ig",
|
|
||||||
"45_bh.ig",
|
|
||||||
"45_bi.ig",
|
|
||||||
"45_bj.ig",
|
|
||||||
"45_bk.ig",
|
|
||||||
"46_bh.ig",
|
|
||||||
"46_bi.ig",
|
|
||||||
"46_bj.ig",
|
|
||||||
"46_bk.ig",
|
|
||||||
"46_bl.ig",
|
|
||||||
"47_bh.ig",
|
|
||||||
"47_bi.ig",
|
|
||||||
"47_bj.ig",
|
|
||||||
"47_bk.ig",
|
|
||||||
"47_bl.ig",
|
|
||||||
"48_bh.ig",
|
|
||||||
"48_bi.ig",
|
|
||||||
"48_bj.ig",
|
|
||||||
"48_bk.ig",
|
|
||||||
"48_bl.ig",
|
|
||||||
"49_bh.ig",
|
|
||||||
"49_bi.ig",
|
|
||||||
"49_bj.ig",
|
|
||||||
"4_ac.ig",
|
|
||||||
"4_ad.ig",
|
|
||||||
"4_ae.ig",
|
|
||||||
"4_af.ig",
|
|
||||||
"4_ag.ig",
|
|
||||||
"4_ah.ig",
|
|
||||||
"4_ai.ig",
|
|
||||||
"4_aj.ig",
|
|
||||||
"4_ak.ig",
|
|
||||||
"4_ay.ig",
|
|
||||||
"4_az.ig",
|
|
||||||
"4_ba.ig",
|
|
||||||
"4_bb.ig",
|
|
||||||
"4_bc.ig",
|
|
||||||
"4_bd.ig",
|
|
||||||
"4_be.ig",
|
|
||||||
"4_bf.ig",
|
|
||||||
"5_ac.ig",
|
|
||||||
"5_ad.ig",
|
|
||||||
"5_ae.ig",
|
|
||||||
"5_af.ig",
|
|
||||||
"5_ag.ig",
|
|
||||||
"5_ah.ig",
|
|
||||||
"5_ai.ig",
|
|
||||||
"5_aj.ig",
|
|
||||||
"5_ak.ig",
|
|
||||||
"5_al.ig",
|
|
||||||
"5_ay.ig",
|
|
||||||
"5_az.ig",
|
|
||||||
"5_ba.ig",
|
|
||||||
"5_bb.ig",
|
|
||||||
"5_bc.ig",
|
|
||||||
"5_bd.ig",
|
|
||||||
"5_be.ig",
|
|
||||||
"5_bf.ig",
|
|
||||||
"5_bg.ig",
|
|
||||||
"6_ac.ig",
|
|
||||||
"6_ad.ig",
|
|
||||||
"6_ae.ig",
|
|
||||||
"6_af.ig",
|
|
||||||
"6_ag.ig",
|
|
||||||
"6_ah.ig",
|
|
||||||
"6_ai.ig",
|
|
||||||
"6_aj.ig",
|
|
||||||
"6_ak.ig",
|
|
||||||
"6_al.ig",
|
|
||||||
"6_ay.ig",
|
|
||||||
"6_az.ig",
|
|
||||||
"6_ba.ig",
|
|
||||||
"6_bb.ig",
|
|
||||||
"6_bc.ig",
|
|
||||||
"6_bd.ig",
|
|
||||||
"6_be.ig",
|
|
||||||
"6_bf.ig",
|
|
||||||
"6_bg.ig",
|
|
||||||
"7_ac.ig",
|
|
||||||
"7_ad.ig",
|
|
||||||
"7_ae.ig",
|
|
||||||
"7_af.ig",
|
|
||||||
"7_ag.ig",
|
|
||||||
"7_ah.ig",
|
|
||||||
"7_ai.ig",
|
|
||||||
"7_aj.ig",
|
|
||||||
"7_ak.ig",
|
|
||||||
"7_al.ig",
|
|
||||||
"7_ay.ig",
|
|
||||||
"7_az.ig",
|
|
||||||
"7_ba.ig",
|
|
||||||
"7_bb.ig",
|
|
||||||
"7_bc.ig",
|
|
||||||
"7_bd.ig",
|
|
||||||
"7_be.ig",
|
|
||||||
"7_bf.ig",
|
|
||||||
"7_bg.ig",
|
|
||||||
"8_af.ig",
|
|
||||||
"8_ag.ig",
|
|
||||||
"8_ah.ig",
|
|
||||||
"8_ai.ig",
|
|
||||||
"8_aj.ig",
|
|
||||||
"8_ak.ig",
|
|
||||||
"8_ax.ig",
|
|
||||||
"8_ay.ig",
|
|
||||||
"8_az.ig",
|
|
||||||
"8_ba.ig",
|
|
||||||
"8_bb.ig",
|
|
||||||
"8_bc.ig",
|
|
||||||
"8_bd.ig",
|
|
||||||
"8_be.ig",
|
|
||||||
"9_af.ig",
|
|
||||||
"9_ag.ig",
|
|
||||||
"9_ah.ig",
|
|
||||||
"9_ai.ig",
|
|
||||||
"9_aj.ig",
|
|
||||||
"9_ak.ig",
|
|
||||||
"9_am.ig",
|
|
||||||
"9_an.ig",
|
|
||||||
"9_ao.ig",
|
|
||||||
"9_ap.ig",
|
|
||||||
"9_aq.ig",
|
|
||||||
"9_ar.ig",
|
|
||||||
"9_as.ig",
|
|
||||||
"9_at.ig",
|
|
||||||
"9_au.ig",
|
|
||||||
"9_av.ig",
|
|
||||||
"9_ax.ig",
|
|
||||||
"9_ay.ig",
|
|
||||||
"9_az.ig",
|
|
||||||
"9_ba.ig",
|
|
||||||
"9_bb.ig",
|
|
||||||
"9_bc.ig",
|
|
||||||
"9_bd.ig",
|
|
||||||
"9_be.ig"
|
|
||||||
};
|
|
@ -1,53 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
#include "nel/misc/common.h"
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#include "ig_loader.h"
|
|
||||||
#include "ig_list.h"
|
|
||||||
|
|
||||||
using namespace NL3D;
|
|
||||||
using namespace NLMISC;
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
void CIGLoader::load()
|
|
||||||
{
|
|
||||||
for (int i=sizeof(IGFiles)/sizeof(IGFiles[0]);i--;)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
uint k;
|
|
||||||
CInstanceGroup ig;
|
|
||||||
CIFile inputStream;
|
|
||||||
if (!inputStream.open(IGFiles[i]))
|
|
||||||
{
|
|
||||||
nlinfo("unable to open %s", argv[1]);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
ig.serial(inputStream);
|
|
||||||
CVector gpos = ig.getGlobalPos(); // the origin for the ig
|
|
||||||
for(k = 0; k < ig._InstancesInfos.size(); ++k)
|
|
||||||
{
|
|
||||||
nlinfo("instance %s : x = %.1f, y = %.1f, z = %.1f, sx = %.1f, sy = %.1f, sz = %.1f", ig._InstancesInfos[k].Name.c_str(), ig._InstancesInfos[k].Pos.x + gpos.x, ig._InstancesInfos[k].Pos.y + gpos.y, ig._InstancesInfos[k].Pos.z + gpos.z, ig._InstancesInfos[k].Scale.x, ig._InstancesInfos[k].Scale.y, ig._InstancesInfos[k].Scale.z);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (std::exception &e)
|
|
||||||
{
|
|
||||||
nlinfo(e.what());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,136 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Nel Misc
|
|
||||||
// #include "nel/misc/command.h"
|
|
||||||
// #include "nel/misc/path.h"
|
|
||||||
|
|
||||||
// Game share
|
|
||||||
//#include "game_share/sid.h"
|
|
||||||
|
|
||||||
// Local headers
|
|
||||||
#include "macro_manager.h"
|
|
||||||
|
|
||||||
using namespace NLMISC;
|
|
||||||
//using namespace NLNET;
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
|
|
||||||
namespace AGS_TEST
|
|
||||||
{
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
// static data for CMacroManager
|
|
||||||
|
|
||||||
std::vector<CMacroManager::CMacro> CMacroManager::_macros;
|
|
||||||
bool CMacroManager::_recording=false;
|
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
// basic functionality for CMacroManager singleton
|
|
||||||
|
|
||||||
void CMacroManager::init()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void CMacroManager::release()
|
|
||||||
{
|
|
||||||
_macros.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// display functions
|
|
||||||
void CMacroManager::listMacros(NLMISC::CLog *log)
|
|
||||||
{
|
|
||||||
log->displayNL("Macro list:");
|
|
||||||
std::vector<CMacro>::iterator it;
|
|
||||||
for (it=_macros.begin(); it!=_macros.end(); ++it)
|
|
||||||
{
|
|
||||||
log->displayNL("\t%s",(*it)._name.c_str());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CMacroManager::displayMacro(const std::string &name, NLMISC::CLog *log)
|
|
||||||
{
|
|
||||||
std::vector<CMacro>::iterator it;
|
|
||||||
for (it=_macros.begin(); it!=_macros.end(); ++it)
|
|
||||||
{
|
|
||||||
if ((*it)._name==name)
|
|
||||||
{
|
|
||||||
log->displayNL("MACRO: %s",name.c_str());
|
|
||||||
std::vector<CMacroManager::CMacro::TMacroCommand>::iterator mit;
|
|
||||||
for(mit=(*it)._commands.begin();mit!=(*it)._commands.end();++mit)
|
|
||||||
{
|
|
||||||
std::string hold;
|
|
||||||
std::vector<std::string>::iterator ait;
|
|
||||||
for(ait=(*mit)._args.begin();ait!=(*mit)._args.end();++ait)
|
|
||||||
hold=hold+std::string(" ")+(*ait);
|
|
||||||
log->displayNL("\t\t%s",hold.c_str());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void CMacroManager::recordMacro(const std::string &name)
|
|
||||||
{
|
|
||||||
// if a macro already exists by this name then delete it
|
|
||||||
std::vector<CMacro>::iterator it;
|
|
||||||
for (it=_macros.begin(); it!=_macros.end(); ++it)
|
|
||||||
{
|
|
||||||
if ((*it)._name==name)
|
|
||||||
{
|
|
||||||
_macros.erase(it);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// create the new macro record
|
|
||||||
CMacroManager::CMacro newMacro;
|
|
||||||
newMacro._name=name;
|
|
||||||
_macros.push_back(newMacro);
|
|
||||||
|
|
||||||
// setup the recording flag
|
|
||||||
_recording=true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CMacroManager::record(NLMISC::ICommand *command,const std::vector<std::string> &args)
|
|
||||||
{
|
|
||||||
_macros[_macros.size()-1].record(command,args);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void CMacroManager::execute(const std::string &name, NLMISC::CLog &log)
|
|
||||||
{
|
|
||||||
std::vector<CMacro>::iterator it;
|
|
||||||
for (it=_macros.begin(); it!=_macros.end(); ++it)
|
|
||||||
if ((*it)._name==name)
|
|
||||||
{
|
|
||||||
nlinfo("Executing macro: %s",name.c_str());
|
|
||||||
(*it).execute(log);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} // end of namespace AGS_TEST
|
|
@ -1,99 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef GD_MACRO_MANAGER_H
|
|
||||||
#define GD_MACRO_MANAGER_H
|
|
||||||
|
|
||||||
|
|
||||||
// Nel Misc
|
|
||||||
#include "nel/misc/types_nl.h"
|
|
||||||
#include "nel/misc/command.h"
|
|
||||||
|
|
||||||
namespace AGS_TEST
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Singleton, for managing the macros in a scene
|
|
||||||
* \author Sadge
|
|
||||||
* \author Nevrax France
|
|
||||||
* \date 2002
|
|
||||||
*/
|
|
||||||
class CMacroManager
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
// initialisation and housekeeping for the singleton
|
|
||||||
static void init();
|
|
||||||
static void release();
|
|
||||||
|
|
||||||
// methods dealing with macro recording
|
|
||||||
static void recordMacro(const std::string &name);
|
|
||||||
static void record(NLMISC::ICommand *command,const std::vector<std::string> &args);
|
|
||||||
static void stopRecord() { _recording=false; }
|
|
||||||
static bool recording() { return _recording; }
|
|
||||||
|
|
||||||
// executing a macro
|
|
||||||
static void execute(const std::string &name, NLMISC::CLog &log);
|
|
||||||
|
|
||||||
// display functions
|
|
||||||
static void listMacros(NLMISC::CLog *log = NLMISC::InfoLog);
|
|
||||||
static void displayMacro(const std::string &name,NLMISC::CLog *log = NLMISC::InfoLog);
|
|
||||||
|
|
||||||
private:
|
|
||||||
class CMacro
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
std::string _name;
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
NLMISC::ICommand *_command;
|
|
||||||
std::vector<std::string> _args;
|
|
||||||
} TMacroCommand;
|
|
||||||
std::vector<TMacroCommand> _commands;
|
|
||||||
|
|
||||||
void record(NLMISC::ICommand *command,const std::vector<std::string> &args)
|
|
||||||
{
|
|
||||||
TMacroCommand newCommand;
|
|
||||||
newCommand._command=command;
|
|
||||||
newCommand._args=args;
|
|
||||||
_commands.push_back(newCommand);
|
|
||||||
}
|
|
||||||
void execute(NLMISC::CLog &log)
|
|
||||||
{
|
|
||||||
std::vector<TMacroCommand>::iterator it;
|
|
||||||
for(it=_commands.begin();it!=_commands.end();++it)
|
|
||||||
it->_command->execute(it->_args, log, true);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// forbid instantiation
|
|
||||||
CMacroManager();
|
|
||||||
static std::vector<CMacro> _macros;
|
|
||||||
static bool _recording;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#define COMMAND_MACRO_RECORD_TEST\
|
|
||||||
if (CMacroManager::recording()) {CMacroManager::record(this,args); return true;}
|
|
||||||
|
|
||||||
|
|
||||||
} // end of namespace AGS_TEST
|
|
||||||
|
|
||||||
#endif // GD_MACRO_MANAGER_H
|
|
||||||
/* End of macro_manager.h */
|
|
@ -1,197 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// include files
|
|
||||||
#include "nel/misc/types_nl.h"
|
|
||||||
#include "nel/misc/vectord.h"
|
|
||||||
#include "game_share/tick_event_handler.h"
|
|
||||||
|
|
||||||
#include "messages.h"
|
|
||||||
#include "mirrors.h"
|
|
||||||
#include "actor_manager.h"
|
|
||||||
|
|
||||||
using namespace NLMISC;
|
|
||||||
using namespace NLNET;
|
|
||||||
using namespace AGS_TEST;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
// the callback table
|
|
||||||
|
|
||||||
/*
|
|
||||||
static void cbEngageFight( NLNET::CMessage& msgin, const std::string &serviceName, uint16 serviceId );
|
|
||||||
static void cbUpdateFightBehaviour( NLNET::CMessage& msgin, const std::string &serviceName, uint16 serviceId );
|
|
||||||
static void cbUpdateFightPosition( NLNET::CMessage& msgin, const std::string &serviceName, uint16 serviceId );
|
|
||||||
static void cbUpdateFightEnd( NLNET::CMessage& msgin, const std::string &serviceName, uint16 serviceId );
|
|
||||||
static void cbAckVisionZone( NLNET::CMessage& msgin, const std::string &serviceName, uint16 serviceId );
|
|
||||||
static void cbAIVision( NLNET::CMessage& msgin, const std::string &serviceName, uint16 serviceId );
|
|
||||||
|
|
||||||
TUnifiedCallbackItem CbArray[] =
|
|
||||||
{
|
|
||||||
|
|
||||||
{ "ENGAGE_FIGHT", cbEngageFight, },
|
|
||||||
{ "U_FIGHT_BEHAVIOUR", cbUpdateFightBehaviour, },
|
|
||||||
{ "U_FIGHT_POS", cbUpdateFightPosition, },
|
|
||||||
{ "U_END_FIGHT", cbUpdateFightEnd, },
|
|
||||||
{ "U_FIGHT_END", cbUpdateFightEnd, },
|
|
||||||
|
|
||||||
{ "ACK_VISION_ZONE", cbAckVisionZone, },
|
|
||||||
{ "AGENT_VISION", cbAIVision, },
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
// singleton initialisation and release
|
|
||||||
|
|
||||||
void CMessages::init()
|
|
||||||
{
|
|
||||||
// setup the callback array
|
|
||||||
//CUnifiedNetwork::getInstance()->addCallbackArray( CbArray, sizeof(CbArray)/sizeof(CbArray[0]) );
|
|
||||||
}
|
|
||||||
|
|
||||||
void CMessages::release()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
|
||||||
// incoming message callbacks
|
|
||||||
|
|
||||||
/*
|
|
||||||
static void cbEngageFight( NLNET::CMessage& msgin, const std::string &serviceName, uint16 serviceId )
|
|
||||||
{
|
|
||||||
CEntityId aggressor, target;
|
|
||||||
msgin.serial(aggressor);
|
|
||||||
msgin.serial(target);
|
|
||||||
CActor *actor=CActorManager::getActor(target);
|
|
||||||
|
|
||||||
if (actor)
|
|
||||||
{
|
|
||||||
nlinfo("Responding to ENGAGE_FIGHT: %s %s",aggressor.toString().c_str(),target.toString().c_str());
|
|
||||||
actor->doFight(aggressor);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
nlinfo("Ignoring ENGAGE_FIGHT: %s %s",aggressor.toString().c_str(),target.toString().c_str());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
static void cbUpdateFightBehaviour( NLNET::CMessage& msgin, const std::string &serviceName, uint16 serviceId )
|
|
||||||
{
|
|
||||||
nlinfo("Received U_FIGHT_BEHAVIOUR - ** Message not treated **");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void cbUpdateFightPosition( NLNET::CMessage& msgin, const std::string &serviceName, uint16 serviceId )
|
|
||||||
{
|
|
||||||
// forwarding position updates from CMS to GPMS
|
|
||||||
// nlinfo("Received U_FIGHT_POS: length=%i pos=%i",msgin.length(),msgin.getPos() );
|
|
||||||
|
|
||||||
// this vector contais the body of the output messsage
|
|
||||||
|
|
||||||
CMessage msgout("UPDATE_ENTITIES_POS");
|
|
||||||
CMessage msgoutCMS("U_FIGHT_POS");
|
|
||||||
bool CMSChanges=false;
|
|
||||||
bool GPMSChanges=false;
|
|
||||||
|
|
||||||
// parse the input message
|
|
||||||
TGameCycle cycle = CTickEventHandler::getGameCycle();
|
|
||||||
while (msgin.length()>(unsigned)msgin.getPos())
|
|
||||||
{
|
|
||||||
CEntityId id;
|
|
||||||
CVectorD pos;
|
|
||||||
float theta;
|
|
||||||
msgin.serial(id,pos, theta);
|
|
||||||
|
|
||||||
// make sure that the actor is one of ours and doesn't belong to another service
|
|
||||||
CActor *pactor = CActorManager::getActor(id);
|
|
||||||
if (pactor!=0)
|
|
||||||
{
|
|
||||||
// check pos
|
|
||||||
if (pactor->testPositionInPatat(pos))
|
|
||||||
{
|
|
||||||
sint32 x=(sint32)(pos.x*1000.0);
|
|
||||||
sint32 y=(sint32)(pos.y*1000.0);
|
|
||||||
sint32 z=(sint32)(pos.z*1000.0);
|
|
||||||
//float angle=pactor->getAngle();
|
|
||||||
|
|
||||||
msgout.serial(id,x,y,z,theta,cycle);
|
|
||||||
GPMSChanges=true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pos=CVectorD(CMirrors::x(id),CMirrors::y(id),CMirrors::z(id));
|
|
||||||
sint32 x = CMirrors::x(id);
|
|
||||||
sint32 y = CMirrors::y(id);
|
|
||||||
sint32 z = CMirrors::z(id);
|
|
||||||
float angle=pactor->getAngle();
|
|
||||||
|
|
||||||
msgoutCMS.serial(id,x,y,z,angle,cycle);
|
|
||||||
CMSChanges=true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// create and send the output message
|
|
||||||
if (GPMSChanges) sendMessageViaMirror( "GPMS", msgout );
|
|
||||||
if (CMSChanges) sendMessageViaMirror( "CMS", msgoutCMS );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void cbUpdateFightEnd( NLNET::CMessage& msgin, const std::string &serviceName, uint16 serviceId )
|
|
||||||
{
|
|
||||||
// dealing with end of fight
|
|
||||||
// nlinfo("Received U_FIGHT_END: length=%i pos=%i",msgin.length(),msgin.getPos() );
|
|
||||||
|
|
||||||
while (msgin.length()>(unsigned)msgin.getPos())
|
|
||||||
{
|
|
||||||
// get actor id
|
|
||||||
CEntityId id;
|
|
||||||
msgin.serial(id);
|
|
||||||
|
|
||||||
// set actor to wandering mode
|
|
||||||
CActor *actor = CActorManager::getActor(id);
|
|
||||||
if (actor)
|
|
||||||
{
|
|
||||||
nlinfo("Received U_FIGHT_END for actor: %s (%s)",id.toString().c_str(), actor->getName().c_str());
|
|
||||||
actor->resetActivity();
|
|
||||||
// at combat end, recover position from mirror (get the last fight position)
|
|
||||||
actor->setPos(CMirrors::x(actor->getSid()), CMirrors::y(actor->getSid()), CMirrors::z(actor->getSid()));
|
|
||||||
// actor->doWander();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
nlinfo("Received U_FIGHT_END for unknown actor: %s",id.toString().c_str());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
static void cbAIVision( NLNET::CMessage& msgin, const std::string &serviceName, uint16 serviceId )
|
|
||||||
{
|
|
||||||
CMoveManager::processAIVision(msgin);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
static void cbAckVisionZone( NLNET::CMessage& msgin, const std::string &serviceName, uint16 serviceId )
|
|
||||||
{
|
|
||||||
CActorManager::addVisionService(serviceId);
|
|
||||||
}
|
|
||||||
*/
|
|
@ -1,36 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef RY_AGST_MESSAGES_H
|
|
||||||
#define RY_AGST_MESSAGES_H
|
|
||||||
|
|
||||||
#include "game_share/msg_brick_service.h"
|
|
||||||
|
|
||||||
class CMessages
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
// singleton initialisation and release
|
|
||||||
static void init();
|
|
||||||
static void release();
|
|
||||||
|
|
||||||
private:
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif // RY_AGST_MESSAGES_H
|
|
||||||
|
|
@ -1,138 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "mirrors.h"
|
|
||||||
#include <nel/net/unified_network.h>
|
|
||||||
#include "game_share/ryzom_entity_id.h"
|
|
||||||
//#include <nel/misc/command.h>
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
using namespace NLMISC;
|
|
||||||
using namespace NLNET;
|
|
||||||
using namespace MBEHAV;
|
|
||||||
|
|
||||||
//static inits
|
|
||||||
CMirror CMirrors::Mirror;
|
|
||||||
CMirroredDataSet *CMirrors::DataSet = NULL;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Initialisation 2
|
|
||||||
*/
|
|
||||||
void cbMirrorIsReady( CMirror *mirror )
|
|
||||||
{
|
|
||||||
CMirrors::initMirror();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Initialisation 1
|
|
||||||
*/
|
|
||||||
void CMirrors::init( void (*cbUpdate)(), void (*cbSync)(), void (*cbRelease)() )
|
|
||||||
{
|
|
||||||
// Init the mirror system
|
|
||||||
vector<string> datasetNames;
|
|
||||||
datasetNames.push_back( "fe_temp" );
|
|
||||||
Mirror.init( datasetNames, cbMirrorIsReady, cbUpdate, cbSync, cbRelease );
|
|
||||||
|
|
||||||
// register the service up and service down callbacks
|
|
||||||
CUnifiedNetwork::getInstance()->setServiceUpCallback("*", cbServiceUp, 0);
|
|
||||||
CUnifiedNetwork::getInstance()->setServiceDownCallback( "*", cbServiceDown, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Init after the mirror init
|
|
||||||
*/
|
|
||||||
void CMirrors::initMirror()
|
|
||||||
{
|
|
||||||
Mirror.declareEntityTypeOwner( RYZOMID::npc, 10000 );
|
|
||||||
Mirror.declareEntityTypeOwner( RYZOMID::creature, 10000 );
|
|
||||||
|
|
||||||
DataSet = &(Mirror.getDataSet("fe_temp"));
|
|
||||||
DataSet->declareProperty( "X", PSOReadWrite );
|
|
||||||
DataSet->declareProperty( "Y", PSOReadWrite );
|
|
||||||
DataSet->declareProperty( "Z", PSOReadWrite );
|
|
||||||
DataSet->declareProperty( "Theta", PSOReadWrite );
|
|
||||||
DataSet->declareProperty( "Sheet", PSOReadWrite ); // read/write
|
|
||||||
DataSet->declareProperty( "Mode", PSOReadWrite );
|
|
||||||
DataSet->declareProperty( "Behaviour", PSOReadOnly );
|
|
||||||
DataSet->declareProperty( "VisualPropertyA", PSOReadWrite );
|
|
||||||
DataSet->declareProperty( "WhoSeesMe", PSOReadWrite );
|
|
||||||
DataSet->declareProperty( "RiderEntity", PSOReadOnly );
|
|
||||||
DataSet->declareProperty( "TargetList", PSOReadWrite );
|
|
||||||
|
|
||||||
Mirror.setNotificationCallback( CMirrors::processMirrorUpdates );
|
|
||||||
|
|
||||||
// Note: here we don't call initRyzomVisualPropertyIndices(), so we won't be able to used the
|
|
||||||
// DSProperty* "constants" in this service
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void CMirrors::processMirrorUpdates()
|
|
||||||
{
|
|
||||||
DataSet->processAddedEntities();
|
|
||||||
DataSet->processRemovedEntities();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void CMirrors::release()
|
|
||||||
{
|
|
||||||
// Calling the destructor explicitely, not waiting for the end
|
|
||||||
Mirror.release();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CMirrors::cbServiceUp( const std::string& serviceName, uint16 serviceId, void * )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void CMirrors::cbServiceDown( const std::string& serviceName, uint16 serviceId, void * )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Test of CMirrorPropValueList
|
|
||||||
*/
|
|
||||||
/*NLMISC_COMMAND( testMirrorList, "", "" )
|
|
||||||
{
|
|
||||||
CEntityId id = CEntityId( RYZOMID::npc, 99987, 0x82, 0x85 );
|
|
||||||
CMirrors::Mirror.addEntity( id, true );
|
|
||||||
TDataSetRow datasetRow = TheDataset.getDataSetRow( id );
|
|
||||||
CMirrorPropValueList<TDataSetRow> list( TheDataset, id, "TargetList" );
|
|
||||||
log.displayNL( "SIZE %u", list.size() );
|
|
||||||
list.resize( 2 );
|
|
||||||
log.displayNL( "SIZE %u", list.size() );
|
|
||||||
list.push_front( datasetRow );
|
|
||||||
CMirrorPropValueList<TDataSetRow>::iterator it;
|
|
||||||
log.displayNL( "SIZE %u", list.size() );
|
|
||||||
for ( it=list.begin(); it!=list.end(); ++it )
|
|
||||||
log.displayNL( "%u", (*it)().getIndex() );
|
|
||||||
list.resize( 2 );
|
|
||||||
log.displayNL( "SIZE %u", list.size() );
|
|
||||||
for ( it=list.begin(); it!=list.end(); ++it )
|
|
||||||
log.displayNL( "%u", (*it)().getIndex() );
|
|
||||||
list.push_front( datasetRow );
|
|
||||||
log.displayNL( "SIZE %u", list.size() );
|
|
||||||
list.resize( 4 );
|
|
||||||
log.displayNL( "SIZE %u", list.size() );
|
|
||||||
for ( it=list.begin(); it!=list.end(); ++it )
|
|
||||||
log.displayNL( "%u", (*it)().getIndex() );
|
|
||||||
return true;
|
|
||||||
}*/
|
|
@ -1,65 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef RY_CMS_MIRRORS_H
|
|
||||||
#define RY_CMS_MIRRORS_H
|
|
||||||
|
|
||||||
// include files
|
|
||||||
#include "nel/misc/types_nl.h"
|
|
||||||
#include "nel/misc/entity_id.h"
|
|
||||||
#include "nel/misc/sheet_id.h"
|
|
||||||
#include "game_share/mode_and_behaviour.h"
|
|
||||||
#include "game_share/mirror.h"
|
|
||||||
#include "game_share/mirror_prop_value.h"
|
|
||||||
|
|
||||||
class CMirrors
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
// singleton initialisation and release
|
|
||||||
static void init( void (*cbUpdate)(), void (*cbSync)()=NULL, void (*cbRelease)() = NULL );
|
|
||||||
static void initMirror();
|
|
||||||
static void processMirrorUpdates();
|
|
||||||
static void release();
|
|
||||||
|
|
||||||
static bool exists( const NLMISC::CEntityId& id ) { return (DataSet->getDataSetRow( id ).isValid()); }
|
|
||||||
|
|
||||||
static sint32 x( const NLMISC::CEntityId& id ) { CMirrorPropValueRO<sint32> value( *DataSet, id, "X" ); return (sint32)value(); }
|
|
||||||
static sint32 y( const NLMISC::CEntityId& id ) { CMirrorPropValueRO<sint32> value( *DataSet, id, "Y" ); return (sint32)value(); }
|
|
||||||
static sint32 z( const NLMISC::CEntityId& id ) { CMirrorPropValueRO<sint32> value( *DataSet, id, "Z" ); return (sint32)value(); }
|
|
||||||
static sint32 mode( const NLMISC::CEntityId& id ) { CMirrorPropValueRO<uint64> value( *DataSet, id, "Mode" ); return (sint32)(MBEHAV::TMode(value()).Mode); }
|
|
||||||
static sint32 behaviour( const NLMISC::CEntityId& id ) { CMirrorPropValueRO<uint32> value( *DataSet, id, "Behaviour" ); return (uint32)value(); }
|
|
||||||
|
|
||||||
static void initSheet( const NLMISC::CEntityId& id, const NLMISC::CSheetId& sheetId ) { CMirrorPropValue<uint32> value( *DataSet, id, "Sheet" ); value = sheetId.asInt(); }
|
|
||||||
static NLMISC::CSheetId sheet( const NLMISC::CEntityId& id ) { CMirrorPropValueRO<uint32> value( *DataSet, id, "Sheet" ); return NLMISC::CSheetId(value()); }
|
|
||||||
|
|
||||||
private:
|
|
||||||
// callbacks used at service connection and disconnection
|
|
||||||
static void cbServiceUp( const std::string& serviceName, uint16 serviceId, void * );
|
|
||||||
static void cbServiceDown( const std::string& serviceName, uint16 serviceId, void * );
|
|
||||||
|
|
||||||
public:
|
|
||||||
static CMirror Mirror;
|
|
||||||
static CMirroredDataSet *DataSet;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#define TheDataset (*CMirrors::DataSet)
|
|
||||||
|
|
||||||
|
|
||||||
#endif // RY_CMS_MIRRORS_H
|
|
||||||
|
|
@ -1,444 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef NL_MOVE_GRID_H
|
|
||||||
#define NL_MOVE_GRID_H
|
|
||||||
|
|
||||||
#include "nel/misc/types_nl.h"
|
|
||||||
#include "nel/misc/vector.h"
|
|
||||||
#include "nel/misc/aabbox.h"
|
|
||||||
#include "nel/misc/block_memory.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A list of object that must have Next and Previous pointers
|
|
||||||
* \param T the type of item
|
|
||||||
* \param TPtr a pointer to T to use in list (useful for smartpointer)
|
|
||||||
*/
|
|
||||||
template<class TT, class TPtr = TT*>
|
|
||||||
class CMoveGridObjectList
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
TPtr Head;
|
|
||||||
TPtr Tail;
|
|
||||||
|
|
||||||
CMoveGridObjectList() : Head(NULL), Tail(NULL) {}
|
|
||||||
|
|
||||||
void insertAtHead(TT *object)
|
|
||||||
{
|
|
||||||
nlassert(object->Next == NULL);
|
|
||||||
nlassert(object->Previous == NULL);
|
|
||||||
|
|
||||||
object->Next = Head;
|
|
||||||
if (object->Next != NULL)
|
|
||||||
object->Next->Previous = object;
|
|
||||||
Head = object;
|
|
||||||
}
|
|
||||||
|
|
||||||
void insertAtTail(TT *object)
|
|
||||||
{
|
|
||||||
nlassert(object->Next == NULL);
|
|
||||||
nlassert(object->Previous == NULL);
|
|
||||||
|
|
||||||
object->Previous = Tail;
|
|
||||||
if (object->Previous != NULL)
|
|
||||||
object->Previous->Next = object;
|
|
||||||
Tail = object;
|
|
||||||
}
|
|
||||||
|
|
||||||
void remove(TT *object)
|
|
||||||
{
|
|
||||||
// if object at head
|
|
||||||
if (object->Previous == NULL)
|
|
||||||
Head = object->Next;
|
|
||||||
else
|
|
||||||
object->Previous->Next = object->Next;
|
|
||||||
|
|
||||||
// if object at tail
|
|
||||||
if (object->Next == NULL)
|
|
||||||
Tail = object->Previous;
|
|
||||||
else
|
|
||||||
object->Next->Previous = object->Previous;
|
|
||||||
|
|
||||||
object->Previous = NULL;
|
|
||||||
object->Next = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
TT *getHead() { return (TT*)Head; }
|
|
||||||
TT *getTail() { return (TT*)Tail; }
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Move grid, allows to select moving entities fast (template parameter CSIZE is in millimeter)
|
|
||||||
* \author Benjamin Legros
|
|
||||||
* \author Nevrax France
|
|
||||||
* \date 2001
|
|
||||||
*/
|
|
||||||
template<typename T, int CELLS, int CSIZE>
|
|
||||||
class CMoveGrid
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
class CIterator;
|
|
||||||
friend class CIterator;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
class CCellNode;
|
|
||||||
class CNode;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
/// Constructor
|
|
||||||
CMoveGrid();
|
|
||||||
|
|
||||||
/// Destructor
|
|
||||||
~CMoveGrid();
|
|
||||||
|
|
||||||
|
|
||||||
/// Insert an element in move grid. Return an iterator towards the inserted object
|
|
||||||
CIterator insert(const T &object, const NLMISC::CVector &position);
|
|
||||||
|
|
||||||
|
|
||||||
/// Move an object in grid.
|
|
||||||
void move(CIterator &it, const NLMISC::CVector &position);
|
|
||||||
|
|
||||||
|
|
||||||
/// Remove
|
|
||||||
void remove(CIterator &it);
|
|
||||||
void insertNode(CIterator &it, sint x, sint y);
|
|
||||||
void removeNode(CIterator &it);
|
|
||||||
|
|
||||||
|
|
||||||
/// select
|
|
||||||
void select(const NLMISC::CVector &position);
|
|
||||||
|
|
||||||
/// select
|
|
||||||
void select(const NLMISC::CAABBox &bbox);
|
|
||||||
|
|
||||||
/// begin
|
|
||||||
CIterator begin();
|
|
||||||
|
|
||||||
/// end
|
|
||||||
CIterator end();
|
|
||||||
|
|
||||||
/// clearSelection
|
|
||||||
void clearSelection();
|
|
||||||
|
|
||||||
/// round value so it is a half of a segment
|
|
||||||
double round(double v)
|
|
||||||
{
|
|
||||||
const double INV = 1000.0 / (double)CSIZE;
|
|
||||||
return (floor(v*INV)+0.5)*(double)CSIZE*0.001;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
sint convert(float v)
|
|
||||||
{
|
|
||||||
const float INV = 1000.0f / (float)CSIZE;
|
|
||||||
return (sint)(v*INV);
|
|
||||||
}
|
|
||||||
|
|
||||||
sint convertGrid(float v)
|
|
||||||
{
|
|
||||||
const float INV = 1000.0f / (float)CSIZE;
|
|
||||||
return (sint)(v*INV)&(CELLS-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
sint convertGrid(sint v)
|
|
||||||
{
|
|
||||||
return v&(CELLS-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void select(sint X, sint Y);
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
/// A node that contains an objects.
|
|
||||||
typedef CMoveGridObjectList<CNode> TNodeList;
|
|
||||||
/// A node that is a cell, containing a list of node inside this cell.
|
|
||||||
typedef CMoveGridObjectList<CCellNode> TCellNodeList;
|
|
||||||
|
|
||||||
class CCellNode
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
sint X, Y;
|
|
||||||
sint GridX, GridY;
|
|
||||||
|
|
||||||
TNodeList NodeList;
|
|
||||||
|
|
||||||
CCellNode *Previous, *Next;
|
|
||||||
CCellNode *Selection;
|
|
||||||
|
|
||||||
CCellNode() : X(0), Y(0), GridX(0), GridY(0), Previous(NULL), Next(NULL), Selection(NULL) {}
|
|
||||||
};
|
|
||||||
|
|
||||||
class CNode
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
CCellNode *Root;
|
|
||||||
CNode *Previous, *Next;
|
|
||||||
T Object;
|
|
||||||
|
|
||||||
CNode() : Previous(NULL), Next(NULL), Root(NULL) {}
|
|
||||||
};
|
|
||||||
|
|
||||||
/// The map of cell nodes
|
|
||||||
TCellNodeList _Grid[CELLS][CELLS];
|
|
||||||
|
|
||||||
/// The first selected cell node
|
|
||||||
CCellNode *_Selection;
|
|
||||||
|
|
||||||
/// The allocator of nodes
|
|
||||||
NLMISC::CBlockMemory<CNode> _NodeAllocator;
|
|
||||||
/// The allocator of cell nodes
|
|
||||||
NLMISC::CBlockMemory<CCellNode> _CellNodeAllocator;
|
|
||||||
|
|
||||||
public:
|
|
||||||
class CIterator
|
|
||||||
{
|
|
||||||
friend class CMoveGrid<T, CELLS, CSIZE>;
|
|
||||||
public:
|
|
||||||
CIterator(CNode *node = NULL) : _Node(node) {}
|
|
||||||
CIterator(const CIterator &it) : _Node(it._Node) {}
|
|
||||||
|
|
||||||
T & operator * () { return _Node->Object; }
|
|
||||||
|
|
||||||
CIterator & operator ++ ()
|
|
||||||
{
|
|
||||||
if (_Node->Next != NULL)
|
|
||||||
{
|
|
||||||
_Node = _Node->Next;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CCellNode *nextCell = _Node->Root->Selection;
|
|
||||||
_Node = NULL;
|
|
||||||
// iterate till we have a non empty selected cell
|
|
||||||
while (nextCell != NULL && (_Node = nextCell->NodeList.getHead()) == NULL)
|
|
||||||
nextCell = nextCell->Selection;
|
|
||||||
}
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
CIterator operator ++ (int)
|
|
||||||
{
|
|
||||||
CIterator ret(_Node);
|
|
||||||
++(*this);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator == (const CIterator &it) const { return it._Node == _Node; }
|
|
||||||
bool operator != (const CIterator &it) const { return !(*this == it); }
|
|
||||||
|
|
||||||
CIterator operator = (const CIterator &it) { _Node = it._Node; return *this; }
|
|
||||||
|
|
||||||
protected:
|
|
||||||
CNode *_Node;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// TEMPLATE IMPLEMENTATION
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
template<typename T, int CELLS, int CSIZE>
|
|
||||||
CMoveGrid<T, CELLS, CSIZE>::CMoveGrid()
|
|
||||||
{
|
|
||||||
_Selection = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
template<typename T, int CELLS, int CSIZE>
|
|
||||||
CMoveGrid<T, CELLS, CSIZE>::~CMoveGrid()
|
|
||||||
{
|
|
||||||
sint i, j;
|
|
||||||
|
|
||||||
for (i=0; i<CELLS; ++i)
|
|
||||||
{
|
|
||||||
for (j=0; j<CELLS; ++j)
|
|
||||||
{
|
|
||||||
TCellNodeList &list = _Grid[i][j];
|
|
||||||
CCellNode *cellNode;
|
|
||||||
CNode *node;
|
|
||||||
while ((cellNode = list.getHead()) != NULL)
|
|
||||||
{
|
|
||||||
while ((node = cellNode->NodeList.getHead()) != NULL)
|
|
||||||
{
|
|
||||||
cellNode->NodeList.remove(node);
|
|
||||||
_NodeAllocator.freeBlock(node);
|
|
||||||
}
|
|
||||||
list.remove(cellNode);
|
|
||||||
_CellNodeAllocator.freeBlock(cellNode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
template<typename T, int CELLS, int CSIZE>
|
|
||||||
void CMoveGrid<T, CELLS, CSIZE>::insertNode(CIterator &it, sint x, sint y)
|
|
||||||
{
|
|
||||||
sint gridX, gridY;
|
|
||||||
gridX = convertGrid(x);
|
|
||||||
gridY = convertGrid(y);
|
|
||||||
|
|
||||||
CCellNode *cellNode = _Grid[gridX][gridY].getHead();
|
|
||||||
while (cellNode != NULL && (cellNode->X != x || cellNode->Y != y))
|
|
||||||
cellNode = cellNode->Next;
|
|
||||||
|
|
||||||
if (cellNode == NULL)
|
|
||||||
{
|
|
||||||
cellNode = _CellNodeAllocator.allocate();
|
|
||||||
_Grid[gridX][gridY].insertAtHead(cellNode);
|
|
||||||
cellNode->X = x;
|
|
||||||
cellNode->Y = y;
|
|
||||||
cellNode->GridX = gridX;
|
|
||||||
cellNode->GridY = gridY;
|
|
||||||
}
|
|
||||||
|
|
||||||
it._Node->Root = cellNode;
|
|
||||||
cellNode->NodeList.insertAtHead(it._Node);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
template<typename T, int CELLS, int CSIZE>
|
|
||||||
void CMoveGrid<T, CELLS, CSIZE>::removeNode(CIterator &it)
|
|
||||||
{
|
|
||||||
it._Node->Root->NodeList.remove(it._Node);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
template<typename T, int CELLS, int CSIZE>
|
|
||||||
typename CMoveGrid<T, CELLS, CSIZE>::CIterator CMoveGrid<T, CELLS, CSIZE>::insert(const T &object, const NLMISC::CVector &position)
|
|
||||||
{
|
|
||||||
CNode *node = _NodeAllocator.allocate();
|
|
||||||
|
|
||||||
sint X, Y;
|
|
||||||
|
|
||||||
X = convert(position.x);
|
|
||||||
Y = convert(position.y);
|
|
||||||
node->Object = object;
|
|
||||||
|
|
||||||
CIterator it(node);
|
|
||||||
insertNode(it, X, Y);
|
|
||||||
|
|
||||||
return CIterator(node);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T, int CELLS, int CSIZE>
|
|
||||||
void CMoveGrid<T, CELLS, CSIZE>::move(CIterator &it, const NLMISC::CVector &position)
|
|
||||||
{
|
|
||||||
sint X, Y;
|
|
||||||
X = convert(position.x);
|
|
||||||
Y = convert(position.y);
|
|
||||||
|
|
||||||
CNode *node = it._Node;
|
|
||||||
|
|
||||||
if (X == node->Root->X && Y == node->Root->Y)
|
|
||||||
return;
|
|
||||||
|
|
||||||
removeNode(it);
|
|
||||||
insertNode(it, X, Y);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T, int CELLS, int CSIZE>
|
|
||||||
void CMoveGrid<T, CELLS, CSIZE>::remove(CIterator &it)
|
|
||||||
{
|
|
||||||
CNode *node = it._Node;
|
|
||||||
|
|
||||||
removeNode(it);
|
|
||||||
it._Node = NULL;
|
|
||||||
|
|
||||||
_NodeAllocator.free(node);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<typename T, int CELLS, int CSIZE>
|
|
||||||
void CMoveGrid<T, CELLS, CSIZE>::select(const NLMISC::CVector &position)
|
|
||||||
{
|
|
||||||
select(convert(position.x), convert(position.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T, int CELLS, int CSIZE>
|
|
||||||
void CMoveGrid<T, CELLS, CSIZE>::select(const NLMISC::CAABBox &bbox)
|
|
||||||
{
|
|
||||||
sint x0, x1;
|
|
||||||
sint y0, y1;
|
|
||||||
|
|
||||||
x0 = convert(bbox.getCenter().x-bbox.getHalfSize().x);
|
|
||||||
x1 = convert(bbox.getCenter().x+bbox.getHalfSize().x);
|
|
||||||
|
|
||||||
y0 = convert(bbox.getCenter().y-bbox.getHalfSize().y);
|
|
||||||
y1 = convert(bbox.getCenter().y+bbox.getHalfSize().y);
|
|
||||||
|
|
||||||
sint x, y;
|
|
||||||
|
|
||||||
for (y=y0; y<=y1; ++y)
|
|
||||||
for (x=x0; x<=x1; ++x)
|
|
||||||
select(x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T, int CELLS, int CSIZE>
|
|
||||||
void CMoveGrid<T, CELLS, CSIZE>::select(sint x, sint y)
|
|
||||||
{
|
|
||||||
sint gx = convertGrid(x),
|
|
||||||
gy = convertGrid(y);
|
|
||||||
|
|
||||||
CCellNode *cellNode = _Grid[gx][gy].getHead();
|
|
||||||
while (cellNode != NULL && (cellNode->X != x || cellNode->Y != y))
|
|
||||||
cellNode = cellNode->Next;
|
|
||||||
|
|
||||||
if (cellNode != NULL && cellNode->NodeList.getHead() != NULL)
|
|
||||||
{
|
|
||||||
cellNode->Selection = _Selection;
|
|
||||||
_Selection = cellNode;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T, int CELLS, int CSIZE>
|
|
||||||
typename CMoveGrid<T, CELLS, CSIZE>::CIterator CMoveGrid<T, CELLS, CSIZE>::begin()
|
|
||||||
{
|
|
||||||
return (_Selection != NULL) ? CIterator(_Selection->NodeList.getHead()) : CIterator(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T, int CELLS, int CSIZE>
|
|
||||||
typename CMoveGrid<T, CELLS, CSIZE>::CIterator CMoveGrid<T, CELLS, CSIZE>::end()
|
|
||||||
{
|
|
||||||
return CIterator(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T, int CELLS, int CSIZE>
|
|
||||||
void CMoveGrid<T, CELLS, CSIZE>::clearSelection()
|
|
||||||
{
|
|
||||||
CCellNode *cellNode = _Selection;
|
|
||||||
_Selection = NULL;
|
|
||||||
|
|
||||||
while (cellNode != NULL)
|
|
||||||
{
|
|
||||||
CCellNode *nd = cellNode;
|
|
||||||
cellNode = cellNode->Selection;
|
|
||||||
nd->Selection = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif // NL_MOVE_GRID_H
|
|
||||||
|
|
||||||
/* End of move_grid.h */
|
|
@ -1,220 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "move_manager.h"
|
|
||||||
#include "nel/misc/config_file.h"
|
|
||||||
#include "nel/net/service.h"
|
|
||||||
#include "sheets.h"
|
|
||||||
|
|
||||||
#include "nel/misc/file.h"
|
|
||||||
#include "nel/misc/path.h"
|
|
||||||
#include "game_share/ryzom_entity_id.h"
|
|
||||||
|
|
||||||
//
|
|
||||||
//#include "nel/3d/u_instance_group.h"
|
|
||||||
|
|
||||||
#include "sheets.h"
|
|
||||||
|
|
||||||
// ugly
|
|
||||||
#include "game_share/ig_list.h"
|
|
||||||
#include "game_share/used_continent.h"
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
using namespace NLMISC;
|
|
||||||
using namespace NLPACS;
|
|
||||||
using namespace NLNET;
|
|
||||||
|
|
||||||
namespace AGS_TEST
|
|
||||||
{
|
|
||||||
|
|
||||||
// the actor grid
|
|
||||||
CMoveManager::TObstacleGrid CMoveManager::Grid;
|
|
||||||
|
|
||||||
// the continents
|
|
||||||
CContinentContainer CMoveManager::Continents;
|
|
||||||
|
|
||||||
//
|
|
||||||
CMoveManager::TObstacleMap CMoveManager::ObstacleMap;
|
|
||||||
|
|
||||||
//
|
|
||||||
CMoveManager::TPrimZoneMap CMoveManager::PrimZoneMap;
|
|
||||||
|
|
||||||
|
|
||||||
// init
|
|
||||||
void CMoveManager::init()
|
|
||||||
{
|
|
||||||
// init continents
|
|
||||||
Continents.init(30, 30, 8.0, 2, IService::getInstance()->WriteFilesDirectory);
|
|
||||||
|
|
||||||
// load continents
|
|
||||||
CUsedContinent::TUsedContinentCont usedCont = CUsedContinent::instance().getContinents();
|
|
||||||
|
|
||||||
for (uint i=0; i<usedCont.size(); ++i)
|
|
||||||
{
|
|
||||||
Continents.loadContinent(usedCont[i].ContinentName, usedCont[i].ContinentName, usedCont[i].ContinentInstance);
|
|
||||||
Continents.getMoveContainer(usedCont[i].ContinentInstance)->setAsStatic(0);
|
|
||||||
}
|
|
||||||
/* CConfigFile::CVar& cvUsedContinents = IService::getInstance()->ConfigFile.getVar("UsedContinents");
|
|
||||||
uint i;
|
|
||||||
for (i=0; (sint)i<cvUsedContinents.size(); ++i)
|
|
||||||
if (cvUsedContinents.asString(i) != "")
|
|
||||||
{
|
|
||||||
Continents.loadContinent(cvUsedContinents.asString(i), cvUsedContinents.asString(i), i);
|
|
||||||
Continents.getMoveContainer(i)->setAsStatic(0);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
// load trees ig
|
|
||||||
for (i=sizeof(IGFiles)/sizeof(IGFiles[0]);i--;)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
NL3D::UInstanceGroup *ig = NL3D::UInstanceGroup::createInstanceGroup(IGFiles[i]);
|
|
||||||
if (ig == NULL)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
uint k;
|
|
||||||
for(k = 0; k < ig->getNumInstance(); ++k)
|
|
||||||
{
|
|
||||||
const string &name = ig->getShapeName(k);
|
|
||||||
sint sz = name.size();
|
|
||||||
if (sz >= 6 && strlwr(name.substr(sz-6, 6)) == ".shape")
|
|
||||||
{
|
|
||||||
const CSheets::CSheet *sheet = CSheets::lookup(CSheetId(ig->getInstanceName(k)));
|
|
||||||
CObstacle obstacle;
|
|
||||||
obstacle.Id = CEntityId(RYZOMID::flora, 0xDEADF00D, IService::getInstance()->getServiceId(), IService::getInstance()->getServiceId());
|
|
||||||
obstacle.Position = ig->getInstancePos(k);
|
|
||||||
obstacle.Radius = (sheet != NULL) ? sheet->Radius : 0.5f;
|
|
||||||
Grid.insert(obstacle, obstacle.Position);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
delete ig;
|
|
||||||
}
|
|
||||||
catch (std::exception &e)
|
|
||||||
{
|
|
||||||
nlinfo(e.what());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
// update
|
|
||||||
void CMoveManager::update()
|
|
||||||
{
|
|
||||||
uint i;
|
|
||||||
for (i=0; (sint)i<Continents.size(); ++i)
|
|
||||||
if (Continents.getMoveContainer(i) != NULL)
|
|
||||||
{
|
|
||||||
Continents.getMoveContainer(i)->evalCollision(1, 0);
|
|
||||||
Continents.getMoveContainer(i)->evalCollision(1, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// process ai vision
|
|
||||||
void CMoveManager::processAIVision(CMessage &msg)
|
|
||||||
{
|
|
||||||
TObstacleMap::iterator it;
|
|
||||||
for (it=ObstacleMap.begin(); it!=ObstacleMap.end(); ++it)
|
|
||||||
(*((*it).second)).Updated = false;
|
|
||||||
|
|
||||||
uint64 AgentId; // should be fakeid...
|
|
||||||
msg.serial( AgentId );
|
|
||||||
|
|
||||||
while (msg.getPos() < (sint32)(msg.length()))
|
|
||||||
{
|
|
||||||
CEntityId id;
|
|
||||||
TTime time;
|
|
||||||
CVectorD pos;
|
|
||||||
CVector heading;
|
|
||||||
float speed;
|
|
||||||
string sheetId;
|
|
||||||
|
|
||||||
// get all from message
|
|
||||||
msg.serial(id, time, pos, heading, speed, sheetId);
|
|
||||||
|
|
||||||
it = ObstacleMap.find(id);
|
|
||||||
if (it == ObstacleMap.end())
|
|
||||||
{
|
|
||||||
// if not exists yet, creates an obstacle
|
|
||||||
CObstacle obstacle;
|
|
||||||
obstacle.Id = id;
|
|
||||||
obstacle.Position = CVector(pos);
|
|
||||||
obstacle.Radius = 0.5f;
|
|
||||||
obstacle.External = true;
|
|
||||||
|
|
||||||
// get sheet from this sheetId
|
|
||||||
const CSheets::CSheet *sheet = CSheets::lookup(CSheetId(sheetId));
|
|
||||||
if (sheet != NULL)
|
|
||||||
obstacle.Radius = sheet->Radius;
|
|
||||||
|
|
||||||
//
|
|
||||||
nlinfo("New Object %s in IA vision at (%.1f,%.1f,%.1f), radius %.1f", id.toString().c_str(), pos.x, pos.y, pos.z, obstacle.Radius);
|
|
||||||
|
|
||||||
// insert in grid
|
|
||||||
TObstacleGrid::CIterator ito = Grid.insert(obstacle, obstacle.Position);
|
|
||||||
|
|
||||||
// insert in map
|
|
||||||
pair<TObstacleMap::iterator, bool> res = ObstacleMap.insert(make_pair<CEntityId, TObstacleGrid::CIterator>(id, ito));
|
|
||||||
/*
|
|
||||||
it = ObstacleMap.find(id);
|
|
||||||
nlassert(it != ObstacleMap.end());
|
|
||||||
*/
|
|
||||||
it = res.first;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
(*((*it).second)).Position = pos;
|
|
||||||
Grid.move((*it).second, pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
(*((*it).second)).Updated = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// erase not updated obstacles
|
|
||||||
for (it=ObstacleMap.begin(); it!=ObstacleMap.end(); )
|
|
||||||
{
|
|
||||||
if (!(*((*it).second)).Updated && (*((*it).second)).External)
|
|
||||||
{
|
|
||||||
nlinfo("Remove old object %s in IA vision", (*it).first.toString().c_str());
|
|
||||||
TObstacleMap::iterator itr = it++;
|
|
||||||
Grid.remove((*itr).second);
|
|
||||||
ObstacleMap.erase(itr);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
++it;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// release
|
|
||||||
void CMoveManager::release()
|
|
||||||
{
|
|
||||||
// remove all continents
|
|
||||||
uint i;
|
|
||||||
for (i=0; (sint)i<Continents.size(); ++i)
|
|
||||||
Continents.removeContinent(i);
|
|
||||||
|
|
||||||
Continents.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
} // AGS_TEST
|
|
||||||
|
|
||||||
/* End of move_manager.cpp */
|
|
@ -1,127 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef NL_MOVE_MANAGER_H
|
|
||||||
#define NL_MOVE_MANAGER_H
|
|
||||||
|
|
||||||
#include "nel/misc/types_nl.h"
|
|
||||||
#include "nel/misc/vector.h"
|
|
||||||
#include "nel/net/message.h"
|
|
||||||
#include "nel/misc/entity_id.h"
|
|
||||||
|
|
||||||
#include "nel/ligo/primitive.h"
|
|
||||||
|
|
||||||
#include "move_grid.h"
|
|
||||||
#include "game_share/continent_container.h"
|
|
||||||
|
|
||||||
#include <map>
|
|
||||||
|
|
||||||
namespace AGS_TEST
|
|
||||||
{
|
|
||||||
|
|
||||||
class CObstacle
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
CObstacle() : External(false), Updated(true) {}
|
|
||||||
NLMISC::CEntityId Id;
|
|
||||||
NLMISC::CVector Position;
|
|
||||||
float Radius;
|
|
||||||
bool External;
|
|
||||||
bool Updated;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Manager of a unique move grid
|
|
||||||
* \author Benjamin Legros
|
|
||||||
* \author Nevrax France
|
|
||||||
* \date 2002
|
|
||||||
*/
|
|
||||||
class CMoveManager
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
/// The type of grid
|
|
||||||
typedef CMoveGrid<CObstacle, 256, 16000> TObstacleGrid;
|
|
||||||
|
|
||||||
/// A map of obstacle
|
|
||||||
typedef std::map<NLMISC::CEntityId, TObstacleGrid::CIterator> TObstacleMap;
|
|
||||||
|
|
||||||
/// A map of prim zone
|
|
||||||
typedef std::map<std::string, NLLIGO::CPrimZone> TPrimZoneMap;
|
|
||||||
|
|
||||||
public:
|
|
||||||
/// The grid
|
|
||||||
static TObstacleGrid Grid;
|
|
||||||
|
|
||||||
/// The continent container
|
|
||||||
static CContinentContainer Continents;
|
|
||||||
|
|
||||||
/// The obstacle map
|
|
||||||
static TObstacleMap ObstacleMap;
|
|
||||||
|
|
||||||
/// The prim zone map
|
|
||||||
static TPrimZoneMap PrimZoneMap;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
/// init
|
|
||||||
static void init();
|
|
||||||
|
|
||||||
/// update
|
|
||||||
static void update();
|
|
||||||
|
|
||||||
/// process ia vision from gpms
|
|
||||||
static void processAIVision(NLNET::CMessage &msg);
|
|
||||||
|
|
||||||
/// release
|
|
||||||
static void release();
|
|
||||||
|
|
||||||
/// Add a prim zone in map
|
|
||||||
static void addPrimZone(const NLLIGO::CPrimZone &primZone)
|
|
||||||
{
|
|
||||||
if (PrimZoneMap.find(primZone.getName()) == PrimZoneMap.end())
|
|
||||||
{
|
|
||||||
PrimZoneMap.insert(std::make_pair(primZone.getName(), primZone));
|
|
||||||
nlinfo("Using PrimZone '%s'", primZone.getName().c_str());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
nlwarning("PrimZone '%s' already added, abort...", primZone.getName().c_str());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// get a prim zone by its name
|
|
||||||
static NLLIGO::CPrimZone *getPrimZone(const std::string &zoneName)
|
|
||||||
{
|
|
||||||
TPrimZoneMap::iterator it = PrimZoneMap.find(zoneName);
|
|
||||||
if (it == PrimZoneMap.end())
|
|
||||||
{
|
|
||||||
nlwarning("Couldn't find PrimZone '%s', abort...", zoneName.c_str());
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return &((*it).second);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
};
|
|
||||||
|
|
||||||
} // AGS_TEST
|
|
||||||
|
|
||||||
#endif // NL_MOVE_MANAGER_H
|
|
||||||
|
|
||||||
/* End of move_manager.h */
|
|
@ -1,120 +0,0 @@
|
|||||||
Alain's code
|
|
||||||
|
|
||||||
/****************************************************************\
|
|
||||||
****************************************************************
|
|
||||||
Alain's Command section
|
|
||||||
****************************************************************
|
|
||||||
\****************************************************************/
|
|
||||||
|
|
||||||
// Command for add an entity on the GPMS
|
|
||||||
NLMISC_COMMAND(add_entity,"Add entity to GPMS","entity Id, sheet Id, entity PosX(meters), entity PosY, entity PosZ, entity Theta angle")
|
|
||||||
{
|
|
||||||
// check args, if there s not the right number of parameter, return bad
|
|
||||||
if(args.size() != 6) return false;
|
|
||||||
|
|
||||||
// get the values
|
|
||||||
uint32 Id = atoi(args[0].c_str());
|
|
||||||
uint32 SheetId = atoi(args[1].c_str());
|
|
||||||
sint32 PosX = atoi(args[2].c_str()) * 1000; //coordinates are in millimeters
|
|
||||||
uint32 PosY = atoi(args[3].c_str()) * 1000;
|
|
||||||
sint32 PosZ = atoi(args[4].c_str()) * 1000;
|
|
||||||
float Theta = (float) atof(args[5].c_str()); //direction of entity in radian (direct angle in radian, front of is on +Y (0 = Y direction), all conversion is now made on client)
|
|
||||||
|
|
||||||
//normaly creature type, but FE not ready for properties of creature type, this constructor set dynamicId and creatorId to serviceId
|
|
||||||
// At this time they are no namespace for enum of entity type, this be corrected when i'm change Sid/EntityId class and move it in game_share
|
|
||||||
Sid sid( /*Sid::*/npc, Id);
|
|
||||||
|
|
||||||
//make the message for add entity and send it
|
|
||||||
CMessage msgout("ADD_ENTITY");
|
|
||||||
msgout.serial( sid );
|
|
||||||
msgout.serial( PosX );
|
|
||||||
msgout.serial( PosY );
|
|
||||||
msgout.serial( PosZ );
|
|
||||||
msgout.serial( Theta );
|
|
||||||
NLMISC::TGameCycle tick = CTickEventHandler::getGameCycle();
|
|
||||||
//msgout.serial( tick ); //Chaine of time is not complete, must be made in shortly
|
|
||||||
msgout.serial( SheetId );
|
|
||||||
CUnifiedNetwork::getInstance()->send( "GPMS", msgout );
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Command for remove an entity on the GPMS
|
|
||||||
NLMISC_COMMAND(remove_entity,"Remove entity to GPMS","entity Id")
|
|
||||||
{
|
|
||||||
// check args, if there s not the right number of parameter, return bad
|
|
||||||
if(args.size() != 1) return false;
|
|
||||||
|
|
||||||
// get the values
|
|
||||||
uint32 Id = atoi(args[0].c_str());
|
|
||||||
|
|
||||||
//normaly creature type, but FE not ready for properties of creature type, this constructor set dynamicId and creatorId to serviceId
|
|
||||||
// At this time they are no namespace for enum of entity type, this be corrected when i'm change Sid/EntityId class and move it in game_share
|
|
||||||
Sid sid( /*Sid::*/npc, Id);
|
|
||||||
|
|
||||||
CMessage msgout("REMOVE_ENTITY");
|
|
||||||
msgout.serial( sid );
|
|
||||||
CUnifiedNetwork::getInstance()->send( "GPMS", msgout );
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Command for update position of an entity, remember pacs constraintes reduce the max move in one ticks at two cells (2*16 meters)
|
|
||||||
NLMISC_COMMAND(update_position,"Update position of an entity","entity Id, entity PosX(meters), entity PosY, entity PosZ, entity Theta angle")
|
|
||||||
{
|
|
||||||
// check args, if there s not the right number of parameter, return bad
|
|
||||||
if(args.size() != 5) return false;
|
|
||||||
|
|
||||||
// get the values
|
|
||||||
uint32 Id = atoi(args[0].c_str());
|
|
||||||
sint32 PosX = atoi(args[1].c_str()) * 1000; //coordinates are in millimeters
|
|
||||||
uint32 PosY = atoi(args[2].c_str()) * 1000;
|
|
||||||
sint32 PosZ = atoi(args[3].c_str()) * 1000;
|
|
||||||
float Theta = (float) atof(args[4].c_str()); //direction of entity in radian (direct angle in radian, front of is on +Y (0 = Y direction), all conversion is now made on client)
|
|
||||||
|
|
||||||
//normaly creature type, but FE not ready for properties of creature type, this constructor set dynamicId and creatorId to serviceId
|
|
||||||
// At this time they are no namespace for enum of entity type, this be corrected when i'm change Sid/EntityId class and move it in game_share
|
|
||||||
Sid sid( /*Sid::*/npc, Id);
|
|
||||||
|
|
||||||
CMessage msgout("UPDATE_ENTITY_POS");
|
|
||||||
msgout.serial( sid );
|
|
||||||
msgout.serial( PosX );
|
|
||||||
msgout.serial( PosY );
|
|
||||||
msgout.serial( PosZ );
|
|
||||||
msgout.serial( Theta );
|
|
||||||
NLMISC::TGameCycle tick = CTickEventHandler::getGameCycle();
|
|
||||||
msgout.serial( tick );
|
|
||||||
CUnifiedNetwork::getInstance()->send( "GPMS", msgout );
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Command for teleport an entity to new position, no limit of distance to move
|
|
||||||
NLMISC_COMMAND(teleportation,"Teleport entity to gived position","entity Id, entity PosX(meters), entity PosY, entity PosZ, entity Theta angle")
|
|
||||||
{
|
|
||||||
// check args, if there s not the right number of parameter, return bad
|
|
||||||
if(args.size() != 5) return false;
|
|
||||||
|
|
||||||
// get the values
|
|
||||||
uint32 Id = atoi(args[0].c_str());
|
|
||||||
sint32 PosX = atoi(args[1].c_str()) * 1000; //coordinates are in millimeters
|
|
||||||
uint32 PosY = atoi(args[2].c_str()) * 1000;
|
|
||||||
sint32 PosZ = atoi(args[3].c_str()) * 1000;
|
|
||||||
float Theta = (float) atof(args[4].c_str()); //direction of entity in radian (direct angle in radian, front of is on +Y (0 = Y direction), all conversion is now made on client)
|
|
||||||
|
|
||||||
//normaly creature type, but FE not ready for properties of creature type, this constructor set dynamicId and creatorId to serviceId
|
|
||||||
// At this time they are no namespace for enum of entity type, this be corrected when i'm change Sid/EntityId class and move it in game_share
|
|
||||||
Sid sid( /*Sid::*/npc, Id);
|
|
||||||
|
|
||||||
CMessage msgout("ENTITY_TELEPORTATION");
|
|
||||||
msgout.serial( sid );
|
|
||||||
msgout.serial( PosX );
|
|
||||||
msgout.serial( PosY );
|
|
||||||
msgout.serial( PosZ );
|
|
||||||
msgout.serial( Theta );
|
|
||||||
NLMISC::TGameCycle tick = CTickEventHandler::getGameCycle();
|
|
||||||
msgout.serial( tick );
|
|
||||||
CUnifiedNetwork::getInstance()->send( "GPMS", msgout );
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
@ -1,206 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "position_generator.h"
|
|
||||||
#include <nel/misc/debug.h>
|
|
||||||
|
|
||||||
namespace AGS_TEST
|
|
||||||
{
|
|
||||||
|
|
||||||
// instantiating static class variables
|
|
||||||
int CPositionGenerator::_x=0;
|
|
||||||
int CPositionGenerator::_y=0;
|
|
||||||
int CPositionGenerator::_dx=0;
|
|
||||||
int CPositionGenerator::_dy=0;
|
|
||||||
int CPositionGenerator::_spacing=0;
|
|
||||||
std::string CPositionGenerator::_pattern("grid");
|
|
||||||
int CPositionGenerator::_linelen=0;
|
|
||||||
int CPositionGenerator::_leftonline=0;
|
|
||||||
std::string CPositionGenerator::_spawnZoneName="";
|
|
||||||
CPositionGenerator::TSpawnZoneMap CPositionGenerator::_spawnZones;
|
|
||||||
CPositionGenerator::TSpawnPointMap CPositionGenerator::_spawnPoints;
|
|
||||||
|
|
||||||
|
|
||||||
void CPositionGenerator::setPositionInMM(int x, int y)
|
|
||||||
{
|
|
||||||
_x=x;
|
|
||||||
_y=y;
|
|
||||||
|
|
||||||
_linelen=0;
|
|
||||||
_leftonline=0;
|
|
||||||
init();
|
|
||||||
|
|
||||||
nlinfo("Set spawn position to: %d, %d", (_x+500)/1000, (_y+500)/1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CPositionGenerator::setPosition(int x, int y)
|
|
||||||
{
|
|
||||||
setPositionInMM(1000*x,1000*y);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void CPositionGenerator::setPosition(std::string spawnName) // name of a spawn point or spawn zone
|
|
||||||
{
|
|
||||||
if (_spawnPoints.find(spawnName)!=_spawnPoints.end())
|
|
||||||
{
|
|
||||||
setPositionInMM( (int)(_spawnPoints[spawnName].Point.x*1000.0f), (int)(_spawnPoints[spawnName].Point.y*1000.0f) );
|
|
||||||
}
|
|
||||||
else if (_spawnZones.find(spawnName)!=_spawnZones.end())
|
|
||||||
{
|
|
||||||
_spawnZoneName=spawnName;
|
|
||||||
setPattern("spawnZone");
|
|
||||||
NLMISC::CVector v=_spawnZones[_spawnZoneName].getNext();
|
|
||||||
setPositionInMM((int)(v.x*1000.0f),(int)(v.y*1000.0f));
|
|
||||||
|
|
||||||
nlinfo("Set spawn Zone to: %s",_spawnZoneName.c_str());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
nlinfo("Unknown spawn zone/point: %s",spawnName.c_str());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CPositionGenerator::setSpacing(int spacing)
|
|
||||||
{
|
|
||||||
_spacing=1000*spacing;
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CPositionGenerator::setPattern(const std::string &pattern)
|
|
||||||
{
|
|
||||||
_pattern=pattern;
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CPositionGenerator::init()
|
|
||||||
{
|
|
||||||
_dx=_spacing;
|
|
||||||
_dy=0;
|
|
||||||
|
|
||||||
_linelen=0;
|
|
||||||
_leftonline=0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CPositionGenerator::next(int &x, int &y)
|
|
||||||
{
|
|
||||||
x=_x;
|
|
||||||
y=_y;
|
|
||||||
|
|
||||||
// nlinfo("Pattern: %s: dx: %d dy: %d spacing: %d",_pattern.c_str(),_dx,_dy,_spacing);
|
|
||||||
if (_pattern==std::string("grid"))
|
|
||||||
{
|
|
||||||
if (_leftonline)
|
|
||||||
_leftonline--;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (_dx)
|
|
||||||
_linelen++;
|
|
||||||
_leftonline=_linelen;
|
|
||||||
_dx+=_dy;
|
|
||||||
_dy-=_dx;
|
|
||||||
_dx+=_dy;
|
|
||||||
}
|
|
||||||
_x+=_dx;
|
|
||||||
_y+=_dy;
|
|
||||||
}
|
|
||||||
else if (_pattern==std::string("line"))
|
|
||||||
{
|
|
||||||
_x+=_dx;
|
|
||||||
_y+=_dy;
|
|
||||||
}
|
|
||||||
else if (_pattern==std::string("spawnZone"))
|
|
||||||
{
|
|
||||||
NLMISC::CVector v=_spawnZones[_spawnZoneName].getNext();
|
|
||||||
_x=(int)(v.x*1000.0f);
|
|
||||||
_y=(int)(v.y*1000.0f);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
nlwarning("Unknown pattern: %s",_pattern.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
void CPositionGenerator::addSpawnZone(const NLLIGO::CPrimZone &zone)
|
|
||||||
{
|
|
||||||
if (_spawnZones[zone.getName()].Points.size()!=0)
|
|
||||||
{
|
|
||||||
nlinfo("Spawn zone already exists: %s",zone.getName().c_str());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// determine the extents of the zone
|
|
||||||
float minx=(float)(((uint)~0)>>1);
|
|
||||||
float maxx=-minx-1.0f;
|
|
||||||
float miny=minx;
|
|
||||||
float maxy=maxx;
|
|
||||||
for (uint i=0;i<zone.VPoints.size();i++)
|
|
||||||
{
|
|
||||||
if (zone.VPoints[i].x<minx) minx=zone.VPoints[i].x;
|
|
||||||
if (zone.VPoints[i].x>maxx) maxx=zone.VPoints[i].x;
|
|
||||||
if (zone.VPoints[i].y<miny) miny=zone.VPoints[i].y;
|
|
||||||
if (zone.VPoints[i].y>maxy) maxy=zone.VPoints[i].y;
|
|
||||||
}
|
|
||||||
|
|
||||||
// round off the zone extents to centre the bounding box about the zone centre
|
|
||||||
const float SPACING=4.0f;
|
|
||||||
float xbase= ((maxx-minx)/2.0f+minx);
|
|
||||||
float ybase= ((maxx-minx)/2.0f+miny);
|
|
||||||
int xcount=(int)((maxx-xbase)/SPACING);
|
|
||||||
int ycount=(int)((maxy-ybase)/SPACING);
|
|
||||||
|
|
||||||
// loop through the points in the bounding box seeing whether or not they're in the zone
|
|
||||||
for (int xi=-xcount;xi<xcount+1; xi++)
|
|
||||||
for (int yi=-ycount;yi<ycount+1; yi++)
|
|
||||||
{
|
|
||||||
NLMISC::CVector v( xbase+SPACING*(float)xi, ybase+SPACING*(float)yi, 0);
|
|
||||||
if (zone.contains(v))
|
|
||||||
{
|
|
||||||
// we've got a point that is in the zone so add it to the spawn zone point array
|
|
||||||
_spawnZones[zone.getName()].Points.push_back(v);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// add code here to shuffle the points in the zone
|
|
||||||
|
|
||||||
|
|
||||||
// check that the zone's not empty
|
|
||||||
if (_spawnZones[zone.getName()].Points.size()!=0)
|
|
||||||
{
|
|
||||||
nlinfo("Spawn zone '%s' contains %d spawn points",zone.getName().c_str(), _spawnZones[zone.getName()].Points.size());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
nlwarning("FAILED to generate any points for spawn zone: %s", zone.getName().c_str());
|
|
||||||
_spawnZones.erase(zone.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string CPositionGenerator::getSpawnName()
|
|
||||||
{
|
|
||||||
if (_pattern==std::string("spawnZone"))
|
|
||||||
return _spawnZoneName;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
char buf[100];
|
|
||||||
sprintf(buf,"%f %f %f",double(_x)*0.001,double(_y)*0.001,0);
|
|
||||||
return std::string(buf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} // end of namespace AGS_TEST
|
|
@ -1,84 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef GD_POSITION_GENERATOR_H
|
|
||||||
#define GD_POSITION_GENERATOR_H
|
|
||||||
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include "nel/misc/types_nl.h"
|
|
||||||
#include "nel/ligo/primitive.h"
|
|
||||||
|
|
||||||
|
|
||||||
namespace AGS_TEST
|
|
||||||
{
|
|
||||||
|
|
||||||
class CPositionGenerator
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static void setPositionInMM(int x, int y); // x and y are in milimeters
|
|
||||||
static void setPosition(int x, int y); // x and y are in meters
|
|
||||||
static void setPosition(std::string spawnName); // name of a spawn point or spawn zone
|
|
||||||
static void setPattern(const std::string &pattern);
|
|
||||||
static void setSpacing(int spacing);
|
|
||||||
|
|
||||||
static void addSpawnPoint(const NLLIGO::CPrimPoint &point) { _spawnPoints[point.getName()]=point; }
|
|
||||||
static void addSpawnZone(const NLLIGO::CPrimZone &zone);
|
|
||||||
|
|
||||||
static void init();
|
|
||||||
static void next(int &x, int &y);
|
|
||||||
|
|
||||||
static std::string getSpawnName();
|
|
||||||
|
|
||||||
private:
|
|
||||||
class CSpawnZone
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
uint Next;
|
|
||||||
std::vector<NLMISC::CVector> Points;
|
|
||||||
|
|
||||||
CSpawnZone(): Next(0) {}
|
|
||||||
const NLMISC::CVector& getNext()
|
|
||||||
{
|
|
||||||
if (Next>=Points.size()) Next=0;
|
|
||||||
return Points[Next++];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
private:
|
|
||||||
static int _x, _y;
|
|
||||||
static int _dx, _dy;
|
|
||||||
static int _spacing;
|
|
||||||
static std::string _pattern;
|
|
||||||
static std::string _spawnZoneName;
|
|
||||||
|
|
||||||
typedef std::map<std::string, CSpawnZone> TSpawnZoneMap;
|
|
||||||
typedef std::map<std::string, NLLIGO::CPrimPoint> TSpawnPointMap;
|
|
||||||
|
|
||||||
static TSpawnZoneMap _spawnZones;
|
|
||||||
static TSpawnPointMap _spawnPoints;
|
|
||||||
|
|
||||||
// for grid
|
|
||||||
static int _linelen, _leftonline;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
} // end of namespace AGS_TEST
|
|
||||||
|
|
||||||
#endif // GD_POSITION_GENERATOR_H
|
|
@ -1,144 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "nel/misc/types_nl.h"
|
|
||||||
#include "nel/net/service.h"
|
|
||||||
#include "nel/misc/path.h"
|
|
||||||
#include "game_share/tick_event_handler.h"
|
|
||||||
#include "game_share/ryzom_version.h"
|
|
||||||
|
|
||||||
#include "messages.h" // singleton manager for transport class messages
|
|
||||||
#include "mirrors.h" // singleton manager for data in mirrors
|
|
||||||
#include "sheets.h" // singleton manager for data from george forms
|
|
||||||
#include "move_manager.h" // singleton manager for agent movement
|
|
||||||
#include "command_event_manager.h"
|
|
||||||
|
|
||||||
//#include "combat_interface.h"
|
|
||||||
//#include "bot_chat_interface.h"
|
|
||||||
|
|
||||||
#include "actor_manager.h" // actor manager - the back end of the service
|
|
||||||
|
|
||||||
using namespace NLMISC;
|
|
||||||
using namespace NLNET;
|
|
||||||
using namespace std;
|
|
||||||
using namespace AGS_TEST;
|
|
||||||
|
|
||||||
|
|
||||||
static TUnifiedCallbackItem CallbackArray[] =
|
|
||||||
{
|
|
||||||
{ "QWERTY", 0, },
|
|
||||||
};
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------*\
|
|
||||||
SERVICE CLASS
|
|
||||||
\*-----------------------------------------------------------------*/
|
|
||||||
|
|
||||||
class CAgsTest : public NLNET::IService
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
void init();
|
|
||||||
bool update();
|
|
||||||
void release() {}
|
|
||||||
void tickRelease();
|
|
||||||
};
|
|
||||||
|
|
||||||
// callback for the 'tick' update message
|
|
||||||
static void cbTick();
|
|
||||||
|
|
||||||
// callback for the 'tick' release message
|
|
||||||
void cbTickRelease()
|
|
||||||
{
|
|
||||||
(static_cast<CAgsTest*>(CAgsTest::getInstance()))->tickRelease();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------*\
|
|
||||||
SERVICE INIT & RELEASE
|
|
||||||
\*-----------------------------------------------------------------*/
|
|
||||||
|
|
||||||
///init
|
|
||||||
|
|
||||||
void CAgsTest::init (void)
|
|
||||||
{
|
|
||||||
setVersion (RYZOM_VERSION);
|
|
||||||
|
|
||||||
// setup the update systems
|
|
||||||
// setUpdateTimeout(200);
|
|
||||||
|
|
||||||
// Load the sheet id lookup table
|
|
||||||
|
|
||||||
// init sub systems
|
|
||||||
CSheets::init();
|
|
||||||
CMirrors::init(cbTick, NULL, cbTickRelease);
|
|
||||||
CMessages::init();
|
|
||||||
CMoveManager::init();
|
|
||||||
CActorManager::init();
|
|
||||||
//CCombatInterface::init();
|
|
||||||
//CBotChatInterface::init();
|
|
||||||
CCommandEventManager::init();
|
|
||||||
|
|
||||||
// setup the debug filters
|
|
||||||
DebugLog->addNegativeFilter("NETL");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
///release
|
|
||||||
|
|
||||||
void CAgsTest::tickRelease (void)
|
|
||||||
{
|
|
||||||
// release sub systems
|
|
||||||
CSheets::release();
|
|
||||||
CMessages::release();
|
|
||||||
CMoveManager::release();
|
|
||||||
CActorManager::release();
|
|
||||||
//CCombatInterface::release();
|
|
||||||
//CBotChatInterface::release();
|
|
||||||
CCommandEventManager::release();
|
|
||||||
CMirrors::release();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------*\
|
|
||||||
SERVICE UPDATES
|
|
||||||
\*-----------------------------------------------------------------*/
|
|
||||||
|
|
||||||
///update called on each 'tick' message from tick service
|
|
||||||
|
|
||||||
void cbTick()
|
|
||||||
{
|
|
||||||
if ( CMirrors::Mirror.mirrorIsReady() )
|
|
||||||
{
|
|
||||||
CActorManager::update();
|
|
||||||
CMoveManager::update();
|
|
||||||
//CCombatInterface::_events.clear();
|
|
||||||
CCommandEventManager::update();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
///update called every complete cycle of service loop
|
|
||||||
|
|
||||||
bool CAgsTest::update (void)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------*\
|
|
||||||
NLNET_SERVICE_MAIN
|
|
||||||
\*-----------------------------------------------------------------*/
|
|
||||||
NLNET_SERVICE_MAIN (CAgsTest, "AGS", "ags_test_service", 0, CallbackArray, "", "")
|
|
||||||
|
|
@ -1,111 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Misc
|
|
||||||
#include "nel/misc/path.h"
|
|
||||||
#include "nel/misc/file.h"
|
|
||||||
#include "nel/misc/smart_ptr.h"
|
|
||||||
#include "nel/misc/command.h"
|
|
||||||
#include "nel/misc/path.h"
|
|
||||||
// Georges
|
|
||||||
#include "nel/georges/u_form.h"
|
|
||||||
#include "nel/georges/u_form_elm.h"
|
|
||||||
#include "nel/georges/u_form_loader.h"
|
|
||||||
#include "nel/georges/load_form.h"
|
|
||||||
// Local
|
|
||||||
#include "sheets.h"
|
|
||||||
|
|
||||||
|
|
||||||
///////////
|
|
||||||
// USING //
|
|
||||||
///////////
|
|
||||||
using namespace NLMISC;
|
|
||||||
using namespace std;
|
|
||||||
using namespace NLGEORGES;
|
|
||||||
|
|
||||||
namespace AGS_TEST
|
|
||||||
{
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
// the singleton data
|
|
||||||
|
|
||||||
std::map<CSheetId,CSheets::CSheet> CSheets::_Sheets;
|
|
||||||
bool CSheets::_Initialised=false;
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
// init
|
|
||||||
|
|
||||||
void CSheets::init()
|
|
||||||
{
|
|
||||||
if (_Initialised)
|
|
||||||
return;
|
|
||||||
|
|
||||||
std::vector<std::string> filters;
|
|
||||||
filters.push_back("creature");
|
|
||||||
filters.push_back("player");
|
|
||||||
|
|
||||||
loadForm(filters, "data_shard/ags_test.packed_sheets", _Sheets);
|
|
||||||
|
|
||||||
_Initialised=true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
// display
|
|
||||||
|
|
||||||
void CSheets::display(NLMISC::CLog *log)
|
|
||||||
{
|
|
||||||
nlassert(_Initialised);
|
|
||||||
|
|
||||||
std::map<CSheetId,CSheets::CSheet>::iterator it;
|
|
||||||
for(it=_Sheets.begin();it!=_Sheets.end();++it)
|
|
||||||
{
|
|
||||||
log->displayNL("SHEET:%s Walk:%f Run:%f Radius:%f Height:%f Bounding:%f Type:%s ChatType: %s",(*it).first.toString().c_str(),
|
|
||||||
(*it).second.WalkSpeed,
|
|
||||||
(*it).second.RunSpeed,
|
|
||||||
(*it).second.Radius,
|
|
||||||
(*it).second.Height,
|
|
||||||
(*it).second.BoundingRadius,
|
|
||||||
// (*it).second.Name.c_str(),
|
|
||||||
(*it).second.isNpc?"NPC": "CREATURE",
|
|
||||||
(std::string()+((*it).second.CanChatTP?"TP ":"")+((*it).second.CanChatTrade?"MERCHANT ":"")+((*it).second.CanChatMission?"MISSION ":"")).c_str()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
// lookup
|
|
||||||
|
|
||||||
const CSheets::CSheet *CSheets::lookup( CSheetId id )
|
|
||||||
{
|
|
||||||
nlassert(_Initialised);
|
|
||||||
|
|
||||||
// setup an iterator and lookup the sheet id in the map
|
|
||||||
std::map<CSheetId,CSheets::CSheet>::iterator it=_Sheets.find(id);
|
|
||||||
|
|
||||||
// if we found a valid entry return a pointer to the creature record otherwise 0
|
|
||||||
if (it!=_Sheets.end())
|
|
||||||
return &((*it).second);
|
|
||||||
else
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
} //namespace AGS_TEST
|
|
||||||
|
|
@ -1,178 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef RY_AGST_SHEETS_H
|
|
||||||
#define RY_AGST_SHEETS_H
|
|
||||||
|
|
||||||
|
|
||||||
// Nel Misc
|
|
||||||
#include "nel/misc/types_nl.h"
|
|
||||||
#include "nel/misc/smart_ptr.h"
|
|
||||||
#include "nel/misc/sheet_id.h"
|
|
||||||
|
|
||||||
///Nel Georges
|
|
||||||
#include "nel/georges/u_form.h"
|
|
||||||
#include "nel/georges/u_form_elm.h"
|
|
||||||
|
|
||||||
|
|
||||||
namespace AGS_TEST
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Singleton containing database on information for actors
|
|
||||||
* \author Sadge
|
|
||||||
* \author Nevrax France
|
|
||||||
* \date 2002
|
|
||||||
*/
|
|
||||||
class CSheets
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
class CSheet
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
CSheet(): WalkSpeed(1.3f), RunSpeed(6.0f), Radius(0.5f), Height(2.0f), BoundingRadius(0.5) {}
|
|
||||||
|
|
||||||
uint32 Level; // Level of the creature
|
|
||||||
|
|
||||||
float AttackThreshold;
|
|
||||||
float FleeThreshold;
|
|
||||||
float SurvivalThreshold;
|
|
||||||
|
|
||||||
float WalkSpeed;
|
|
||||||
float RunSpeed;
|
|
||||||
float Radius; // pacs primitive's radius
|
|
||||||
float Height; // pacs primitive's height
|
|
||||||
float BoundingRadius; // fighting radius
|
|
||||||
bool isNpc; // is it an Npc or is it a creature?
|
|
||||||
bool CanChatTP; // true if can access chat teleport sub-menu
|
|
||||||
bool CanChatTrade; // true if can access chat trade sub-menu
|
|
||||||
bool CanChatMission; // true if can access chat mission sub-menu
|
|
||||||
// std::string Name;
|
|
||||||
|
|
||||||
void readGeorges (const NLMISC::CSmartPtr<NLGEORGES::UForm> &form, const NLMISC::CSheetId &sheetId)
|
|
||||||
{
|
|
||||||
const NLGEORGES::UFormElm *elmt = 0;
|
|
||||||
std::string s;
|
|
||||||
uint i;
|
|
||||||
|
|
||||||
// the form was found so read the true values from George
|
|
||||||
form->getRootNode ().getValueByName (WalkSpeed, "Basics.MovementSpeeds.WalkSpeed");
|
|
||||||
form->getRootNode ().getValueByName (RunSpeed, "Basics.MovementSpeeds.RunSpeed");
|
|
||||||
form->getRootNode ().getValueByName (Radius, "Collision.CollisionRadius");
|
|
||||||
form->getRootNode ().getValueByName (Height, "Collision.Height");
|
|
||||||
form->getRootNode ().getValueByName (BoundingRadius, "Collision.BoundingRadius");
|
|
||||||
|
|
||||||
form->getRootNode().getValueByName(Level, "Basics.Level");
|
|
||||||
|
|
||||||
form->getRootNode().getValueByName (AttackThreshold, "AI.IsA.combatif.seuil_attaque");
|
|
||||||
form->getRootNode().getValueByName (AttackThreshold, "AI.IsA.combatif.seuil_fuite");
|
|
||||||
form->getRootNode().getValueByName (SurvivalThreshold, "AI.IsA.combatif.poids_survie");
|
|
||||||
|
|
||||||
// form->getRootNode ().getValueByName (Name, "Basics.First Name");
|
|
||||||
// form->getRootNode ().getValueByName (s, "Basics.CharacterName");
|
|
||||||
// if (!Name.empty())
|
|
||||||
// Name+=' ';
|
|
||||||
// Name+=s;
|
|
||||||
|
|
||||||
// are we a creature or an NPC?
|
|
||||||
form->getRootNode ().getValueByName (s, "Basics.Race");
|
|
||||||
isNpc= s=="Fyros"? true:
|
|
||||||
s=="Tryker"? true:
|
|
||||||
s=="Zorai"? true:
|
|
||||||
s=="Matis"? true:
|
|
||||||
false;
|
|
||||||
|
|
||||||
// can we chat mission?
|
|
||||||
if (form->getRootNode ().getValueByName (s, "Basics.Race"))
|
|
||||||
CanChatMission= (s=="Kami");
|
|
||||||
|
|
||||||
// can we chat trade?
|
|
||||||
CanChatTrade=false;
|
|
||||||
for (i=1;i<5;++i)
|
|
||||||
{
|
|
||||||
if (form->getRootNode ().getValueByName (s, (std::string("ShopKeeper infos.ObjectType")+char('0'+i)).c_str()))
|
|
||||||
CanChatTrade|= (s!="UNDEFINED" && s!="Unknown" && !s.empty());
|
|
||||||
if (form->getRootNode ().getValueByName (s, (std::string("ShopKeeper infos.ObjectType")+char('0'+i)).c_str()))
|
|
||||||
CanChatTrade|= (s!="UNDEFINED" && s!="Unknown" && !s.empty());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (form->getRootNode ().getNodeByName(&elmt,"ShopKeeper infos.Special Items") && elmt!=0)
|
|
||||||
{
|
|
||||||
uint arraySize;
|
|
||||||
elmt->getArraySize(arraySize);
|
|
||||||
CanChatTrade|= (arraySize!=0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (form->getRootNode ().getNodeByName(&elmt,"ShopKeeper infos.Special Mp") && elmt!=0)
|
|
||||||
{
|
|
||||||
uint arraySize;
|
|
||||||
elmt->getArraySize(arraySize);
|
|
||||||
CanChatTrade|= (arraySize!=0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// can we chat TP?
|
|
||||||
form->getRootNode ().getValueByName (s, "ShopKeeper infos.TeleportType");
|
|
||||||
CanChatTP= (s!="NONE");
|
|
||||||
|
|
||||||
if (CanChatMission) nlinfo("bot can chat Mission: %s",sheetId.toString().c_str());
|
|
||||||
if (CanChatTrade) nlinfo("bot can chat Trade: %s",sheetId.toString().c_str());
|
|
||||||
if (CanChatTP) nlinfo("bot can chat TP: %s",sheetId.toString().c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
void serial (NLMISC::IStream &s)
|
|
||||||
{
|
|
||||||
s.serial (WalkSpeed, RunSpeed, Radius, Height);
|
|
||||||
s.serial (BoundingRadius, isNpc/*, Name*/);
|
|
||||||
s.serial (CanChatTP, CanChatTrade, CanChatMission);
|
|
||||||
s.serial (Level);
|
|
||||||
s.serial( AttackThreshold, FleeThreshold, SurvivalThreshold);
|
|
||||||
}
|
|
||||||
|
|
||||||
void removed() {}
|
|
||||||
|
|
||||||
static uint getVersion () { return 6; }
|
|
||||||
};
|
|
||||||
|
|
||||||
// load the creature data from the george files
|
|
||||||
static void init ();
|
|
||||||
static void removeUnsuableSheets ();
|
|
||||||
|
|
||||||
// display the creature data for all known creature types
|
|
||||||
static void display(NLMISC::CLog *log = NLMISC::InfoLog);
|
|
||||||
|
|
||||||
//
|
|
||||||
static void release() {}
|
|
||||||
|
|
||||||
// get a data record from the database
|
|
||||||
static const CSheet *lookup( NLMISC::CSheetId id );
|
|
||||||
|
|
||||||
private:
|
|
||||||
// prohibit cnstructor as this is a singleton
|
|
||||||
CSheets();
|
|
||||||
|
|
||||||
static std::map<NLMISC::CSheetId,CSheet> _Sheets;
|
|
||||||
static bool _Initialised;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
} // end of namespace AGS_TEST
|
|
||||||
|
|
||||||
#endif // RY_AGST_SHEETS_H
|
|
@ -1,292 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
#include "nel/misc/debug.h"
|
|
||||||
#include "nel/misc/path.h"
|
|
||||||
|
|
||||||
//#include <io.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "xml.h"
|
|
||||||
|
|
||||||
|
|
||||||
using namespace NLMISC;
|
|
||||||
|
|
||||||
static inline bool isBlank(char c)
|
|
||||||
{
|
|
||||||
static bool lookup[]=
|
|
||||||
{// 0 1 2 3 4 5 6 7 8 9 A B C D E F 0 1 2 3 4 5 6 7 8 9 A B C D E F
|
|
||||||
0,0,0,0, 0,0,0,0, 0,1,1,0, 0,1,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 0
|
|
||||||
1,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 32
|
|
||||||
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 64
|
|
||||||
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 96
|
|
||||||
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 128
|
|
||||||
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 160
|
|
||||||
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 192
|
|
||||||
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 224
|
|
||||||
};
|
|
||||||
return lookup[uint8(c)];
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline bool isTxt(char c)
|
|
||||||
{
|
|
||||||
static bool lookup[]=
|
|
||||||
{// 0 1 2 3 4 5 6 7 8 9 A B C D E F 0 1 2 3 4 5 6 7 8 9 A B C D E F
|
|
||||||
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 0
|
|
||||||
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 1,1,1,1, 1,1,1,1, 1,1,0,0, 0,0,0,0, // 32
|
|
||||||
0,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,0, 0,0,0,1, // 64
|
|
||||||
0,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,0, 0,0,0,0, // 96
|
|
||||||
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 128
|
|
||||||
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 160
|
|
||||||
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 192
|
|
||||||
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 224
|
|
||||||
};
|
|
||||||
return lookup[uint8(c)];
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline bool isArgTxt(char c)
|
|
||||||
{
|
|
||||||
static bool lookup[]=
|
|
||||||
{// 0 1 2 3 4 5 6 7 8 9 A B C D E F 0 1 2 3 4 5 6 7 8 9 A B C D E F
|
|
||||||
0,0,0,0, 0,0,0,0, 0,1,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 0
|
|
||||||
1,1,0,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 0,1,0,1, // 32
|
|
||||||
1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // 64
|
|
||||||
1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // 96
|
|
||||||
1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // 128
|
|
||||||
1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // 160
|
|
||||||
1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // 192
|
|
||||||
1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // 224
|
|
||||||
};
|
|
||||||
return lookup[uint8(c)];
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline bool isFreeTxt(char c)
|
|
||||||
{
|
|
||||||
static bool lookup[]=
|
|
||||||
{// 0 1 2 3 4 5 6 7 8 9 A B C D E F 0 1 2 3 4 5 6 7 8 9 A B C D E F
|
|
||||||
0,0,0,0, 0,0,0,0, 0,1,1,0, 0,1,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 0
|
|
||||||
1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 0,1,0,1, // 32
|
|
||||||
1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // 64
|
|
||||||
1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // 96
|
|
||||||
1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // 128
|
|
||||||
1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // 160
|
|
||||||
1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // 192
|
|
||||||
1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // 224
|
|
||||||
};
|
|
||||||
return lookup[uint8(c)];
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool xmlTxtToString(char *txt,uint length,std::string &destination)
|
|
||||||
{
|
|
||||||
bool result=true;
|
|
||||||
|
|
||||||
destination.erase();
|
|
||||||
destination.reserve(length);
|
|
||||||
|
|
||||||
for (char *ptr=txt;ptr<txt+length;ptr++)
|
|
||||||
if (ptr[0]=='&' && ptr[1]=='a' && ptr[2]=='m' && ptr[3]=='p' && ptr[4]==';')
|
|
||||||
{
|
|
||||||
destination+='&';
|
|
||||||
ptr+=4;
|
|
||||||
}
|
|
||||||
else if (ptr[0]=='&' && ptr[1]=='l' && ptr[2]=='t' && ptr[3]==';')
|
|
||||||
{
|
|
||||||
destination+='<';
|
|
||||||
ptr+=3;
|
|
||||||
}
|
|
||||||
else if (ptr[0]=='&' && ptr[1]=='g' && ptr[2]=='t' && ptr[3]==';')
|
|
||||||
{
|
|
||||||
destination+='>';
|
|
||||||
ptr+=3;
|
|
||||||
}
|
|
||||||
else if (ptr[0]=='&' && ptr[1]=='q' && ptr[2]=='u' && ptr[3]=='o' && ptr[4]=='t' && ptr[5]==';' )
|
|
||||||
{
|
|
||||||
destination+='\"';
|
|
||||||
ptr+=5;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
result = result && (*ptr!='&');
|
|
||||||
destination+=*ptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CxmlNode::read(const std::string &filename)
|
|
||||||
{
|
|
||||||
// opening the file
|
|
||||||
FILE *inf=fopen(filename.c_str(),"rt");
|
|
||||||
if (inf==0)
|
|
||||||
{
|
|
||||||
nlwarning("Failed to open file for reading: %s",filename.c_str());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
nlinfo("READING: %s",filename.c_str());
|
|
||||||
|
|
||||||
// allocate memmory for the read buffer
|
|
||||||
//uint bufsize=filelength(fileno(inf))+1;
|
|
||||||
uint32 bufsize = CFile::getFileSize(filename);
|
|
||||||
char *buf=new char[bufsize+1];
|
|
||||||
if (buf==0)
|
|
||||||
{
|
|
||||||
nlwarning("Failed to allocate memmory for input file: %s",filename.c_str());
|
|
||||||
fclose(inf);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// read the data into the buffer and nul terminate it
|
|
||||||
uint count;
|
|
||||||
count=fread(buf,bufsize,1,inf);
|
|
||||||
nlassert(count<bufsize);
|
|
||||||
buf[count]=0;
|
|
||||||
|
|
||||||
// close the file
|
|
||||||
fclose(inf);
|
|
||||||
|
|
||||||
// skip to the body of the file - if this is a true xml file there is only one body
|
|
||||||
char *ptr;
|
|
||||||
for (ptr=buf;*ptr!=0;ptr++)
|
|
||||||
{
|
|
||||||
if (ptr[0]=='<' && ptr[1]!='?')
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (*ptr==0)
|
|
||||||
{
|
|
||||||
nlwarning("Failed to find XML file body for file: %s",filename.c_str());
|
|
||||||
delete [] (buf);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// pass parsing control over to the main xml file clause
|
|
||||||
bool retval= parseInput(ptr);
|
|
||||||
|
|
||||||
// make sure there's nothing left in the input data stream after parseInput() finishes
|
|
||||||
while (retval && isBlank(*ptr)) ptr++;
|
|
||||||
if (*ptr!=0)
|
|
||||||
retval=false;
|
|
||||||
|
|
||||||
// housekeeping and exit
|
|
||||||
delete [] (buf);
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CxmlNode::parseInput(char * &ptr)
|
|
||||||
{
|
|
||||||
// make sure this clause hasn't already been used
|
|
||||||
nlassert(_name.empty());
|
|
||||||
nlassert(_txt.empty());
|
|
||||||
|
|
||||||
char *marker0;
|
|
||||||
|
|
||||||
// if there's no start of clause marker consider we have free text
|
|
||||||
if (*ptr!='<')
|
|
||||||
{
|
|
||||||
for (;isFreeTxt(*ptr);ptr++) _txt+=*ptr;
|
|
||||||
// make sure the free text is followed by a clause marker of some sort
|
|
||||||
return (*ptr=='<');
|
|
||||||
}
|
|
||||||
|
|
||||||
// skip the opening '<' of the start of clause marker
|
|
||||||
*ptr++;
|
|
||||||
|
|
||||||
// if we have '<!' parse as comment to closing '>'
|
|
||||||
if (*ptr=='!')
|
|
||||||
{
|
|
||||||
while (isFreeTxt(*++ptr)) _txt+=*ptr;
|
|
||||||
// skip the end of comment marker
|
|
||||||
if (*ptr!='>')
|
|
||||||
return false;
|
|
||||||
ptr++;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// this should be a normal named clause so identify the clause name
|
|
||||||
while (isBlank(*ptr)) ptr++;
|
|
||||||
for (marker0=ptr; isTxt(*ptr); ptr++);
|
|
||||||
xmlTxtToString(marker0,ptr-marker0,_name);
|
|
||||||
|
|
||||||
// extract arguments
|
|
||||||
while (isBlank(*ptr)) ptr++;
|
|
||||||
while (isTxt(*ptr))
|
|
||||||
{
|
|
||||||
// extract the argument name for the next argument
|
|
||||||
for (marker0=ptr; isTxt(*ptr); ptr++);
|
|
||||||
std::string argName;
|
|
||||||
xmlTxtToString(marker0,ptr-marker0,argName);
|
|
||||||
|
|
||||||
// skip the '=' sign and following '"' sign
|
|
||||||
while (isBlank(*ptr)) ptr++;
|
|
||||||
if(*ptr!='=')
|
|
||||||
return false;
|
|
||||||
do { ptr++; }while (isBlank(*ptr));
|
|
||||||
if(*ptr!='\"')
|
|
||||||
return false;
|
|
||||||
ptr++;
|
|
||||||
|
|
||||||
// find the string delimited by the quotes
|
|
||||||
for (marker0=ptr; isArgTxt(*ptr); ptr++);
|
|
||||||
if(*ptr!='\"')
|
|
||||||
return false;
|
|
||||||
xmlTxtToString(marker0,ptr-marker0,_args[argName]);
|
|
||||||
|
|
||||||
// skip blanks in preparation for next arg (or end of args)
|
|
||||||
while (isBlank(*ptr)) ptr++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if this is a self-contained clause (ie '<'...'/>') then we've finished
|
|
||||||
if (*ptr=='/' && ptr[1]=='>')
|
|
||||||
{
|
|
||||||
ptr+=2;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// skip the end of clause header marker
|
|
||||||
if (*ptr!='>')
|
|
||||||
return false;
|
|
||||||
ptr++;
|
|
||||||
|
|
||||||
// read sub-clauses
|
|
||||||
while (*ptr && !(ptr[0]=='<'&&ptr[1]=='/'))
|
|
||||||
{
|
|
||||||
CxmlNode *childClause =new CxmlNode;
|
|
||||||
_children.push_back(childClause);
|
|
||||||
childClause->parseInput(ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
// skip the opening '</' of the clause end marker
|
|
||||||
if (!(ptr[0]=='<'&&ptr[1]=='/'))
|
|
||||||
return false;
|
|
||||||
ptr+=2;
|
|
||||||
|
|
||||||
// read the clause name and make sure it matches the original version
|
|
||||||
while (isBlank(*ptr)) ptr++;
|
|
||||||
for (marker0=ptr; isTxt(*ptr); ptr++);
|
|
||||||
std::string name;
|
|
||||||
xmlTxtToString(marker0,ptr-marker0,name);
|
|
||||||
if (name!=_name)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// skip the closing '>' of the clause end marker
|
|
||||||
while (isBlank(*ptr)) ptr++;
|
|
||||||
if (*ptr!='>')
|
|
||||||
return false;
|
|
||||||
ptr+=2;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,55 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
#include "nel/misc/types_nl.h"
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
#include <map>
|
|
||||||
|
|
||||||
|
|
||||||
class CxmlNode
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
bool read(const std::string &filename);
|
|
||||||
bool parseInput(char * &ptr);
|
|
||||||
|
|
||||||
inline const std::string &txt() const { return _txt; }
|
|
||||||
inline const std::string &type() const { return _name; }
|
|
||||||
inline const std::string &arg(const std::string &argName) const
|
|
||||||
{
|
|
||||||
static std::string emptyString;
|
|
||||||
|
|
||||||
std::map<std::string,std::string>::const_iterator it;
|
|
||||||
it=_args.find(argName);
|
|
||||||
|
|
||||||
if (it!=_args.end())
|
|
||||||
return (*it).second;
|
|
||||||
else
|
|
||||||
return emptyString;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline uint childCount() const { return _children.size(); }
|
|
||||||
inline CxmlNode *child(uint index) const { return _children[index]; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::string _txt;
|
|
||||||
std::string _name;
|
|
||||||
std::map<std::string,std::string> _args;
|
|
||||||
std::vector<CxmlNode *> _children;
|
|
||||||
};
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
|||||||
FILE(GLOB SRC *.cpp *.h)
|
|
||||||
|
|
||||||
#LIST(REMOVE_ITEM SRC ${CMAKE_CURRENT_SOURCE_DIR}/ai_entity_id.cpp))
|
|
||||||
|
|
||||||
ADD_EXECUTABLE(ai_data_service WIN32 ${SRC})
|
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(${RZ_SERVER_SRC_DIR} ${MYSQL_INCLUDE_DIR})
|
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES(ai_data_service
|
|
||||||
admin_modules
|
|
||||||
ryzom_gameshare
|
|
||||||
server_share
|
|
||||||
ai_share
|
|
||||||
nelmisc
|
|
||||||
nelnet
|
|
||||||
nelgeorges
|
|
||||||
nelpacs
|
|
||||||
nelligo)
|
|
||||||
|
|
||||||
NL_DEFAULT_PROPS(ai_data_service "Ryzom, Services: AI Data Service (AIDS)")
|
|
||||||
NL_ADD_RUNTIME_FLAGS(ai_data_service)
|
|
||||||
|
|
||||||
INSTALL(TARGETS ai_data_service RUNTIME DESTINATION sbin COMPONENT services)
|
|
||||||
|
|
@ -1,534 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
//#include <direct.h>
|
|
||||||
#include <io.h>
|
|
||||||
|
|
||||||
#include "nel/misc/types_nl.h"
|
|
||||||
#include "nel/misc/path.h"
|
|
||||||
#include "nel/misc/file.h"
|
|
||||||
#include "nel/misc/i_xml.h"
|
|
||||||
#include "nel/misc/o_xml.h"
|
|
||||||
#include "nel/misc/config_file.h"
|
|
||||||
#include "nel/net/service.h"
|
|
||||||
|
|
||||||
|
|
||||||
#include "game_share/xml.h"
|
|
||||||
#include "ai_files.h"
|
|
||||||
#include "ai_manager.h"
|
|
||||||
|
|
||||||
using namespace NLMISC;
|
|
||||||
using namespace NLNET;
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
// LOCAL GLOBALS - EQUIVALENT TO SINGLETON DATA
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class CFileInfo
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
std::string Source;
|
|
||||||
uint Size;
|
|
||||||
uint DateTime;
|
|
||||||
|
|
||||||
void clear()
|
|
||||||
{
|
|
||||||
Source.clear();
|
|
||||||
Size=0;
|
|
||||||
DateTime=0;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
static CFileInfo mgrObjInfo[RYAI_AI_MANAGER_MAX_MANAGERS];
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
// scan() METHOD
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// clear out the data strustures and rescan the directories listed in the config
|
|
||||||
// file for source and object files
|
|
||||||
|
|
||||||
void CAIFiles::scan()
|
|
||||||
{
|
|
||||||
uint i;
|
|
||||||
|
|
||||||
// clear out out the internal data tables before we begin
|
|
||||||
for (i=0;i<CAIManager::maxManagers();i++)
|
|
||||||
mgrObjInfo[i].clear();
|
|
||||||
CAIManager::liberateUnassignedManagers();
|
|
||||||
|
|
||||||
// scan the obj and sav paths for files
|
|
||||||
_scanObjAndSavFiles();
|
|
||||||
|
|
||||||
// iterate through the paths specified in the config file looking for src Files
|
|
||||||
std::vector<std::string> paths=srcPaths();
|
|
||||||
for (i = 0; i < paths.size(); i++)
|
|
||||||
{
|
|
||||||
nlinfo("SCANNING: %s",paths[i].c_str());
|
|
||||||
_scanSrcFiles(paths[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// run through the managers in the AI_Manager singleton, updating parameters
|
|
||||||
for (i=0;i<CAIManager::numManagers();i++)
|
|
||||||
{
|
|
||||||
CAIManager *mgr=CAIManager::getManagerByIdx(i);
|
|
||||||
uint mgrId=mgr->id();
|
|
||||||
nlinfo("Manager: %04d: %s",mgrId,mgr->name().c_str());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
// clean() METHOD
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void CAIFiles::clean(sint mgrId)
|
|
||||||
{
|
|
||||||
remove(fullObjFileName(mgrId).c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
// FILE NAME HANDLING METHODS
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
// source file name, extension, etc
|
|
||||||
|
|
||||||
// the paths for source files
|
|
||||||
std::vector<std::string> CAIFiles::srcPaths()
|
|
||||||
{
|
|
||||||
std::vector<std::string> v;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
CConfigFile::CVar& var = IService::getInstance()->ConfigFile.getVar("SrcPaths");
|
|
||||||
for (uint i = 0; i < var.size(); i++)
|
|
||||||
v.push_back(CPath::standardizePath(var.asString(i)));
|
|
||||||
}
|
|
||||||
catch(EUnknownVar &)
|
|
||||||
{
|
|
||||||
nlwarning("<SrcPaths> missing variables in config file, using '.'");
|
|
||||||
v.push_back(std::string("./"));
|
|
||||||
}
|
|
||||||
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
// the standard src extension
|
|
||||||
std::string CAIFiles::srcExtension()
|
|
||||||
{
|
|
||||||
return std::string("primitive");
|
|
||||||
}
|
|
||||||
|
|
||||||
// without path or extension
|
|
||||||
std::string CAIFiles::srcName(sint mgrId)
|
|
||||||
{
|
|
||||||
return CFile::getFilenameWithoutExtension(fullSrcFileName(mgrId));
|
|
||||||
}
|
|
||||||
|
|
||||||
// without path
|
|
||||||
std::string CAIFiles::srcFileName(sint mgrId)
|
|
||||||
{
|
|
||||||
return CFile::getFilename(fullSrcFileName(mgrId));
|
|
||||||
}
|
|
||||||
|
|
||||||
// without extension
|
|
||||||
std::string CAIFiles::fullSrcName(sint mgrId)
|
|
||||||
{
|
|
||||||
return
|
|
||||||
CFile::getPath(fullSrcFileName(mgrId))+
|
|
||||||
CFile::getFilenameWithoutExtension(fullSrcFileName(mgrId));
|
|
||||||
}
|
|
||||||
|
|
||||||
// with path and extension
|
|
||||||
std::string CAIFiles::fullSrcFileName(sint mgrId)
|
|
||||||
{
|
|
||||||
if (uint(mgrId)>=CAIManager::maxManagers())
|
|
||||||
{
|
|
||||||
nlwarning("CAIFiles::fullSrcFileName(mgrId): mgrId %d not in range 0..%d",mgrId,CAIManager::maxManagers()-1);
|
|
||||||
return string();
|
|
||||||
}
|
|
||||||
|
|
||||||
return mgrObjInfo[mgrId].Source;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
// object file name, extension, etc
|
|
||||||
|
|
||||||
// the path for obj files
|
|
||||||
std::string CAIFiles::objPath()
|
|
||||||
{
|
|
||||||
std::string s;
|
|
||||||
|
|
||||||
// get the object path from the config file
|
|
||||||
try
|
|
||||||
{
|
|
||||||
s=IService::getInstance()->ConfigFile.getVar("ObjPath").asString();
|
|
||||||
}
|
|
||||||
catch(EUnknownVar &)
|
|
||||||
{
|
|
||||||
nlwarning("<ObjPath> missing variables in config file, using '.'");
|
|
||||||
}
|
|
||||||
|
|
||||||
// if we haven't found a path use the current directory
|
|
||||||
if (s.empty())
|
|
||||||
s="./";
|
|
||||||
|
|
||||||
return CPath::standardizePath(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
// the standard obj file extension
|
|
||||||
std::string CAIFiles::objExtension()
|
|
||||||
{
|
|
||||||
return std::string("aimgr_obj");
|
|
||||||
}
|
|
||||||
|
|
||||||
// without path or extension
|
|
||||||
std::string CAIFiles::objName(sint mgrId)
|
|
||||||
{
|
|
||||||
if (uint(mgrId)>=CAIManager::maxManagers())
|
|
||||||
{
|
|
||||||
nlwarning("CAIFiles::fullSrcFileName(mgrId): mgrId %d not in range 0..%d",mgrId,CAIManager::maxManagers()-1);
|
|
||||||
return string();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string s;
|
|
||||||
s+=(mgrId/1000)+'0';
|
|
||||||
s+=(mgrId%1000)/100+'0';
|
|
||||||
s+=(mgrId%100)/10+'0';
|
|
||||||
s+=(mgrId%10)+'0';
|
|
||||||
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
// without extension
|
|
||||||
std::string CAIFiles::objFileName(sint mgrId)
|
|
||||||
{
|
|
||||||
// if the objName() method fails to generate a file name return an empty string
|
|
||||||
std::string s=objName(mgrId);
|
|
||||||
if (s.empty())
|
|
||||||
return s;
|
|
||||||
|
|
||||||
return s+'.'+objExtension();
|
|
||||||
}
|
|
||||||
|
|
||||||
// with path and extension
|
|
||||||
std::string CAIFiles::fullObjFileName(sint mgrId)
|
|
||||||
{
|
|
||||||
// if the objFileName() method fails to generate a file name return an empty string
|
|
||||||
std::string s=objFileName(mgrId);
|
|
||||||
if (s.empty())
|
|
||||||
return s;
|
|
||||||
|
|
||||||
return objPath()+s;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
// saved data file name, extension, etc
|
|
||||||
|
|
||||||
// the path for sav files
|
|
||||||
std::string CAIFiles::savPath()
|
|
||||||
{
|
|
||||||
std::string s;
|
|
||||||
|
|
||||||
// get the sav path from the config file
|
|
||||||
try
|
|
||||||
{
|
|
||||||
s=IService::getInstance()->ConfigFile.getVar("SavPath").asString();
|
|
||||||
}
|
|
||||||
catch(EUnknownVar &)
|
|
||||||
{
|
|
||||||
nlwarning("<SavPath> missing variables in config file, using <ObjPath>");
|
|
||||||
return objPath();
|
|
||||||
}
|
|
||||||
|
|
||||||
// if we haven't found a path use the current directory
|
|
||||||
if (s.empty())
|
|
||||||
s="./";
|
|
||||||
|
|
||||||
return CPath::standardizePath(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
// the standard sav file extension
|
|
||||||
std::string CAIFiles::savExtension()
|
|
||||||
{
|
|
||||||
return std::string("aimgr_sav");
|
|
||||||
}
|
|
||||||
|
|
||||||
// without path or extension
|
|
||||||
std::string CAIFiles::savName(sint mgrId)
|
|
||||||
{
|
|
||||||
return objName(mgrId);
|
|
||||||
}
|
|
||||||
|
|
||||||
// without extension
|
|
||||||
std::string CAIFiles::savFileName(sint mgrId)
|
|
||||||
{
|
|
||||||
// if the savName() method fails to generate a file name return an empty string
|
|
||||||
std::string s=savName(mgrId);
|
|
||||||
if (s.empty())
|
|
||||||
return s;
|
|
||||||
|
|
||||||
return s+'.'+savExtension();
|
|
||||||
}
|
|
||||||
|
|
||||||
// with path and extension
|
|
||||||
std::string CAIFiles::fullSavFileName(sint mgrId)
|
|
||||||
{
|
|
||||||
// if the savName() method fails to generate a file name return an empty string
|
|
||||||
std::string s=savName(mgrId);
|
|
||||||
if (s.empty())
|
|
||||||
return s;
|
|
||||||
|
|
||||||
return savPath()+s;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
// CAIFiles PUBLIC METHODS - FOR READING & WRITING OBJ FILES
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void CAIFiles::writeObjFile(sint mgrId)
|
|
||||||
{
|
|
||||||
// write the output file
|
|
||||||
NLMISC::COFile file;
|
|
||||||
bool fileIsOpen=false;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
NLMISC::COXml output;
|
|
||||||
|
|
||||||
if (!file.open(fullObjFileName(mgrId))) throw(NLMISC::Exception());
|
|
||||||
fileIsOpen=true;
|
|
||||||
if (output.init (&file, "1.0"))
|
|
||||||
{
|
|
||||||
output.xmlPush("AI_MANAGER");
|
|
||||||
std::string src=CAIFiles::srcName(mgrId);
|
|
||||||
((NLMISC::IStream*)&output)->serial(src);
|
|
||||||
CAIManager::getManagerById(mgrId)->MgrDfnRootNode.serial(output);
|
|
||||||
output.xmlPop();
|
|
||||||
output.flush ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (NLMISC::Exception &)
|
|
||||||
{
|
|
||||||
nlwarning("CAIFiles::writeObjFile(): Failed to write the output file: %s",fullObjFileName(mgrId).c_str());
|
|
||||||
}
|
|
||||||
// close file outside exception handling in case exception thrown somewhere strange
|
|
||||||
if (fileIsOpen)
|
|
||||||
file.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
// CAIFiles PRIVATE METHODS - FOR ADDING FILE RECORDS TO RELAVENT DATA STRUCTURES
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void CAIFiles::_addObjFile(sint mgrId, std::string fullFileName, uint timestamp)
|
|
||||||
{
|
|
||||||
// read the input file
|
|
||||||
NLMISC::CIFile file;
|
|
||||||
bool fileIsOpen=false;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
NLMISC::CIXml input;
|
|
||||||
|
|
||||||
if (!file.open(fullObjFileName(mgrId))) throw(NLMISC::Exception());
|
|
||||||
fileIsOpen=true;
|
|
||||||
if (input.init (file))
|
|
||||||
{
|
|
||||||
input.xmlPush("AI_MANAGER");
|
|
||||||
((NLMISC::IStream*)&input)->serial(mgrObjInfo[mgrId].Source);
|
|
||||||
CAIManager::getManagerById(mgrId)->MgrDfnRootNode.serial(input);
|
|
||||||
input.xmlPop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (NLMISC::Exception &)
|
|
||||||
{
|
|
||||||
nlwarning("CAIFiles::_addObjFile(): Failed to read the input file: %s",fullObjFileName(mgrId).c_str());
|
|
||||||
}
|
|
||||||
// close file outside exception handling in case exception thrown somewhere strange
|
|
||||||
if (fileIsOpen)
|
|
||||||
file.close();
|
|
||||||
|
|
||||||
// ask the ai manager to initialise itself with name 'name' (fails if manager is running)
|
|
||||||
if (!CAIManager::getManagerById(mgrId)->set(srcName(mgrId)))
|
|
||||||
{
|
|
||||||
nlwarning("Conflict between running manager %04d named '%s' and name in obj file '%s'",
|
|
||||||
mgrId,CAIManager::getManagerById(mgrId)->name().c_str(),srcName(mgrId).c_str());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// assign the new record to the designated slot
|
|
||||||
mgrObjInfo[mgrId].DateTime=timestamp; // timestamp of obj file
|
|
||||||
|
|
||||||
// update the manager flags
|
|
||||||
CAIManager::getManagerById(mgrId)->setObjFileExists(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void CAIFiles::_addSavFile(sint mgrId, std::string fullFileName)
|
|
||||||
{
|
|
||||||
// open and parse the file
|
|
||||||
CxmlNode theXmlFile;
|
|
||||||
if (!theXmlFile.read(fullFileName))
|
|
||||||
{
|
|
||||||
nlwarning("Failed to parse xml file: %s",fullFileName.c_str());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// make sure the main xml clause is of the correct type for an obj file
|
|
||||||
if (theXmlFile.type()!=string("ai_manager_dynamic_data"))
|
|
||||||
{
|
|
||||||
nlwarning("Ignoring file %s because main clause is not 'ai_manager_dynamic_data'",fullFileName.c_str());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// extract the 'name' argument from the main clause
|
|
||||||
std::string name=theXmlFile.arg("name");
|
|
||||||
if (name.empty())
|
|
||||||
{
|
|
||||||
nlwarning("No manager name found in save file: %s",fullFileName.c_str());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ask the ai manager to initialis itself with name 'name' (fails if manager is running)
|
|
||||||
if (!CAIManager::getManagerById(mgrId)->set(name))
|
|
||||||
{
|
|
||||||
nlwarning("Conflict between running manager %04d named '%s' and name in sav file '%s'",
|
|
||||||
mgrId,CAIManager::getManagerById(mgrId)->name().c_str(),name.c_str());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void CAIFiles::_addSrcFile(std::string fileName,std::string fullFileName, uint timestamp)
|
|
||||||
{
|
|
||||||
// generate a manger name from the file name
|
|
||||||
std::string name=CFile::getFilenameWithoutExtension(fileName);
|
|
||||||
|
|
||||||
// ask the CAIManager singleton for a manager id for this name
|
|
||||||
sint mgrId = CAIManager::nameToId(name,true);
|
|
||||||
if (mgrId==-1)
|
|
||||||
{
|
|
||||||
nlwarning("Failed to allocate a manager id for name '%s' (manager ids 0..%d)",
|
|
||||||
name.c_str(), CAIManager::maxManagers()-1);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// make sure that we don't have another file already allocated to this manager
|
|
||||||
if (!mgrObjInfo[mgrId].Source.empty() && fullSrcFileName(mgrId)!=fullFileName && srcName(mgrId)!=NLMISC::CFile::getFilenameWithoutExtension(fullFileName))
|
|
||||||
{
|
|
||||||
nlwarning("File name conflict for: %s: %s != %s",
|
|
||||||
name.c_str(),mgrObjInfo[mgrId].Source.c_str(),NLMISC::CFile::getFilenameWithoutExtension(fullFileName).c_str());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// assign the file name
|
|
||||||
mgrObjInfo[mgrId].Source=fullFileName;
|
|
||||||
|
|
||||||
// update the manager flags
|
|
||||||
if (timestamp>mgrObjInfo[mgrId].DateTime)
|
|
||||||
CAIManager::getManagerById(mgrId)->setNeedCompile(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
// CAIFiles PRIVATE METHODS - FOR DIRECTORIES FOR FILES
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void CAIFiles::_scanSrcFiles(const std::string &path)
|
|
||||||
{
|
|
||||||
//nlinfo("Scanning source directory: %s",path.c_str());
|
|
||||||
|
|
||||||
// setup the directory scan
|
|
||||||
_finddata_t fd;
|
|
||||||
long searchHandle;
|
|
||||||
if( (searchHandle = _findfirst( (path+"*").c_str(), &fd )) == -1L )
|
|
||||||
{
|
|
||||||
nlwarning("Nothing found in directory: %s",path.c_str());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// iterate through found entries in the directory
|
|
||||||
do
|
|
||||||
{
|
|
||||||
// if we have a directory then recurse
|
|
||||||
if ( (fd.attrib & _A_SUBDIR) != 0 )
|
|
||||||
{
|
|
||||||
// ignore '.' and '..' entries
|
|
||||||
if (fd.name[0]!='.' || (fd.name[1]!=0 && (fd.name[1]!='.' || fd.name[2]!=0) ) )
|
|
||||||
_scanSrcFiles(path+std::string(fd.name)+"/");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// we've found a file so have a look to see whether its one of ours
|
|
||||||
std::string fileName=std::string(fd.name);
|
|
||||||
if (CFile::getExtension(fileName)==srcExtension())
|
|
||||||
_addSrcFile(fileName, path+fileName, uint32(fd.time_write));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
while( _findnext( searchHandle, &fd ) == 0 );
|
|
||||||
|
|
||||||
// housekeeping
|
|
||||||
_findclose( searchHandle );
|
|
||||||
}
|
|
||||||
|
|
||||||
void CAIFiles::_scanObjAndSavFiles()
|
|
||||||
{
|
|
||||||
// setup to scan for obj files
|
|
||||||
std::string path=objPath();
|
|
||||||
nlinfo("Scanning directory: %s for *.%s",path.c_str(),objExtension().c_str());
|
|
||||||
|
|
||||||
// iterate through manager ids looking for correspoding files
|
|
||||||
for (uint i=0;i<CAIManager::maxManagers();i++)
|
|
||||||
{
|
|
||||||
// compose the file name
|
|
||||||
std::string filename=path+objFileName(sint(i));
|
|
||||||
_finddata_t fd;
|
|
||||||
|
|
||||||
// look for the file and retrieve timestamp info if found
|
|
||||||
long searchHandle;
|
|
||||||
if( (searchHandle=_findfirst(filename.c_str(),&fd)) != -1L )
|
|
||||||
_addObjFile(i, filename.c_str(), uint32(fd.time_write));
|
|
||||||
_findclose( searchHandle );
|
|
||||||
}
|
|
||||||
|
|
||||||
// setup to scan for sav files
|
|
||||||
path=savPath();
|
|
||||||
nlinfo("Scanning directory: %s for *.%s",path.c_str(),savExtension().c_str());
|
|
||||||
|
|
||||||
// iterate through manager ids looking for correspoding files
|
|
||||||
for (uint j=0;j<CAIManager::maxManagers();j++)
|
|
||||||
{
|
|
||||||
// if we've already found the name then we don't bother looking for the sav file
|
|
||||||
if (!CAIManager::getManagerById(j)->name().empty()) continue;
|
|
||||||
|
|
||||||
// compose the file name
|
|
||||||
std::string filename=path+savFileName(sint(j));
|
|
||||||
_finddata_t fd;
|
|
||||||
|
|
||||||
// look for the file
|
|
||||||
long searchHandle;
|
|
||||||
if( (searchHandle=_findfirst(filename.c_str(),&fd)) != -1L )
|
|
||||||
_addSavFile(j,filename.c_str());
|
|
||||||
_findclose( searchHandle );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,75 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef RYAI_AI_FILES_H
|
|
||||||
#define RYAI_AI_FILES_H
|
|
||||||
|
|
||||||
#include "nel/misc/types_nl.h"
|
|
||||||
#include "nel/misc/sheet_id.h"
|
|
||||||
#include "nel/misc/entity_id.h"
|
|
||||||
|
|
||||||
#include "nel/net/transport_class.h"
|
|
||||||
|
|
||||||
#include <map>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
class CAIFiles
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
// clear out the data strustures and rescan the directories listed in the config
|
|
||||||
// file for source and object files
|
|
||||||
static void scan();
|
|
||||||
|
|
||||||
// delete the object files (and temporary files if any) for a given manager
|
|
||||||
static void clean(sint mgrId);
|
|
||||||
|
|
||||||
// source file name, extension, etc
|
|
||||||
static std::vector<std::string> srcPaths(); // the paths for source files
|
|
||||||
static std::string srcExtension(); // the standard src extension
|
|
||||||
static std::string srcName(sint mgrId); // without path or extension
|
|
||||||
static std::string srcFileName(sint mgrId); // without path
|
|
||||||
static std::string fullSrcName(sint mgrId); // without extension
|
|
||||||
static std::string fullSrcFileName(sint mgrId); // with path and extension
|
|
||||||
|
|
||||||
// object file name, extension, etc
|
|
||||||
static std::string objPath(); // the path for obj files
|
|
||||||
static std::string objExtension(); // the standard obj file extension
|
|
||||||
static std::string objName(sint mgrId); // without path or extension
|
|
||||||
static std::string objFileName(sint mgrId); // without extension
|
|
||||||
static std::string fullObjFileName(sint mgrId); // with path and extension
|
|
||||||
|
|
||||||
// saved data file name, extension, etc
|
|
||||||
static std::string savPath(); // the path for sav files
|
|
||||||
static std::string savExtension(); // the standard sav file extension
|
|
||||||
static std::string savName(sint mgrId); // without path or extension
|
|
||||||
static std::string savFileName(sint mgrId); // without extension
|
|
||||||
static std::string fullSavFileName(sint mgrId); // with path and extension
|
|
||||||
|
|
||||||
// Reading & writing object files
|
|
||||||
static void CAIFiles::writeObjFile(sint mgrId);
|
|
||||||
|
|
||||||
private:
|
|
||||||
static void CAIFiles::_addSrcFile(std::string fileName,std::string fullFileName, uint timestamp);
|
|
||||||
static void CAIFiles::_addObjFile(sint mgrId,std::string fullFileName, uint timestamp);
|
|
||||||
static void CAIFiles::_addSavFile(sint mgrId,std::string fullFileName);
|
|
||||||
|
|
||||||
static void CAIFiles::_scanSrcFiles(const std::string &path);
|
|
||||||
static void CAIFiles::_scanObjAndSavFiles();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,486 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//===================================================================
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
AI Managers
|
|
||||||
|
|
||||||
-- individual --
|
|
||||||
what's my id
|
|
||||||
what's my root name (what's my source file name)
|
|
||||||
which service am i on
|
|
||||||
do I need recompiling
|
|
||||||
what's my load weighting
|
|
||||||
|
|
||||||
-- container --
|
|
||||||
vector?
|
|
||||||
get manager by name
|
|
||||||
get manager by id
|
|
||||||
|
|
||||||
queue of managers waiting to be allocated to servers - queue is processed on
|
|
||||||
service update, dispatching new 'manager up's to services who are currently
|
|
||||||
not in the process of loading
|
|
||||||
|
|
||||||
***
|
|
||||||
if we add a concept of manager families then we can launch rafts of managers together
|
|
||||||
this can make it easy to explicitly ballance loading
|
|
||||||
|
|
||||||
***
|
|
||||||
even better would be to group by service and assume that all services have same power
|
|
||||||
this way all can be launched and assigned as services come up. if the services are
|
|
||||||
launched @ 1 per CPU or one per server then we can explictly overload, and
|
|
||||||
automatically load ballance afterwards...
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "nel/misc/debug.h"
|
|
||||||
#include "nel/misc/file.h"
|
|
||||||
#include "nel/misc/config_file.h"
|
|
||||||
#include "nel/misc/path.h"
|
|
||||||
#include "nel/net/service.h"
|
|
||||||
|
|
||||||
#include "game_share/xml.h"
|
|
||||||
#include "ai_share/ai_share.h"
|
|
||||||
|
|
||||||
#include "ai_manager.h"
|
|
||||||
#include "ai_service.h"
|
|
||||||
#include "ai_files.h"
|
|
||||||
#include "aids_actions.h"
|
|
||||||
|
|
||||||
using namespace NLMISC;
|
|
||||||
using namespace NLNET;
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
|
|
||||||
//===================================================================
|
|
||||||
|
|
||||||
//---------------------------------------------------
|
|
||||||
// INSTANTIATED CLASS: Public methods
|
|
||||||
|
|
||||||
//-------------
|
|
||||||
// a few read accessors (static properties)
|
|
||||||
|
|
||||||
// the manager id (0..255)
|
|
||||||
sint CAIManager::id() const
|
|
||||||
{
|
|
||||||
return int(this-_managers);
|
|
||||||
}
|
|
||||||
// the manager name .. ie the source file name minus extension
|
|
||||||
const std::string &CAIManager::name() const
|
|
||||||
{
|
|
||||||
return _name;
|
|
||||||
}
|
|
||||||
|
|
||||||
// the CPU load rating of the manager for auto-load ballancing purposes
|
|
||||||
uint CAIManager::weightCPU() const
|
|
||||||
{
|
|
||||||
return _weightCPU;
|
|
||||||
}
|
|
||||||
// the RAM load rating of the manager for auto-load ballancing purposes
|
|
||||||
uint CAIManager::weightRAM() const
|
|
||||||
{
|
|
||||||
return _weightRAM;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//-------------
|
|
||||||
// a few read accessors (state of the files on disk)
|
|
||||||
|
|
||||||
// indicates whether newer source files than object files have been located
|
|
||||||
bool CAIManager::needCompile() const
|
|
||||||
{
|
|
||||||
return _needCompile;
|
|
||||||
}
|
|
||||||
// indicate whether an object file has been located in the object directory
|
|
||||||
bool CAIManager::objExists() const
|
|
||||||
{
|
|
||||||
return _objExists;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//-------------
|
|
||||||
// a few read accessors (relating to assignment to & execution by an ai service)
|
|
||||||
|
|
||||||
// has the manager been opened (it may still be waiting to be assigned)
|
|
||||||
bool CAIManager::isOpen() const
|
|
||||||
{
|
|
||||||
return _isOpen;
|
|
||||||
}
|
|
||||||
// has the manager been assigned to a service
|
|
||||||
bool CAIManager::isAssigned() const
|
|
||||||
{
|
|
||||||
return _isAssigned;
|
|
||||||
}
|
|
||||||
// is the manager up and running on the assigned service
|
|
||||||
bool CAIManager::isUp() const
|
|
||||||
{
|
|
||||||
return _isUp;
|
|
||||||
}
|
|
||||||
|
|
||||||
// the id of the service to which the manager is assigned
|
|
||||||
NLNET::TServiceId CAIManager::serviceId() const
|
|
||||||
{
|
|
||||||
return _service;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//-------------
|
|
||||||
// a few basic actions (relating to disk files)
|
|
||||||
|
|
||||||
const std::string &xmlDelimitedString(CxmlNode *xmlNode,const std::string &delimiter)
|
|
||||||
{
|
|
||||||
static const std::string emptyString;
|
|
||||||
|
|
||||||
for (uint i=0;i<xmlNode->childCount();++i)
|
|
||||||
{
|
|
||||||
CxmlNode *child=xmlNode->child(i);
|
|
||||||
if (child->type()==delimiter)
|
|
||||||
if (child->childCount()==1)
|
|
||||||
if (child->child(0)->type()=="")
|
|
||||||
{
|
|
||||||
return child->child(0)->txt();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return emptyString;
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::string &getProp(CxmlNode *xmlNode,const std::string &propertyName)
|
|
||||||
{
|
|
||||||
static const std::string emptyString;
|
|
||||||
|
|
||||||
for (uint i=0;i<xmlNode->childCount();++i)
|
|
||||||
{
|
|
||||||
CxmlNode *child=xmlNode->child(i);
|
|
||||||
if (child->type()=="PROPERTY")
|
|
||||||
{
|
|
||||||
const std::string &name= xmlDelimitedString(child,std::string("NAME"));
|
|
||||||
if (name==propertyName)
|
|
||||||
return xmlDelimitedString(child,std::string("STRING"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return emptyString;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// compile the source files to generate new object files
|
|
||||||
void CAIManager::compile()
|
|
||||||
{
|
|
||||||
// get the file names of input and output files
|
|
||||||
std::string srcFile=CAIFiles::fullSrcFileName(id());
|
|
||||||
std::string objFile=CAIFiles::fullObjFileName(id());
|
|
||||||
|
|
||||||
// make sure this file isn't in the ignore list
|
|
||||||
CConfigFile::CVar *varPtr;
|
|
||||||
varPtr=IService::getInstance()->ConfigFile.getVarPtr(std::string("IgnorePrimitives"));
|
|
||||||
if (varPtr==NULL)
|
|
||||||
{
|
|
||||||
nlwarning("Cannot compile file '%s' as IgnorePrimitives variable not found in .cfg file: Please add 'IgnorePrimitives={\"\"};' and try again",CAIFiles::fullSrcFileName(id()).c_str());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (uint i=0;i<varPtr->size();++i)
|
|
||||||
if (CAIFiles::srcName(id())==CFile::getFilenameWithoutExtension(varPtr->asString(i)))
|
|
||||||
{
|
|
||||||
nlinfo("Skipping file in .cfg ignoreList: %s",CAIFiles::fullSrcFileName(id()).c_str());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// compile the input file
|
|
||||||
nlinfo("Compile %s => %s",srcFile.c_str(),objFile.c_str());
|
|
||||||
CAIDSActions::CurrentManager=id();
|
|
||||||
AI_SHARE::parsePrimFile(srcFile.c_str());
|
|
||||||
|
|
||||||
// make sure this file isn't in the ignore list (if the compiler found nothing interesting it will have been added)
|
|
||||||
varPtr=IService::getInstance()->ConfigFile.getVarPtr(std::string("IgnorePrimitives"));
|
|
||||||
for (uint i=0;i<varPtr->size();++i)
|
|
||||||
if (CAIFiles::srcName(id())==CFile::getFilenameWithoutExtension(varPtr->asString(i)))
|
|
||||||
{
|
|
||||||
nlinfo("- Skipping file as it has just been added to .cfg ignoreList: %s",CAIFiles::fullSrcFileName(id()).c_str());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// write the output file
|
|
||||||
CAIFiles::writeObjFile(id());
|
|
||||||
|
|
||||||
// write the binary output file (for debugging only)
|
|
||||||
NLMISC::COFile file;
|
|
||||||
if (file.open(objFile+"_out"))
|
|
||||||
{
|
|
||||||
std::string s;
|
|
||||||
MgrDfnRootNode.serialToString(s);
|
|
||||||
file.serial(s);
|
|
||||||
file.close();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
nlwarning("CAIManager::compile(): Failed to open the output file: %s",(objFile+"_out").c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
// delete the object files (but not the save files)
|
|
||||||
void CAIManager::clean()
|
|
||||||
{
|
|
||||||
CAIFiles::clean(id());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//-------------
|
|
||||||
// a few basic actions (relating to assignment to & execution by an ai service)
|
|
||||||
|
|
||||||
// open the manager on an unspecified service
|
|
||||||
// (may be queued until a service is available)
|
|
||||||
void CAIManager::open()
|
|
||||||
{
|
|
||||||
CAIService::openMgr(id());
|
|
||||||
}
|
|
||||||
|
|
||||||
// assign manager to a specified service and begin execution
|
|
||||||
void CAIManager::assign(NLNET::TServiceId serviceId)
|
|
||||||
{
|
|
||||||
// make sure that the manager isn't assigned to a service already
|
|
||||||
if (isAssigned())
|
|
||||||
{
|
|
||||||
nlwarning("Cannot assign manager %04d (%s) to service %d as already assigned to %d",
|
|
||||||
id(), name().c_str(), serviceId.get(), _service.get());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// flag me as assigned
|
|
||||||
_isAssigned=true;
|
|
||||||
_service=serviceId;
|
|
||||||
|
|
||||||
// transfer control to the service's assignMgr() method
|
|
||||||
CAIService *service=CAIService::getServiceById(serviceId);
|
|
||||||
if (service!=NULL)
|
|
||||||
service->assignMgr(id());
|
|
||||||
}
|
|
||||||
|
|
||||||
// stop execution on the current service and assign to a new service
|
|
||||||
void CAIManager::reassign(NLNET::TServiceId serviceId)
|
|
||||||
{
|
|
||||||
CAIService *service=CAIService::getServiceById(_service);
|
|
||||||
if (service!=NULL)
|
|
||||||
service->reassignMgr(id(),serviceId);
|
|
||||||
}
|
|
||||||
|
|
||||||
// stop execution of a manager
|
|
||||||
void CAIManager::close()
|
|
||||||
{
|
|
||||||
// make sure that the manager isn't assigned to a service already
|
|
||||||
if (!isAssigned())
|
|
||||||
{
|
|
||||||
nlwarning("Cannot unassign manager %04d (%s) as it is already unassigned", id(), name().c_str());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if the service is running then transfer control to the service singleton's closeMgr() method
|
|
||||||
if (isUp())
|
|
||||||
{
|
|
||||||
CAIService::closeMgr(id());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// flag me as unassigned
|
|
||||||
_isAssigned=false;
|
|
||||||
_isOpen=false;
|
|
||||||
_service.set(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//-------------
|
|
||||||
// a few basic actions (miscelaneous)
|
|
||||||
|
|
||||||
// display information about the state of the manager
|
|
||||||
void CAIManager::display() const
|
|
||||||
{
|
|
||||||
if (isAssigned())
|
|
||||||
nlinfo("AI Manager %04d: %s: %s ON SERVICE %d (%s)", id(), _name.c_str(),
|
|
||||||
isUp()? "UP AND RUNNING":
|
|
||||||
/* else */ "ASSIGNED TO BUT NOT YET UP",
|
|
||||||
_service.get(),
|
|
||||||
isOpen()? "auto-assigned":
|
|
||||||
/* else */ "manualy assigned"
|
|
||||||
);
|
|
||||||
else
|
|
||||||
nlinfo("AI Manager %04d: %s: %s", id(), _name.c_str(),
|
|
||||||
isOpen()? "OPEN - AWAITING ASSIGNMENT":
|
|
||||||
!objExists()? "NOT OPEN - OBJECT FILE NOT FOUND":
|
|
||||||
needCompile()? "NOT OPEN - OBJECT FILE OLDER THAN SOURCE":
|
|
||||||
/* else */ "NOT OPEN - OBJECT FILE IS UP TO DATE"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//-------------
|
|
||||||
// a few write accessors (miscelaneous)
|
|
||||||
|
|
||||||
// set the name assigned to manager
|
|
||||||
// if no name previously assigned then reset all manager properties
|
|
||||||
// if a name already exists and does not match new name then do nohing and return false
|
|
||||||
bool CAIManager::set(const std::string &name)
|
|
||||||
{
|
|
||||||
// if we already have a name associated with this slot then simply check that it matches the new name
|
|
||||||
if (!_name.empty())
|
|
||||||
return (_name==name);
|
|
||||||
_reset();
|
|
||||||
_name=name;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// set the state of the needCompile flag
|
|
||||||
void CAIManager::setNeedCompile(bool val)
|
|
||||||
{
|
|
||||||
_needCompile=val;
|
|
||||||
}
|
|
||||||
|
|
||||||
// set the state of the objFileExists flag
|
|
||||||
void CAIManager::setObjFileExists(bool val)
|
|
||||||
{
|
|
||||||
_objExists=val;
|
|
||||||
}
|
|
||||||
|
|
||||||
// set the state of the isUp flag
|
|
||||||
void CAIManager::setIsUp(bool val)
|
|
||||||
{
|
|
||||||
_isUp=val;
|
|
||||||
}
|
|
||||||
|
|
||||||
// set the state of the isOpen flag
|
|
||||||
void CAIManager::setIsOpen(bool val)
|
|
||||||
{
|
|
||||||
_isOpen=val;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------
|
|
||||||
// INSTANTIATED CLASS: Private methods
|
|
||||||
|
|
||||||
// default constructor - may only be instantiated by the singleton
|
|
||||||
CAIManager::CAIManager(): MgrDfnRootNode(std::string())
|
|
||||||
{
|
|
||||||
// manager id - make sure that the managers are all in the one static array
|
|
||||||
// note that id is calaulated from the array address and the addess of 'this'
|
|
||||||
nlassert(uint(id())<maxManagers());
|
|
||||||
// reset the rest of the properties
|
|
||||||
_reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CAIManager::_reset()
|
|
||||||
{
|
|
||||||
_name.clear();
|
|
||||||
_weightCPU = 0;
|
|
||||||
_weightRAM = 0;
|
|
||||||
_needCompile = false;
|
|
||||||
_objExists = false;
|
|
||||||
_isOpen = false;
|
|
||||||
_isAssigned = false;
|
|
||||||
_isUp = false;
|
|
||||||
_service.set(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//===================================================================
|
|
||||||
// *** END OF THE INSTANTIATED CLASS *** START OF THE SINGLETON ***
|
|
||||||
//===================================================================
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------
|
|
||||||
// SINGLETON: Data
|
|
||||||
|
|
||||||
CAIManager CAIManager::_managers[RYAI_AI_MANAGER_MAX_MANAGERS];
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------
|
|
||||||
// SINGLETON: Public methods
|
|
||||||
|
|
||||||
// get the number of allocated managers
|
|
||||||
uint CAIManager::numManagers()
|
|
||||||
{
|
|
||||||
uint count=0;
|
|
||||||
for (uint i=0;i<maxManagers();i++)
|
|
||||||
if (!_managers[i]._name.empty())
|
|
||||||
count++;
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
|
|
||||||
// get a pointer to the manager with given handle (0..maxManagers-1)
|
|
||||||
CAIManager *CAIManager::getManagerById(sint id)
|
|
||||||
{
|
|
||||||
if (uint(id)>=maxManagers())
|
|
||||||
{
|
|
||||||
nlwarning("CAIManager::getManagerById(id): id %d not in range 0..%d",id,maxManagers()-1);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return &(_managers[id]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// get a pointer to the manager with given index (0..numManagers-1)
|
|
||||||
CAIManager *CAIManager::getManagerByIdx(uint idx)
|
|
||||||
{
|
|
||||||
uint count=0;
|
|
||||||
for (uint i=0;i<maxManagers();i++)
|
|
||||||
if (!_managers[i]._name.empty())
|
|
||||||
{
|
|
||||||
if (idx==count)
|
|
||||||
return &(_managers[i]);
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
nlwarning("CAIManager::getManagerByIdx(idx): idx (%d)>=numManagers (%d)",idx,count);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// get the handle for the manager of given name and optionally create a new
|
|
||||||
// handle if none found - return -1 if none found or no free slots
|
|
||||||
int CAIManager::nameToId(std::string name, bool assignNewIfNotFound)
|
|
||||||
{
|
|
||||||
// see if the name is a numeric version of an id
|
|
||||||
uint val=atoi(name.c_str());
|
|
||||||
if (!name.empty() && name.size()<=4 &&
|
|
||||||
( (val>0 && val<maxManagers()) ||
|
|
||||||
(val==0 && name==std::string("0000"+4-name.size())) ) )
|
|
||||||
return val;
|
|
||||||
|
|
||||||
// see if the name is already assigned to one of the _managers
|
|
||||||
for (uint i=0;i<maxManagers();i++)
|
|
||||||
if (_managers[i]._name==name)
|
|
||||||
return i;
|
|
||||||
|
|
||||||
// the name's not been found so if assignNewIfNotFound then look for a free slot
|
|
||||||
if (assignNewIfNotFound)
|
|
||||||
{
|
|
||||||
for (uint i=0;i<maxManagers();i++)
|
|
||||||
if (_managers[i]._name.empty())
|
|
||||||
{
|
|
||||||
_managers[i].set(name);
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
nlwarning("Failed to allocate a manager for name '%s' (all %d managers are already allocated)",name.c_str(),maxManagers());
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// clear file name assignments for managers that aren't currently running on
|
|
||||||
// ai services
|
|
||||||
void CAIManager::liberateUnassignedManagers()
|
|
||||||
{
|
|
||||||
for (uint i=0;i<maxManagers();i++)
|
|
||||||
if (!_managers[i]._isOpen && !_managers[i]._isAssigned)
|
|
||||||
_managers[i]._reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//===================================================================
|
|
@ -1,331 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef RYAI_AI_MANAGER_H
|
|
||||||
#define RYAI_AI_MANAGER_H
|
|
||||||
|
|
||||||
#define RYAI_AI_MANAGER_MAX_MANAGERS 1024
|
|
||||||
|
|
||||||
#include "nel/misc/types_nl.h"
|
|
||||||
#include "nel/misc/stream.h"
|
|
||||||
#include "nel/net/unified_network.h"
|
|
||||||
#include "ai_share/ai_actions.h"
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
This class defines both the singleton that manages the managers and the
|
|
||||||
class type of the managers themselves. The singleton interface can be found
|
|
||||||
at the end of the class
|
|
||||||
|
|
||||||
---------------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
class CAIManager
|
|
||||||
{
|
|
||||||
|
|
||||||
//===================================================================
|
|
||||||
// *** SUB-CLASSES FOR MGR DEFINITON DATA TREE ***
|
|
||||||
//===================================================================
|
|
||||||
|
|
||||||
public:
|
|
||||||
struct SMgrDfnElm
|
|
||||||
{
|
|
||||||
SMgrDfnElm() {}
|
|
||||||
SMgrDfnElm(uint64 action,const std::vector <CAIActions::CArg> &args): Action(action)
|
|
||||||
{
|
|
||||||
Args.resize(args.size());
|
|
||||||
for (uint i=0;i<args.size();++i)
|
|
||||||
Args[i]=args[i];
|
|
||||||
}
|
|
||||||
SMgrDfnElm(const SMgrDfnElm &other): Action(other.Action), Args(other.Args) {}
|
|
||||||
|
|
||||||
void serial(NLMISC::IStream &f)
|
|
||||||
{
|
|
||||||
//f.xmlPushBegin("CMD");
|
|
||||||
std::string s=getAction();
|
|
||||||
//f.xmlSetAttrib("Action");
|
|
||||||
f.serial(s);
|
|
||||||
setAction(s);
|
|
||||||
//f.xmlPushEnd();
|
|
||||||
f.serialCont(Args);
|
|
||||||
//f.xmlPop();
|
|
||||||
}
|
|
||||||
|
|
||||||
void serialToString(std::string &s) throw()
|
|
||||||
{
|
|
||||||
s+=char(Args.size());
|
|
||||||
s+=NLMISC::toString("%*s",sizeof(uint64),"");
|
|
||||||
((uint64*)&(s[s.size()]))[-1]=Action;
|
|
||||||
for (uint i=0;i<Args.size();++i)
|
|
||||||
Args[i].serialToString(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string getAction()
|
|
||||||
{
|
|
||||||
std::string s;
|
|
||||||
for (uint i=0;i<8 && ((char *)&Action)[i];++i) s+=((char *)&Action)[i];
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setAction(std::string action)
|
|
||||||
{
|
|
||||||
Action=0;
|
|
||||||
for (uint i=0;i<8 && action[i];++i) ((char *)&Action)[i]=action[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64 Action;
|
|
||||||
std::vector <CAIActions::CArg> Args;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct SMgrDfnNode : public NLMISC::CRefCount
|
|
||||||
{
|
|
||||||
SMgrDfnNode() {}
|
|
||||||
SMgrDfnNode(const std::string &name)
|
|
||||||
: Name(name)
|
|
||||||
{}
|
|
||||||
SMgrDfnNode(const SMgrDfnNode &other)
|
|
||||||
: Name(other.Name),
|
|
||||||
Data(other.Data),
|
|
||||||
Child(other.Child)
|
|
||||||
{}
|
|
||||||
|
|
||||||
void serial(NLMISC::IStream &f)
|
|
||||||
{
|
|
||||||
f.serial(Name);
|
|
||||||
f.serialCont(Data);
|
|
||||||
|
|
||||||
uint32 count;
|
|
||||||
f.serial(count);
|
|
||||||
Child.resize(count);
|
|
||||||
if (f.isReading())
|
|
||||||
{
|
|
||||||
for (uint i=0; i<count; ++i)
|
|
||||||
{
|
|
||||||
Child[i] = new SMgrDfnNode;
|
|
||||||
f.serial(*Child[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (uint i=0; i<count; ++i)
|
|
||||||
{
|
|
||||||
f.serial(*Child[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void serialToString(std::string &s) throw()
|
|
||||||
{
|
|
||||||
uint i;
|
|
||||||
for (i=0;i<Data.size();++i)
|
|
||||||
Data[i].serialToString(s);
|
|
||||||
for (i=0;i<Child.size();++i)
|
|
||||||
Child[i]->serialToString(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string Name;
|
|
||||||
std::vector <SMgrDfnElm> Data;
|
|
||||||
std::vector <NLMISC::CSmartPtr<SMgrDfnNode> > Child;
|
|
||||||
|
|
||||||
bool Visited; // used to identify modified nodes in file re-parse operations
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
//===================================================================
|
|
||||||
// *** START OF THE INSTANTIATED CLASS ***
|
|
||||||
//===================================================================
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
//---------------------------------------------------
|
|
||||||
// INSTANTIATED CLASS: Public methods
|
|
||||||
|
|
||||||
//-------------
|
|
||||||
// a few read accessors (static properties)
|
|
||||||
|
|
||||||
// the manager id (0..255)
|
|
||||||
sint id() const;
|
|
||||||
// the manager name .. ie the source file name minus extension
|
|
||||||
const std::string &name() const;
|
|
||||||
|
|
||||||
// the CPU load rating of the manager for auto-load ballancing purposes
|
|
||||||
uint weightCPU() const;
|
|
||||||
// the RAM load rating of the manager for auto-load ballancing purposes
|
|
||||||
uint weightRAM() const;
|
|
||||||
|
|
||||||
|
|
||||||
//-------------
|
|
||||||
// a few read accessors (state of the files on disk)
|
|
||||||
|
|
||||||
// indicates whether newer source files than object files have been located
|
|
||||||
bool needCompile() const;
|
|
||||||
// indicate whether an object file has been located in the object directory
|
|
||||||
bool objExists() const;
|
|
||||||
|
|
||||||
|
|
||||||
//-------------
|
|
||||||
// a few read accessors (relating to assignment to & execution by an ai service)
|
|
||||||
|
|
||||||
// has the manager been opened (it may still be waiting to be assigned)
|
|
||||||
bool isOpen() const;
|
|
||||||
// has the manager been assigned to a service
|
|
||||||
bool isAssigned() const;
|
|
||||||
// is the manager up and running on the assigned service
|
|
||||||
bool isUp() const;
|
|
||||||
|
|
||||||
// the id of the service to which the manager is assigned
|
|
||||||
NLNET::TServiceId serviceId() const;
|
|
||||||
|
|
||||||
|
|
||||||
//-------------
|
|
||||||
// a few basic actions (relating to disk files)
|
|
||||||
|
|
||||||
// compile the source files to generate new object files
|
|
||||||
void compile();
|
|
||||||
// delete the object files (but not the save files)
|
|
||||||
void clean();
|
|
||||||
|
|
||||||
|
|
||||||
//-------------
|
|
||||||
// a few basic actions (relating to assignment to & execution by an ai service)
|
|
||||||
|
|
||||||
// open the manager on an unspecified service
|
|
||||||
// (may be queued until a service is available)
|
|
||||||
void open();
|
|
||||||
// assign manager to a specified service and begin execution
|
|
||||||
void assign(NLNET::TServiceId serviceId);
|
|
||||||
// stop execution on the current service and assign to a new service
|
|
||||||
void reassign(NLNET::TServiceId serviceId);
|
|
||||||
// stop execution of a manager
|
|
||||||
void close();
|
|
||||||
|
|
||||||
|
|
||||||
//-------------
|
|
||||||
// a few basic actions (miscelaneous)
|
|
||||||
|
|
||||||
// display information about the state of the manager
|
|
||||||
void display() const;
|
|
||||||
|
|
||||||
|
|
||||||
//-------------
|
|
||||||
// a few write accessors (miscelaneous)
|
|
||||||
|
|
||||||
// set the name assigned to manager
|
|
||||||
// if no name previously assigned then reset all manager properties
|
|
||||||
// if a name already exists and does not match new name then do nohing and return false
|
|
||||||
bool set(const std::string &name);
|
|
||||||
// set the state of the needCompile flag
|
|
||||||
void setNeedCompile(bool val);
|
|
||||||
// set the state of the objFileExists flag
|
|
||||||
void setObjFileExists(bool val);
|
|
||||||
// set the state of the isUp flag
|
|
||||||
void setIsUp(bool val);
|
|
||||||
// set the state of the isOpen flag
|
|
||||||
void setIsOpen(bool val);
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
//---------------------------------------------------
|
|
||||||
// INSTANTIATED CLASS: Private methods
|
|
||||||
|
|
||||||
// default constructor - may only be instantiated by the singleton
|
|
||||||
CAIManager();
|
|
||||||
// reset properties to initial values
|
|
||||||
void _reset();
|
|
||||||
|
|
||||||
private:
|
|
||||||
//---------------------------------------------------
|
|
||||||
// INSTANTIATED CLASS: Private data
|
|
||||||
|
|
||||||
// manager name (file name of source file minus extension)
|
|
||||||
std::string _name;
|
|
||||||
// cpu rating for load ballancing
|
|
||||||
uint _weightCPU;
|
|
||||||
// ram rating for load ballancing
|
|
||||||
uint _weightRAM;
|
|
||||||
// do we need to recompile
|
|
||||||
bool _needCompile;
|
|
||||||
// does an object file exist
|
|
||||||
bool _objExists;
|
|
||||||
// is the manager open (at least queued in CAIService singleton)
|
|
||||||
bool _isOpen;
|
|
||||||
// is manager assigned to a service
|
|
||||||
bool _isAssigned;
|
|
||||||
// is manager up and running on the assigned service
|
|
||||||
bool _isUp;
|
|
||||||
// id of the service manager is assigned to
|
|
||||||
NLNET::TServiceId _service;
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
//---------------------------------------------------
|
|
||||||
// INSTANTIATED CLASS: Public data
|
|
||||||
|
|
||||||
// the tree of definition data read from (and written to) data files
|
|
||||||
SMgrDfnNode MgrDfnRootNode;
|
|
||||||
|
|
||||||
|
|
||||||
//===================================================================
|
|
||||||
// *** END OF THE INSTANTIATED CLASS *** START OF THE SINGLETON ***
|
|
||||||
//===================================================================
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
//---------------------------------------------------
|
|
||||||
// SINGLETON: Public methods
|
|
||||||
|
|
||||||
// get the number of valid handles (ie the maximum number of managers allowed)
|
|
||||||
static uint maxManagers() { return RYAI_AI_MANAGER_MAX_MANAGERS; }
|
|
||||||
|
|
||||||
// get the number of allocated managers
|
|
||||||
static uint numManagers();
|
|
||||||
|
|
||||||
// get a pointer to the manager with given handle (0..maxManagers-1)
|
|
||||||
static CAIManager *getManagerById(sint id);
|
|
||||||
|
|
||||||
// get a pointer to the manager with given index (0..numManagers-1)
|
|
||||||
static CAIManager *getManagerByIdx(uint idx);
|
|
||||||
|
|
||||||
// get the handle for the manager of given name and optionally create a new
|
|
||||||
// handle if none found - return -1 if none found or no free slots
|
|
||||||
static sint nameToId(std::string name, bool assignNewIfNotFound=false);
|
|
||||||
|
|
||||||
// clear file name assignments for managers that aren't currently running on
|
|
||||||
// ai services
|
|
||||||
static void liberateUnassignedManagers();
|
|
||||||
|
|
||||||
private:
|
|
||||||
//---------------------------------------------------
|
|
||||||
// SINGLETON: Private methods
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
//---------------------------------------------------
|
|
||||||
// SINGLETON: Private data
|
|
||||||
static CAIManager _managers[RYAI_AI_MANAGER_MAX_MANAGERS];
|
|
||||||
|
|
||||||
|
|
||||||
//===================================================================
|
|
||||||
// *** END OF THE SINGLETON ***
|
|
||||||
//===================================================================
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,322 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//===================================================================
|
|
||||||
|
|
||||||
/*
|
|
||||||
***
|
|
||||||
when a service goes down I must remember that the managers are no longer running
|
|
||||||
in the normal way I can try to bring them back up on the remaining services
|
|
||||||
|
|
||||||
***
|
|
||||||
when a service comes up and the rest of the services are over-loaded it would be
|
|
||||||
good to be able to load ballance (if loading is fast enough)
|
|
||||||
- tell new service to load static data and prepare to launch.
|
|
||||||
- wait for new service to say 'ready'
|
|
||||||
- tell old service to transfer to new service (ie: save to ram & transmit to new service)
|
|
||||||
- * old service must continue to forward packets to the new service to ensure smooth continuation
|
|
||||||
- old service tells me when he's down
|
|
||||||
- new service tells me when he's up
|
|
||||||
|
|
||||||
***
|
|
||||||
Need to deal with 'save's as well...
|
|
||||||
|
|
||||||
***
|
|
||||||
Need init() and release() in order to register message callbacks, etc?
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
// Some global variables
|
|
||||||
uint32 GlobalServicesUp=0;
|
|
||||||
NLMISC_VARIABLE(uint32, GlobalServicesUp, "ServicesUp");
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "nel/misc/debug.h"
|
|
||||||
|
|
||||||
#include "ai_manager.h"
|
|
||||||
#include "ai_service.h"
|
|
||||||
#include "ai_files.h"
|
|
||||||
#include "messages.h"
|
|
||||||
|
|
||||||
//===================================================================
|
|
||||||
|
|
||||||
//---------------------------------------------------
|
|
||||||
// INSTANTIATED CLASS: Public methods
|
|
||||||
|
|
||||||
// a few read accessors
|
|
||||||
NLNET::TServiceId CAIService::id() const
|
|
||||||
{
|
|
||||||
// compute the index of this AIService class instance in the array of
|
|
||||||
// CAIService (this is stored in the _services array)
|
|
||||||
return NLNET::TServiceId(this-_services);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CAIService::isUp() const
|
|
||||||
{
|
|
||||||
return _isUp;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
uint CAIService::powerCPU() const
|
|
||||||
{
|
|
||||||
return _powerCPU;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint CAIService::powerRAM() const
|
|
||||||
{
|
|
||||||
return _powerRAM;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// assign a given manager to this service (ie open and run it)
|
|
||||||
void CAIService::assignMgr(sint mgrId)
|
|
||||||
{
|
|
||||||
// get a pointer to the manager in question
|
|
||||||
CAIManager *m=CAIManager::getManagerById(mgrId);
|
|
||||||
if (m==NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// if this method has not been called by the manager's own method then ping pong
|
|
||||||
if (!m->isAssigned())
|
|
||||||
{
|
|
||||||
m->assign(id());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if the manager is assigned to a different service then bomb
|
|
||||||
if (m->serviceId()!=id())
|
|
||||||
{
|
|
||||||
nlwarning("Cannot assign manager %04d (%s) to service %d as it is already assigned to service %d",
|
|
||||||
mgrId, m->name().c_str(), id().get(), m->serviceId().get());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if the service is up then send it a message to launch the manager
|
|
||||||
if (isUp())
|
|
||||||
{
|
|
||||||
// std::string dataBuf
|
|
||||||
// dataBuf.resize(binFileSize(id()));
|
|
||||||
// FILE *f=fopen(binFileName(id()),"rb");
|
|
||||||
// if (f==NULL)
|
|
||||||
// {
|
|
||||||
// nlinfo("Failed to load action list file: %s (try 'aiMake')",binFileName(id()));
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// if (fread(dataBuf.buffer(),1,binFileSize(id()),f) != binFileSize(id()))
|
|
||||||
// {
|
|
||||||
// nlinfo("Read error in binary file: %s",binFileName(id()));
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// fclose(f);
|
|
||||||
// CMsgAIUploadActions(id(),dataBuf).send();
|
|
||||||
// CMsgAIOpenMgrs(mgrId,m->name()).send(id());
|
|
||||||
m->setIsUp(true);
|
|
||||||
|
|
||||||
// return true;
|
|
||||||
}
|
|
||||||
// return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// unassign a manager currently running on this service (ie close it)
|
|
||||||
void CAIService::unassignMgr(sint mgrId)
|
|
||||||
{
|
|
||||||
// if the manager isn't assigned to this service then bomb
|
|
||||||
if (CAIManager::getManagerById(mgrId)->serviceId()!=id())
|
|
||||||
{
|
|
||||||
nlwarning("Cannot stop manager %04d (%s) on service %d as it is assigned to service %d",
|
|
||||||
mgrId, CAIManager::getManagerById(mgrId)->name().c_str(), id().get(), CAIManager::getManagerById(mgrId)->serviceId().get());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// transfer control to the singleton to finish the work
|
|
||||||
closeMgr(mgrId);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// reassign a manager currently assigned to this service to another service
|
|
||||||
void CAIService::reassignMgr(sint mgrId, NLNET::TServiceId serviceId)
|
|
||||||
{
|
|
||||||
// get a pointerto the service
|
|
||||||
CAIService *s=getServiceById(serviceId);
|
|
||||||
if (s==NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// this is a very simple implementation of control transfer... should be revised later
|
|
||||||
unassignMgr(mgrId);
|
|
||||||
s->assignMgr(mgrId);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------
|
|
||||||
// INSTANTIATED CLASS: Private methods
|
|
||||||
|
|
||||||
CAIService::CAIService()
|
|
||||||
{
|
|
||||||
// if the following assert fails it's because a CAIService object has
|
|
||||||
// been instantiated outside of the singleton's array
|
|
||||||
nlassert(id().get() < maxServices());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//===================================================================
|
|
||||||
// *** END OF THE INSTANTIATED CLASS *** START OF THE SINGLETON ***
|
|
||||||
//===================================================================
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------
|
|
||||||
// SINGLETON: Data
|
|
||||||
|
|
||||||
class CAIService CAIService::_services[RYAI_AI_SERVICE_MAX_SERVICES];
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------
|
|
||||||
// SINGLETON: Public methods
|
|
||||||
|
|
||||||
// get the number of allocated managers
|
|
||||||
uint CAIService::numServices()
|
|
||||||
{
|
|
||||||
uint count=0;
|
|
||||||
for (uint i=0;i<maxServices();i++)
|
|
||||||
if (_services[i].isUp())
|
|
||||||
count++;
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// get a pointer to the manager with given handle (0..maxManagers-1)
|
|
||||||
CAIService *CAIService::getServiceById(NLNET::TServiceId id)
|
|
||||||
{
|
|
||||||
if (id.get() >= maxServices())
|
|
||||||
{
|
|
||||||
nlwarning("CAIService::getServiceById(id): id %d not in range 0..%d",id.get(),maxServices()-1);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return &(_services[NLNET::TServiceId8(id).get()]);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// get a pointer to the manager with given index (0..numManagers-1)
|
|
||||||
CAIService *CAIService::getServiceByIdx(uint idx)
|
|
||||||
{
|
|
||||||
uint count=0;
|
|
||||||
for (uint i=0;i<maxServices();i++)
|
|
||||||
if (_services[i].isUp())
|
|
||||||
{
|
|
||||||
if (idx==count)
|
|
||||||
return &(_services[i]);
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
nlwarning("CAIService::getServiceByIdx(idx): idx (%d)>=maxServices (%d)",idx,count);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// select a service to assign the manager to and assign it
|
|
||||||
// if no services are available then the manager is queued until one
|
|
||||||
// becomes available
|
|
||||||
// managers opened via this interface are queued back up and re-launched
|
|
||||||
// if their service goes down
|
|
||||||
void CAIService::openMgr(sint mgrId)
|
|
||||||
{
|
|
||||||
// get a pointer to the manager in question
|
|
||||||
CAIManager *m=CAIManager::getManagerById(mgrId);
|
|
||||||
if (m==NULL)
|
|
||||||
return;
|
|
||||||
m->setIsOpen(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// close a manager (on whichever service its running)
|
|
||||||
void CAIService::closeMgr(sint mgrId)
|
|
||||||
{
|
|
||||||
// get a pointer to the manager in question
|
|
||||||
CAIManager *m=CAIManager::getManagerById(mgrId);
|
|
||||||
if (m==NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// if the manager is flagged as up and running on a service then shut it down
|
|
||||||
if (m->isUp())
|
|
||||||
{
|
|
||||||
CAIService *s=getServiceById(m->serviceId());
|
|
||||||
if (s!=NULL && s->isUp())
|
|
||||||
{
|
|
||||||
// send a message to the service to stop the manager
|
|
||||||
CMsgAICloseMgrs(mgrId).send(m->serviceId());
|
|
||||||
}
|
|
||||||
// clear the manager's isUp() flag
|
|
||||||
m->setIsUp(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// if the manager is assigned to a service then transfer control to the manager's close()
|
|
||||||
if (m->isAssigned())
|
|
||||||
m->close();
|
|
||||||
}
|
|
||||||
|
|
||||||
// update routine called by service_main update every net loop
|
|
||||||
void CAIService::update()
|
|
||||||
{
|
|
||||||
#define IN_TRANSIT_PACKET_LIMIT 1
|
|
||||||
|
|
||||||
for (uint i=0;i<maxServices();i++)
|
|
||||||
{
|
|
||||||
CAIService &s=_services[i];
|
|
||||||
if (s.isUp())
|
|
||||||
{
|
|
||||||
// see whether we have enough spare capacity to start sending data about a new manager
|
|
||||||
// if so look through the managers for any that are awaiting assignment
|
|
||||||
if (s._dataSentCount+s._dataToSend.size()-s._dataAckCount<IN_TRANSIT_PACKET_LIMIT)
|
|
||||||
{
|
|
||||||
// look for the heaviest manager that doesn't blow my quotas
|
|
||||||
uint best=~0u;
|
|
||||||
uint bestScore=0;
|
|
||||||
for (uint j=0;j<CAIManager::maxManagers();j++)
|
|
||||||
{
|
|
||||||
CAIManager *m=CAIManager::getManagerById(j);
|
|
||||||
if (m->isOpen() && !m->isAssigned())
|
|
||||||
if (m->weightRAM()<=s._unusedPowerRAM && m->weightCPU()<=s._unusedPowerCPU)
|
|
||||||
if (m->weightRAM()+m->weightCPU()/2>=bestScore)
|
|
||||||
{
|
|
||||||
best=j;
|
|
||||||
bestScore=m->weightRAM()+m->weightCPU()/2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// if we found a manager then go ahead and assign it
|
|
||||||
if (best!=~0u)
|
|
||||||
s.assignMgr(best);
|
|
||||||
}
|
|
||||||
|
|
||||||
// if we have data waiting to be sent then send it
|
|
||||||
while (!s._dataToSend.empty() && s._dataSentCount-s._dataAckCount<IN_TRANSIT_PACKET_LIMIT)
|
|
||||||
{
|
|
||||||
NLNET::CUnifiedNetwork::getInstance()->send( s.id(), *(s._dataToSend.begin()) );
|
|
||||||
s._dataToSend.pop_front();
|
|
||||||
s._dataSentCount++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#undef IN_TRANSIT_PACKET_LIMIT
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//===================================================================
|
|
@ -1,148 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef RYAI_AI_SERVICE_H
|
|
||||||
#define RYAI_AI_SERVICE_H
|
|
||||||
|
|
||||||
#define RYAI_AI_SERVICE_MAX_SERVICES 256
|
|
||||||
|
|
||||||
|
|
||||||
#include "nel/misc/types_nl.h"
|
|
||||||
#include "nel/net/message.h"
|
|
||||||
#include "nel/net/unified_network.h"
|
|
||||||
|
|
||||||
#include <list>
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
This class defines both the singleton that manages the ai services and the
|
|
||||||
class type of the ai services themselves. The singleton interface can be found
|
|
||||||
at the end of the class
|
|
||||||
|
|
||||||
---------------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
class CAIService
|
|
||||||
{
|
|
||||||
|
|
||||||
//===================================================================
|
|
||||||
// *** START OF THE INSTANTIATED CLASS ***
|
|
||||||
//===================================================================
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
//---------------------------------------------------
|
|
||||||
// INSTANTIATED CLASS: Public methods
|
|
||||||
|
|
||||||
// a few read accessors
|
|
||||||
NLNET::TServiceId id() const;
|
|
||||||
bool isUp() const;
|
|
||||||
|
|
||||||
uint powerCPU() const;
|
|
||||||
uint powerRAM() const;
|
|
||||||
|
|
||||||
// assign a given manager to this service (ie open and run it)
|
|
||||||
void assignMgr(sint mgrId);
|
|
||||||
|
|
||||||
// unassign a manager currently running on this service (ie close it)
|
|
||||||
void unassignMgr(sint mgrId);
|
|
||||||
|
|
||||||
// reassign a manager currently assigned to this service to another service
|
|
||||||
void reassignMgr(sint mgrId, NLNET::TServiceId serviceId);
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
//---------------------------------------------------
|
|
||||||
// INSTANTIATED CLASS: Private methods
|
|
||||||
|
|
||||||
CAIService(); // may only be instantiated by the singleton
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
//---------------------------------------------------
|
|
||||||
// INSTANTIATED CLASS: Private data
|
|
||||||
|
|
||||||
bool _isUp; // flag says the service is up
|
|
||||||
|
|
||||||
uint _powerCPU; // maximum CPU weight allowed on service
|
|
||||||
uint _powerRAM; // maximum RAM weight allowed on service
|
|
||||||
|
|
||||||
uint _unusedPowerCPU; // remaining CPU capacity (after counting weight of running managers)
|
|
||||||
uint _unusedPowerRAM; // remaining RAM capacity (after counting weight of running managers)
|
|
||||||
|
|
||||||
uint _dataSentCount; // number of data packets sent to service
|
|
||||||
uint _dataAckCount; // number of data acknowledges received from service
|
|
||||||
|
|
||||||
// vector of buffers of data that are waiting to be sent to the service
|
|
||||||
std::list<NLNET::CMessage> _dataToSend;
|
|
||||||
|
|
||||||
//===================================================================
|
|
||||||
// *** END OF THE INSTANTIATED CLASS *** START OF THE SINGLETON ***
|
|
||||||
//===================================================================
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
//---------------------------------------------------
|
|
||||||
// SINGLETON: Public methods
|
|
||||||
|
|
||||||
// get the number of valid handles (ie the maximum number of managers allowed)
|
|
||||||
static uint maxServices() { return RYAI_AI_SERVICE_MAX_SERVICES; }
|
|
||||||
|
|
||||||
// get the number of allocated managers
|
|
||||||
static uint numServices();
|
|
||||||
|
|
||||||
// get a pointer to the manager with given handle (0..maxManagers-1)
|
|
||||||
static CAIService *getServiceById(NLNET::TServiceId id);
|
|
||||||
|
|
||||||
// get a pointer to the manager with given index (0..numManagers-1)
|
|
||||||
static CAIService *getServiceByIdx(uint idx);
|
|
||||||
|
|
||||||
// select a service to assign the manager to and assign it
|
|
||||||
// if no services are available then the manager is queued until one
|
|
||||||
// becomes available
|
|
||||||
// managers opened via this interface are queued back up and re-launched
|
|
||||||
// if their service goes down
|
|
||||||
static void openMgr(sint mgrId);
|
|
||||||
|
|
||||||
// close a manager (on whichever service its running)
|
|
||||||
static void closeMgr(sint mgrId);
|
|
||||||
|
|
||||||
// update routine called by service_main update every net loop
|
|
||||||
static void update();
|
|
||||||
|
|
||||||
private:
|
|
||||||
//---------------------------------------------------
|
|
||||||
// SINGLETON: Private methods
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
//---------------------------------------------------
|
|
||||||
// SINGLETON: Private data
|
|
||||||
static class CAIService _services[RYAI_AI_SERVICE_MAX_SERVICES];
|
|
||||||
|
|
||||||
|
|
||||||
//===================================================================
|
|
||||||
// *** END OF THE SINGLETON ***
|
|
||||||
//===================================================================
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,261 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#include "nel/misc/command.h"
|
|
||||||
#include "nel/misc/debug.h"
|
|
||||||
#include "nel/misc/config_file.h"
|
|
||||||
#include "nel/misc/path.h"
|
|
||||||
#include "nel/net/service.h"
|
|
||||||
#include "aids_actions.h"
|
|
||||||
|
|
||||||
using namespace NLMISC;
|
|
||||||
using namespace NLNET;
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
// Stuff for debug message logging
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
static bool verboseLog=false;
|
|
||||||
#define TAB toString("%*s",CurrentMgrDfnNodes.size()*4,"").c_str()
|
|
||||||
#define TAB1 toString("%*s",CurrentMgrDfnNodes.size()*4-4,"").c_str()
|
|
||||||
#define LOG if (!verboseLog) {} else nlinfo
|
|
||||||
|
|
||||||
NLMISC_COMMAND(verboseAIDSActionLog,"Turn on or off or check the state of verbose AIDSAction parser logging","")
|
|
||||||
{
|
|
||||||
if(args.size()>1)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if(args.size()==1)
|
|
||||||
StrToBool (verboseLog, args[0]);
|
|
||||||
|
|
||||||
nlinfo("verboseAIDSActionLogging is %s",verboseLog?"ON":"OFF");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
// Singleton data instantiation
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
CAIDSActions *CAIDSActions::Instance=NULL;
|
|
||||||
uint CAIDSActions::CurrentManager=0;
|
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
// Local utility functions and variables
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
static uint BadParseDepth=0;
|
|
||||||
static CAIManager::SMgrDfnNode DefaultNode;
|
|
||||||
static std::vector<CAIManager::SMgrDfnNode *> CurrentMgrDfnNodes;
|
|
||||||
static bool FoundAIData=false;
|
|
||||||
static std::string FileName;
|
|
||||||
|
|
||||||
static void Prepare(CAIManager::SMgrDfnNode &node)
|
|
||||||
{
|
|
||||||
// recurse through children
|
|
||||||
for (uint i=0;i<node.Child.size();++i)
|
|
||||||
Prepare(*node.Child[i]);
|
|
||||||
|
|
||||||
// deal with self
|
|
||||||
node.Visited=false;
|
|
||||||
node.Data.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void Clean(CAIManager::SMgrDfnNode &node)
|
|
||||||
{
|
|
||||||
// recurse through children
|
|
||||||
for (uint i=0;i<node.Child.size();++i)
|
|
||||||
Clean(*node.Child[i]);
|
|
||||||
|
|
||||||
// deal with self
|
|
||||||
if (!node.Visited)
|
|
||||||
{
|
|
||||||
node.Child.clear();
|
|
||||||
node.Name.clear(); // clearing the name makes the slot re-usable next compile
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
// Public methods
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void CAIDSActions::openFile(const std::string &fileName)
|
|
||||||
{
|
|
||||||
LOG("Scanning file: %s",fileName.c_str());
|
|
||||||
|
|
||||||
// setup local vars
|
|
||||||
BadParseDepth=0;
|
|
||||||
DefaultNode.Child.clear();
|
|
||||||
DefaultNode.Data.clear();
|
|
||||||
CurrentMgrDfnNodes.clear();
|
|
||||||
FoundAIData=false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CAIDSActions::closeFile(const std::string &fileName)
|
|
||||||
{
|
|
||||||
// if the primitive file didn't contain anything interesting then add it to the ignore list
|
|
||||||
if (!FoundAIData)
|
|
||||||
{
|
|
||||||
nlinfo("No manager found in primitive file: %s - adding to ignore list",fileName.c_str());
|
|
||||||
|
|
||||||
// lookup the ignore files in the config file and copy into a temp vector
|
|
||||||
CConfigFile::CVar *varPtr=IService::getInstance()->ConfigFile.getVarPtr(std::string("IgnorePrimitives"));
|
|
||||||
std::vector<std::string> ignoreFiles;
|
|
||||||
for (uint i=0;i<varPtr->size();++i)
|
|
||||||
ignoreFiles.push_back(CFile::getFilenameWithoutExtension(varPtr->asString(i)));
|
|
||||||
|
|
||||||
//append this file to the vector and pass it back to the config file manager for storage
|
|
||||||
ignoreFiles.push_back(NLMISC::CFile::getFilenameWithoutExtension(fileName));
|
|
||||||
varPtr->setAsString(ignoreFiles);
|
|
||||||
IService::getInstance()->ConfigFile.save();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CAIDSActions::begin(const std::string &contextName)
|
|
||||||
{
|
|
||||||
LOG("%s{ // %s",TAB,contextName.c_str());
|
|
||||||
uint i;
|
|
||||||
|
|
||||||
// if we've encountered a parse problem just count levels of indentation
|
|
||||||
if (BadParseDepth)
|
|
||||||
{
|
|
||||||
++BadParseDepth;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if the CurrentMgrDfnNodes vector is empty then we must be parsing a new manager
|
|
||||||
if (CurrentMgrDfnNodes.empty())
|
|
||||||
{
|
|
||||||
nlinfo("- Parsing: %s",contextName.c_str());
|
|
||||||
|
|
||||||
// update variables used in this source file (AIDS_ACTIONS.CPP)
|
|
||||||
FoundAIData=true;
|
|
||||||
CurrentMgrDfnNodes.push_back(&(CAIManager::getManagerById(CurrentManager)->MgrDfnRootNode));
|
|
||||||
CurrentMgrDfnNodes[0]->Name=contextName;
|
|
||||||
|
|
||||||
// reset the 'visited' flags for the manager's data tree
|
|
||||||
Prepare(*CurrentMgrDfnNodes[0]);
|
|
||||||
CurrentMgrDfnNodes[0]->Visited=true;
|
|
||||||
|
|
||||||
// copy the default dfn nodes to the current node and add a 'set_slot' action
|
|
||||||
CAIManager::SMgrDfnNode *curNode=CurrentMgrDfnNodes[CurrentMgrDfnNodes.size()-1];
|
|
||||||
for (uint i=0;i<DefaultNode.Data.size();++i)
|
|
||||||
curNode->Data.push_back(DefaultNode.Data[i]);
|
|
||||||
// add a set_slot action with value uint slot id = CurrentManager
|
|
||||||
std::vector <CAIActions::CArg> args;
|
|
||||||
args.push_back(CAIActions::CArg(CurrentManager));
|
|
||||||
curNode->Data.push_back(CAIManager::SMgrDfnElm(*(uint64*)"SET_SLOT",args));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CAIManager::SMgrDfnNode *curNode=CurrentMgrDfnNodes[CurrentMgrDfnNodes.size()-1];
|
|
||||||
|
|
||||||
// try to find a node with the name matching contextName
|
|
||||||
// if there are a number of nodes with the same name then this code should work ok as
|
|
||||||
// it uses the 'visited' flags to avoid multi-use of same node slot
|
|
||||||
CAIManager::SMgrDfnNode *node=NULL;
|
|
||||||
for (i=0;i<curNode->Child.size();++i)
|
|
||||||
if ((curNode->Child[i]->Name.empty() || curNode->Child[i]->Name==contextName) && !curNode->Child[i]->Visited)
|
|
||||||
{
|
|
||||||
node=(curNode->Child[i]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if need be allocate a new data node
|
|
||||||
if (i==curNode->Child.size())
|
|
||||||
{
|
|
||||||
curNode->Child.push_back(new CAIManager::SMgrDfnNode(contextName));
|
|
||||||
node=curNode->Child[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
// add a set_slot action with value uint slot id = i
|
|
||||||
std::vector <CAIActions::CArg> args;
|
|
||||||
args.push_back(CAIActions::CArg(i));
|
|
||||||
curNode->Child[i]->Data.push_back(CAIManager::SMgrDfnElm(*(uint64*)"SET_SLOT",args));
|
|
||||||
|
|
||||||
// update variables used in this source file (AIDS_ACTIONS.CPP)
|
|
||||||
CurrentMgrDfnNodes.push_back(node);
|
|
||||||
node->Visited=true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CAIDSActions::end(const std::string &contextName)
|
|
||||||
{
|
|
||||||
LOG("%s} // %s",TAB1,contextName.c_str());
|
|
||||||
|
|
||||||
// if we've encountered a parse problem just count levels of indentation
|
|
||||||
if (BadParseDepth)
|
|
||||||
{
|
|
||||||
--BadParseDepth;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// make sure the name of the context that we're closing matches the name of the context that we opened
|
|
||||||
CAIManager::SMgrDfnNode *curNode=CurrentMgrDfnNodes[CurrentMgrDfnNodes.size()-1];
|
|
||||||
nlassert(contextName==curNode->Name);
|
|
||||||
|
|
||||||
// close this context
|
|
||||||
CurrentMgrDfnNodes.pop_back();
|
|
||||||
|
|
||||||
// if we've finished then do some housekeeping
|
|
||||||
if (CurrentMgrDfnNodes.empty())
|
|
||||||
{
|
|
||||||
// run back through tree stripping out unvisitted entries
|
|
||||||
Clean(*curNode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CAIDSActions::execute(uint64 action,const std::vector <CAIActions::CArg> &args)
|
|
||||||
{
|
|
||||||
// if we've encountered a parse problem don't execute...
|
|
||||||
if (BadParseDepth)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// generate a string to describe the action
|
|
||||||
std::string txt;
|
|
||||||
txt+=toString("%-8.8s",&action);
|
|
||||||
txt+='(';
|
|
||||||
for (uint i=0;i<args.size();++i)
|
|
||||||
{
|
|
||||||
txt+=args[i].toString();
|
|
||||||
if (i<args.size()-1) txt+=", ";
|
|
||||||
}
|
|
||||||
txt+=')';
|
|
||||||
LOG("%s%s",TAB,txt.c_str());
|
|
||||||
|
|
||||||
CAIManager::SMgrDfnNode *curNode;
|
|
||||||
|
|
||||||
// if we havent yet opened our first context then store this data record in the default node
|
|
||||||
// otherwise store it in the node on the top of the CurrentMgrDfnNodes vector
|
|
||||||
if (CurrentMgrDfnNodes.empty())
|
|
||||||
curNode=&DefaultNode;
|
|
||||||
else
|
|
||||||
curNode=CurrentMgrDfnNodes[CurrentMgrDfnNodes.size()-1];
|
|
||||||
|
|
||||||
// add the data record to the top node on the CurrentMgrDfnNodes vector
|
|
||||||
curNode->Data.push_back(CAIManager::SMgrDfnElm(action,args));
|
|
||||||
}
|
|
||||||
|
|
@ -1,78 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef RYAI_AIDS_ACTIONS_H
|
|
||||||
#define RYAI_AIDS_ACTIONS_H
|
|
||||||
|
|
||||||
#include "ai_share/ai_actions.h"
|
|
||||||
#include "ai_manager.h"
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
class CAIDSActions: public CAIActions::IExecutor
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
// init & release
|
|
||||||
|
|
||||||
static void init()
|
|
||||||
{
|
|
||||||
if (Instance==NULL)
|
|
||||||
Instance=new CAIDSActions;
|
|
||||||
CAIActions::init(Instance);
|
|
||||||
}
|
|
||||||
static void release()
|
|
||||||
{
|
|
||||||
if (Instance!=NULL)
|
|
||||||
{
|
|
||||||
CAIActions::release();
|
|
||||||
delete Instance;
|
|
||||||
Instance=NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
// inheritted virtual interface
|
|
||||||
|
|
||||||
virtual void openFile(const std::string &fileName);
|
|
||||||
virtual void closeFile(const std::string &fileName);
|
|
||||||
virtual void begin(const std::string &contextName);
|
|
||||||
virtual void end(const std::string &contextName);
|
|
||||||
virtual void execute(uint64 action,const std::vector <CAIActions::CArg> &args);
|
|
||||||
|
|
||||||
virtual void begin(uint32 context) {}
|
|
||||||
virtual void end(uint32 context) {}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
// public singleton data
|
|
||||||
|
|
||||||
static uint CurrentManager;
|
|
||||||
|
|
||||||
private:
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
// This is a singleton class so make constructor private
|
|
||||||
CAIDSActions() {}
|
|
||||||
~CAIDSActions() {}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
// the singleton class instance
|
|
||||||
static CAIDSActions *Instance;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,136 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
// Includes & namespaces
|
|
||||||
|
|
||||||
#include "ai_share/ai_spawn_commands.h"
|
|
||||||
|
|
||||||
using namespace NLMISC;
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
// remove stupid VC6 warnings
|
|
||||||
void foo_aids_spawn_ctrl_cpp() {}
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
// The CAISpawnCtrl sub-class
|
|
||||||
/*
|
|
||||||
class CAIDSSpawnCtrl: public CAISpawnCtrl
|
|
||||||
{
|
|
||||||
protected:
|
|
||||||
virtual bool _spawn(const std::string &name);
|
|
||||||
virtual bool _spawnMap(const std::string &name);
|
|
||||||
virtual bool _spawnMgr(const std::string &name);
|
|
||||||
virtual bool _spawnGrp(const std::string &name);
|
|
||||||
virtual bool _spawnAll();
|
|
||||||
|
|
||||||
virtual bool _despawn(const std::string &name);
|
|
||||||
virtual bool _despawnMap(const std::string &name);
|
|
||||||
virtual bool _despawnMgr(const std::string &name);
|
|
||||||
virtual bool _despawnGrp(const std::string &name);
|
|
||||||
virtual bool _despawnAll();
|
|
||||||
|
|
||||||
} AIServiceSpawnCtrl;
|
|
||||||
*/
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
// The CAISpawnCtrl singleton data
|
|
||||||
//CAISpawnCtrl *CAISpawnCtrl::_instance=&AIServiceSpawnCtrl;
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
// SPAWNING
|
|
||||||
/*
|
|
||||||
bool CAIDSSpawnCtrl::_spawn(const std::string &name)
|
|
||||||
{
|
|
||||||
if (_spawnMap(name)) return true;
|
|
||||||
if (_spawnMgr(name)) return true;
|
|
||||||
if (_spawnGrp(name)) return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CAIDSSpawnCtrl::_spawnGrp(const std::string &name)
|
|
||||||
{
|
|
||||||
nlinfo("*** spawnGrp(%s) NOT IMPLEMENTED YET ***",name.c_str());
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CAIDSSpawnCtrl::_spawnMgr(const std::string &name)
|
|
||||||
{
|
|
||||||
nlinfo("*** spawnMgr(%s) NOT IMPLEMENTED YET ***",name.c_str());
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CAIDSSpawnCtrl::_spawnMap(const std::string &name)
|
|
||||||
{
|
|
||||||
nlinfo("*** spawnMap(%s) NOT IMPLEMENTED YET ***",name.c_str());
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CAIDSSpawnCtrl::_spawnAll()
|
|
||||||
{
|
|
||||||
nlinfo("*** spawnAll() NOT IMPLEMENTED YET ***");
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
// DESPAWNING
|
|
||||||
|
|
||||||
bool CAIDSSpawnCtrl::_despawn(const std::string &name)
|
|
||||||
{
|
|
||||||
if (_despawnMap(name)) return true;
|
|
||||||
if (_despawnMgr(name)) return true;
|
|
||||||
if (_despawnGrp(name)) return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CAIDSSpawnCtrl::_despawnGrp(const std::string &name)
|
|
||||||
{
|
|
||||||
nlinfo("*** despawnGrp(%s) NOT IMPLEMENTED YET ***",name.c_str());
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CAIDSSpawnCtrl::_despawnMgr(const std::string &name)
|
|
||||||
{
|
|
||||||
nlinfo("*** despawnMgr(%s) NOT IMPLEMENTED YET ***",name.c_str());
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CAIDSSpawnCtrl::_despawnMap(const std::string &name)
|
|
||||||
{
|
|
||||||
// for each manager if map's name found in the command arguments then spawn()
|
|
||||||
nlinfo("*** despawnMap(%s) NOT IMPLEMENTED YET ***",name.c_str());
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CAIDSSpawnCtrl::_despawnAll()
|
|
||||||
{
|
|
||||||
nlinfo("*** despawnAll() NOT IMPLEMENTED YET ***");
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
*/
|
|
@ -1,258 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Nel Misc
|
|
||||||
#include "nel/net/service.h"
|
|
||||||
#include "nel/misc/command.h"
|
|
||||||
|
|
||||||
// Game share
|
|
||||||
#include "game_share/macro_manager.h"
|
|
||||||
|
|
||||||
// locals
|
|
||||||
#include "ai_files.h"
|
|
||||||
#include "ai_manager.h"
|
|
||||||
#include "ai_service.h"
|
|
||||||
|
|
||||||
using namespace NLMISC;
|
|
||||||
using namespace NLNET;
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
// utility routines
|
|
||||||
|
|
||||||
static void argsToManagerVector(const vector<string> &args, vector<CAIManager *> &theManagers)
|
|
||||||
{
|
|
||||||
if(args.size()==0)
|
|
||||||
{
|
|
||||||
for (uint i=0;i<CAIManager::numManagers();++i)
|
|
||||||
theManagers.push_back(CAIManager::getManagerByIdx(i));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (uint i=0;i<args.size();++i)
|
|
||||||
{
|
|
||||||
int id=CAIManager::nameToId(args[i]);
|
|
||||||
if (i==-1)
|
|
||||||
nlwarning("Can't find a manger record for: %s",args[i].c_str());
|
|
||||||
else
|
|
||||||
theManagers.push_back(CAIManager::getManagerById(id));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
// scanning the hard disk for interesting files, compiling
|
|
||||||
// where nessessary and allerting ai_service(s) of data file changes
|
|
||||||
|
|
||||||
NLMISC_COMMAND(aiRescanDirectories,"Rescan disk file directories","")
|
|
||||||
{
|
|
||||||
if(args.size()!=0) return false;
|
|
||||||
COMMAND_MACRO_RECORD_TEST
|
|
||||||
|
|
||||||
CAIFiles::scan();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
NLMISC_COMMAND(aiMake,"scan the hard disk for interesting files, recompile as necessary and allert services","")
|
|
||||||
{
|
|
||||||
COMMAND_MACRO_RECORD_TEST
|
|
||||||
|
|
||||||
// rescan the source and object directories for files
|
|
||||||
CAIFiles::scan();
|
|
||||||
|
|
||||||
// build the list of ai managers to act on
|
|
||||||
vector<CAIManager *> theManagers;
|
|
||||||
argsToManagerVector(args,theManagers);
|
|
||||||
|
|
||||||
// do the work
|
|
||||||
for (uint i=0;i<theManagers.size();++i)
|
|
||||||
{
|
|
||||||
if (theManagers[i]->needCompile())
|
|
||||||
{
|
|
||||||
//nlinfo("Compiling manager: %04d: %s",theManagers[i]->id(),theManagers[i]->name());
|
|
||||||
theManagers[i]->compile();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
nlinfo("Manager is up to date: %04d: %s",theManagers[i]->id(),theManagers[i]->name().c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
NLMISC_COMMAND(aiClean,"delete all generated files on the hard disk (next 'make' will rebuild everything)","")
|
|
||||||
{
|
|
||||||
COMMAND_MACRO_RECORD_TEST
|
|
||||||
|
|
||||||
// rescan the source and object directories for files
|
|
||||||
CAIFiles::scan();
|
|
||||||
|
|
||||||
// build the list of ai managers to act on
|
|
||||||
vector<CAIManager *> theManagers;
|
|
||||||
argsToManagerVector(args,theManagers);
|
|
||||||
|
|
||||||
// do the work
|
|
||||||
for (uint i=0;i<theManagers.size();++i)
|
|
||||||
{
|
|
||||||
nlinfo("Cleaning: %04d: %s",theManagers[i]->id(),theManagers[i]->name().c_str());
|
|
||||||
theManagers[i]->clean();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
|
|
||||||
NLMISC_COMMAND(aiDisplayServices,"list the ai services, their parameters and their lists of running managers","[<service id>[...]]")
|
|
||||||
{
|
|
||||||
if(args.size()!=0) return false;
|
|
||||||
COMMAND_MACRO_RECORD_TEST
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
NLMISC_COMMAND(aiDisplayManagers,"Display the known ai manager list","[<manager name|id>[...]]")
|
|
||||||
{
|
|
||||||
COMMAND_MACRO_RECORD_TEST
|
|
||||||
|
|
||||||
// build the list of ai managers to act on
|
|
||||||
vector<CAIManager *> theManagers;
|
|
||||||
argsToManagerVector(args,theManagers);
|
|
||||||
|
|
||||||
// do the work
|
|
||||||
for (uint i=0;i<theManagers.size();++i)
|
|
||||||
theManagers[i]->display();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
NLMISC_COMMAND(aiOpenAllManagers,"Open all managers and automatically assign to ai services","")
|
|
||||||
{
|
|
||||||
if(args.size()!=0) return false;
|
|
||||||
COMMAND_MACRO_RECORD_TEST
|
|
||||||
|
|
||||||
for (uint i=0;i<CAIManager::numManagers();++i)
|
|
||||||
if (!CAIManager::getManagerByIdx(i)->isOpen())
|
|
||||||
CAIManager::getManagerByIdx(i)->open();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
NLMISC_COMMAND(aiOpenManagers,"Open managers and automatically assign to ai services","<manager name|id>[...]")
|
|
||||||
{
|
|
||||||
if(args.size()<1) return false;
|
|
||||||
COMMAND_MACRO_RECORD_TEST
|
|
||||||
|
|
||||||
for (uint i=0;i<args.size();++i)
|
|
||||||
{
|
|
||||||
int id=CAIManager::nameToId(args[i]);
|
|
||||||
if (i==-1)
|
|
||||||
nlwarning("Can't find a manger record for: %s",args[i].c_str());
|
|
||||||
else
|
|
||||||
CAIManager::getManagerById(id)->open();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
NLMISC_COMMAND(aiAssignManagers,"Open managers and assign to specified ai service","<service><manager name|id>[...]")
|
|
||||||
{
|
|
||||||
if(args.size()<2) return false;
|
|
||||||
COMMAND_MACRO_RECORD_TEST
|
|
||||||
|
|
||||||
// convert args[0] to service id and verify existance in services list
|
|
||||||
NLNET::TServiceId service(atoi(args[0].c_str()));
|
|
||||||
if (service.get()==0 && args[0]!="0")
|
|
||||||
{
|
|
||||||
nlwarning("Invalid service id: %s",args[0].c_str());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// iterate through args assigning managers to service
|
|
||||||
for (uint i=1;i<args.size();++i)
|
|
||||||
{
|
|
||||||
int id=CAIManager::nameToId(args[i]);
|
|
||||||
if (i==-1)
|
|
||||||
nlwarning("Can't find a manger record for: %s",args[i].c_str());
|
|
||||||
else
|
|
||||||
CAIManager::getManagerById(id)->assign(service);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
NLMISC_COMMAND(aiReassignManagers,"Save & close managers on existing services and open on specified ai service","<service><manager name|id>[...]")
|
|
||||||
{
|
|
||||||
if(args.size()<2) return false;
|
|
||||||
COMMAND_MACRO_RECORD_TEST
|
|
||||||
|
|
||||||
// convert args[0] to service id and verify existance in services list
|
|
||||||
NLNET::TServiceId service(atoi(args[0].c_str()));
|
|
||||||
if (service.get()==0 && args[0]!="0")
|
|
||||||
{
|
|
||||||
nlwarning("Invalid service id: %s",args[0].c_str());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// iterate through args reassigning managers to service
|
|
||||||
for (uint i=1;i<args.size();++i)
|
|
||||||
{
|
|
||||||
int id=CAIManager::nameToId(args[i]);
|
|
||||||
if (i==-1)
|
|
||||||
nlwarning("Can't find a manger record for: %s",args[i].c_str());
|
|
||||||
else
|
|
||||||
CAIManager::getManagerById(id)->reassign(service);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
NLMISC_COMMAND(aiCloseAllManagers,"Close all managers across all ai services on the shard","")
|
|
||||||
{
|
|
||||||
if(args.size()!=0) return false;
|
|
||||||
COMMAND_MACRO_RECORD_TEST
|
|
||||||
|
|
||||||
for (uint i=0;i<CAIManager::numManagers();++i)
|
|
||||||
if (CAIManager::getManagerByIdx(i)->isOpen())
|
|
||||||
CAIManager::getManagerByIdx(i)->close();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
NLMISC_COMMAND(aiCloseManagers,"Close listed managers","<manager name|id>[...]")
|
|
||||||
{
|
|
||||||
if(args.size()<1) return false;
|
|
||||||
COMMAND_MACRO_RECORD_TEST
|
|
||||||
|
|
||||||
for (uint i=0;i<args.size();++i)
|
|
||||||
{
|
|
||||||
int id=CAIManager::nameToId(args[i]);
|
|
||||||
if (i==-1)
|
|
||||||
nlwarning("Can't find a manger record for: %s",args[i].c_str());
|
|
||||||
else
|
|
||||||
CAIManager::getManagerById(id)->close();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
@ -1,253 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
#include "nel/misc/command.h"
|
|
||||||
|
|
||||||
#include "game_share/bmp4image.h"
|
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
using namespace NLMISC;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <stack>
|
|
||||||
|
|
||||||
class CNeighbour
|
|
||||||
{
|
|
||||||
uint SurfaceCell;
|
|
||||||
uint CellSurfaceIdx;
|
|
||||||
|
|
||||||
uint8 Heading[16][16];
|
|
||||||
};
|
|
||||||
|
|
||||||
class CSurface
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
CSurface()
|
|
||||||
{
|
|
||||||
memset(Points,0,sizeof(Points));
|
|
||||||
}
|
|
||||||
|
|
||||||
void addPoint(uint x,uint y)
|
|
||||||
{
|
|
||||||
Points[y]|=(1<<x);
|
|
||||||
}
|
|
||||||
|
|
||||||
void displayPoints()
|
|
||||||
{
|
|
||||||
char txt[]="0123456789abcdef";
|
|
||||||
nlinfo("Surface Points: ",txt);
|
|
||||||
for (uint j=0;j<16;++j)
|
|
||||||
{
|
|
||||||
for (uint i=0;i<16;++i)
|
|
||||||
txt[i]=(Points[j]&(1<<i))? ' ': '#';
|
|
||||||
nlinfo("- %s",txt);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
sint16 Points[16]; // boolean map of surface shape
|
|
||||||
uint8 XNeighbours[16][16];
|
|
||||||
uint8 YNeighbours[16][16];
|
|
||||||
std::vector<CNeighbour> Neighbours;
|
|
||||||
};
|
|
||||||
|
|
||||||
class CCell
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
sint8 Points[16][16]; // ends up with set of surface ids
|
|
||||||
std::vector <CSurface *> Surfaces;
|
|
||||||
};
|
|
||||||
|
|
||||||
void generateSurfaces(char *topLeft,uint lineLen,CCell &cell)
|
|
||||||
{
|
|
||||||
std::stack<uint> stack;
|
|
||||||
uint i,j;
|
|
||||||
|
|
||||||
// fill the points grid with -1 where accessible and -2 where inaccessible
|
|
||||||
uint goodCount=0, badCount=0;
|
|
||||||
for (j=0;j<16;++j)
|
|
||||||
for (i=0;i<16;++i)
|
|
||||||
if (*(topLeft+i+lineLen*j)==' ')
|
|
||||||
{
|
|
||||||
cell.Points[j][i]= -1;
|
|
||||||
++goodCount;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cell.Points[j][i]= -2;
|
|
||||||
++badCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
// flood fill to convert -1s to surface ids
|
|
||||||
uint surfaceCount=~0u;
|
|
||||||
for (j=0;j<16;++j)
|
|
||||||
for (i=0;i<16;++i)
|
|
||||||
if (cell.Points[j][i]==-1)
|
|
||||||
{
|
|
||||||
CSurface *surface=new CSurface;
|
|
||||||
cell.Surfaces.push_back(surface);
|
|
||||||
++surfaceCount;
|
|
||||||
cell.Points[j][i]=surfaceCount;
|
|
||||||
stack.push(16*j+i);
|
|
||||||
while (!stack.empty())
|
|
||||||
{
|
|
||||||
// pop the coordinate off the stack
|
|
||||||
uint x=stack.top()&0xf;
|
|
||||||
uint y=stack.top()/16;
|
|
||||||
stack.pop();
|
|
||||||
|
|
||||||
// add the point to the surface
|
|
||||||
surface->addPoint(x,y);
|
|
||||||
|
|
||||||
// look for neighbouring points to add to the same surface
|
|
||||||
if (x<15 && cell.Points[y][x+1]==-1) { cell.Points[y][x+1]=surfaceCount; stack.push(16*y+ x+1); }
|
|
||||||
if (x>0 && cell.Points[y][x-1]==-1) { cell.Points[y][x-1]=surfaceCount; stack.push(16*y+ x-1); }
|
|
||||||
if (y<15 && cell.Points[y+1][x]==-1) { cell.Points[y+1][x]=surfaceCount; stack.push(16*y+16+ x); }
|
|
||||||
if (y>0 && cell.Points[y-1][x]==-1) { cell.Points[y-1][x]=surfaceCount; stack.push(16*y-16+ x); }
|
|
||||||
}
|
|
||||||
surface->displayPoints();
|
|
||||||
}
|
|
||||||
nlinfo("Generated %i surfaces, %i accessible cell.Points, %i inaccessible cell.Points",surfaceCount+1,goodCount,badCount);
|
|
||||||
for (j=0;j<16;++j)
|
|
||||||
{
|
|
||||||
char txt[17];
|
|
||||||
for (i=0;i<16;++i)
|
|
||||||
txt[i]=(cell.Points[j][i]>=0 && cell.Points[j][i]<=9)? cell.Points[j][i]+'0': '#';
|
|
||||||
txt[16]=0;
|
|
||||||
nlinfo("- surfaces: %s", txt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void generateSurfaceNeighbourhoods(
|
|
||||||
CCell *tl, CCell *tm, CCell *tr,
|
|
||||||
CCell *ml, CCell *mm, CCell *mr,
|
|
||||||
CCell *bl, CCell *bm, CCell *br)
|
|
||||||
{
|
|
||||||
// todo here!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
||||||
|
|
||||||
// generate horizontal neighbours
|
|
||||||
|
|
||||||
// generate vertical neighbours
|
|
||||||
|
|
||||||
// * add propagation maps to the surfaces
|
|
||||||
// for each surface propagate out following neighbour map
|
|
||||||
}
|
|
||||||
|
|
||||||
NLMISC_COMMAND(dummyCrunch,"Run a test of pacs crunch","")
|
|
||||||
{
|
|
||||||
if(args.size()!=0)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
char testMap[]=
|
|
||||||
"0000000000000000111111111111111100000000000000001111111111111111"
|
|
||||||
"0000000000000000111111111111111100000000000000001111111111111111"
|
|
||||||
"0000000000000000111111111111111100000000000000001111111111111111"
|
|
||||||
"000 111000 111"
|
|
||||||
"000 111"
|
|
||||||
"000 111000 111"
|
|
||||||
"000 00000000001111111111 111000 00000000001111111111 111"
|
|
||||||
"000 1 111000 1 111"
|
|
||||||
"000 1 111000 1 111"
|
|
||||||
"000 1 111000 1 111"
|
|
||||||
"000 1 111000 1 111"
|
|
||||||
"000 1 111000 1 111"
|
|
||||||
"000 1 111000 1 111"
|
|
||||||
"000 1 111000 1 111"
|
|
||||||
"000 000000000011111 1 111000 000000000011111 1 111"
|
|
||||||
"000 000000011111 1 111000 000000011111 1 111"
|
|
||||||
"222 222222233333 3 333222 222222233333 3 333"
|
|
||||||
"222222222222222233333 3 333222222222222222233333 3 333"
|
|
||||||
"222 3 333222 3 333"
|
|
||||||
"222 3 3 333"
|
|
||||||
"222 2222222222223333333333 333222 2222222222223333333333 333"
|
|
||||||
"22222 33322222 333"
|
|
||||||
"222 333222 333"
|
|
||||||
"222 333222 333"
|
|
||||||
"222222222222222233333333333333332222222222 22223333333333333333"
|
|
||||||
"22222222222222223 32222222222 22223333333333333333"
|
|
||||||
"22222222222222223 333333333333 32222222222 22223333333333333333"
|
|
||||||
"22222222222222223 33 33 32222222222 22223333333333333333"
|
|
||||||
"22222222222222223 33 32222222222 22223333333333333333"
|
|
||||||
"22222222222222223333 33 32222222222 22223333333333333333"
|
|
||||||
"222222222222222233333 333 2222 22223333333333333333"
|
|
||||||
"222222222222222233333333 33333322222 2222 22223333333333333333"
|
|
||||||
"0000000000000000111111111 1111100000 0000 00001111111111111111"
|
|
||||||
"00000000000000001111111111 111100000 0000 00001111111111111111"
|
|
||||||
"000000000000000011111111111 11100000 0000 00001111111111111111"
|
|
||||||
"000 11000 111"
|
|
||||||
"000 1000 111"
|
|
||||||
"000 1 000 111"
|
|
||||||
"000 00000000001111111111 11 00 00000000001111111111 111"
|
|
||||||
"000 1 111 0 1 111"
|
|
||||||
"000 1 1110 1 111"
|
|
||||||
"000 1 11100 1 111"
|
|
||||||
"000 1 111000 1 111"
|
|
||||||
"000 1 111000 1 111"
|
|
||||||
"000 1 111000 1 111"
|
|
||||||
"000 1 111000 1 111"
|
|
||||||
"000 000000000011111 1 111000 000000000011111 1 111"
|
|
||||||
"000 000000011111 1 111000 000000011111 1 111"
|
|
||||||
"222 222222233333 3 333222 222222233333 3 333"
|
|
||||||
"222222222222222233333 3 333222222222222222233333 3 333"
|
|
||||||
"222 3 333222 3 333"
|
|
||||||
"222 3 333222 3 333"
|
|
||||||
"222 2222222222223333333333 333222 2222222222223333333333 333"
|
|
||||||
"22222 33322222 333"
|
|
||||||
"222 333222 333"
|
|
||||||
"222 333222 333"
|
|
||||||
"2222222222222222333333333333333322222222222222223333333333333333"
|
|
||||||
"2222 222222222333 333333322 2222233 333"
|
|
||||||
"22222 22222222223333 33 33333333222 22 22 222222333 3 33333 3333"
|
|
||||||
"22222 22222222223333 33 33333333222 22 22 222222333 33 333 33333"
|
|
||||||
"22222 22222222223333 33 33333333222 22 22 222222333 333 3 333333"
|
|
||||||
"22222 22222222223333 33 33333333222 22 22 222222333 3333 3333333"
|
|
||||||
"2222 222222222333 333333322 2222233 333"
|
|
||||||
"2222222222222222333333333333333322222222222222223333333333333333";
|
|
||||||
|
|
||||||
|
|
||||||
int i,j;
|
|
||||||
|
|
||||||
// need to create a dummy cell that links into the cell grid in all slots as
|
|
||||||
// default value
|
|
||||||
// *** here ***
|
|
||||||
|
|
||||||
// setup a 4x4 cell grid in a 6x6 grid surrounded by NULLs
|
|
||||||
typedef CCell *TCellRef;
|
|
||||||
TCellRef cells[6][6];
|
|
||||||
memset (cells,0,sizeof(cells));
|
|
||||||
for (j=0;j<4;++j)
|
|
||||||
for (i=0;i<4;++i)
|
|
||||||
cells[j+1][i+1]=new CCell;
|
|
||||||
|
|
||||||
// generate surfaces
|
|
||||||
for (j=0;j<4;++j)
|
|
||||||
for (i=0;i<4;++i)
|
|
||||||
generateSurfaces(testMap+i*16+j*64*16,64,*cells[j+1][i+1]);
|
|
||||||
|
|
||||||
// generate surface neighbourhoods
|
|
||||||
for (j=0;j<4;++j)
|
|
||||||
for (i=0;i<4;++i)
|
|
||||||
generateSurfaceNeighbourhoods(
|
|
||||||
cells[1+j-1][1+i-1], cells[1+j-1][1+i+0], cells[1+j-1][1+i+1],
|
|
||||||
cells[1+j+0][1+i-1], cells[1+j+0][1+i+0], cells[1+j+0][1+i+1],
|
|
||||||
cells[1+j+1][1+i-1], cells[1+j+1][1+i+0], cells[1+j+1][1+i+1]
|
|
||||||
);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
@ -1,73 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// include files
|
|
||||||
#include "nel/misc/types_nl.h"
|
|
||||||
|
|
||||||
#include "messages.h"
|
|
||||||
//#include "actor_manager.h"
|
|
||||||
|
|
||||||
using namespace NLMISC;
|
|
||||||
using namespace NLNET;
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
// singleton initialisation and release
|
|
||||||
|
|
||||||
void CMessages::init()
|
|
||||||
{
|
|
||||||
// incoming messages
|
|
||||||
TRANSPORT_CLASS_REGISTER( CMsgAIServiceUp );
|
|
||||||
TRANSPORT_CLASS_REGISTER( CMsgAIManagerUp );
|
|
||||||
TRANSPORT_CLASS_REGISTER( CMsgAIFeedback );
|
|
||||||
|
|
||||||
TRANSPORT_CLASS_REGISTER( CMsgAICloseMgrs );
|
|
||||||
TRANSPORT_CLASS_REGISTER( CMsgAIBackupMgrs );
|
|
||||||
}
|
|
||||||
|
|
||||||
void CMessages::release()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
// incoming message callbacks
|
|
||||||
|
|
||||||
void CMsgAIServiceUp::callback (const std::string &serviceName, NLNET::TServiceId sid)
|
|
||||||
{
|
|
||||||
nlinfo("AI Service Up: %02d (CPU rating: %f RAMrating %f)", sid.get(), ProcessorAllocation,RamAllocation);
|
|
||||||
for (uint i=0;i<ManagersRunning.size();i++)
|
|
||||||
nlinfo("-- Running Manager: %04d",ManagersRunning[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CMsgAIManagerUp::callback (const std::string &serviceName, NLNET::TServiceId sid)
|
|
||||||
{
|
|
||||||
nlinfo("Service %d: Manager Up: %04d",sid.get(), MgrId);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CMsgAIFeedback::callback (const std::string &serviceName, NLNET::TServiceId sid)
|
|
||||||
{
|
|
||||||
nlinfo("AI Manager %d: %s",Message.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
// stub outgoing message callbacks
|
|
||||||
|
|
||||||
void CMsgAICloseMgrs::callback(const std::string &serviceName, NLNET::TServiceId sid) {}
|
|
||||||
void CMsgAIBackupMgrs::callback(const std::string &serviceName, NLNET::TServiceId sid) {}
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
|||||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef RYAI_MESSAGES_H
|
|
||||||
#define RYAI_MESSAGES_H
|
|
||||||
|
|
||||||
#include "ai_share/aids_messages.h"
|
|
||||||
#include "ai_share/ais_messages.h"
|
|
||||||
|
|
||||||
class CMessages
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
// singleton initialisation and release
|
|
||||||
static void init();
|
|
||||||
static void release();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,9 +0,0 @@
|
|||||||
x1. make: identify primitive files and display 'compile (%s)'
|
|
||||||
x2. link up the compiler - dump contents of the primitive file to console
|
|
||||||
3. create the binary file to send to the ais & save to disk (with hierachy)
|
|
||||||
4. setup messages between AIS & AIDS ( & remote ctrl )
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static file name ids?
|
|
||||||
*** 2 places ais creates gpms message
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue