1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 //-----------------------------------------------------------------------------
19 //-----------------------------------------------------------------------------
22 #include "nel/misc/mem_stream.h"
25 #include "game_share/utils.h"
26 #include "game_share/deployment_configuration.h"
29 #include "deployment_configuration_synchroniser.h"
32 //-------------------------------------------------------------------------------------------------
34 //-------------------------------------------------------------------------------------------------
37 using namespace NLMISC
;
38 using namespace NLNET
;
39 using namespace PATCHMAN
;
40 using namespace DEPCFG
;
43 //-----------------------------------------------------------------------------
44 // methods CDeploymentConfigurationSynchroniser
45 //-----------------------------------------------------------------------------
47 void CDeploymentConfigurationSynchroniser::requestSync(NLNET::IModuleProxy
*sender
)
49 // make sure we're initialised
50 nlassert(_Parent
!=NULL
);
52 // bundle the CDeploymentConfiguration singleton into a data blob
54 blob
.serial(CDeploymentConfiguration::getInstance());
56 // get a proxy for the other guy and send them the message
57 CDeploymentConfigurationSynchroniserProxy
other(sender
);
58 other
.sync(_Parent
,NLNET::TBinBuffer(blob
.buffer(),blob
.size()));
61 void CDeploymentConfigurationSynchroniser::sync(NLNET::IModuleProxy
*sender
, const NLNET::TBinBuffer
&dataBlob
)
63 // make sure we're initialised
64 nlassert(_Parent
!=NULL
);
66 // rebuild our CDeploymentConfiguration singleton from the data blob
67 NLMISC::CMemStream blob
;
68 blob
.fill(dataBlob
.getBuffer(),dataBlob
.getBufferSize());
70 blob
.serial(CDeploymentConfiguration::getInstance());
72 // call the derived class' callback method (if there is one)
73 cbDeploymentConfigurationSynchronised(sender
);
76 CDeploymentConfigurationSynchroniser::CDeploymentConfigurationSynchroniser()
81 void CDeploymentConfigurationSynchroniser::init(NLNET::IModule
* parent
)
83 // make sure we're NOT initialising more than once
84 nlassert(_Parent
==NULL
);
86 CDeploymentConfigurationSynchroniserSkel::init(parent
);