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/>.
19 #ifndef RY_CMS_MIRRORS_H
20 #define RY_CMS_MIRRORS_H
23 #include "nel/misc/types_nl.h"
24 #include "nel/misc/entity_id.h"
25 #include "nel/misc/sheet_id.h"
26 #include "game_share/mode_and_behaviour.h"
27 #include "game_share/mirror.h"
28 #include "game_share/mirror_prop_value.h"
33 // singleton initialisation and release
34 static void init( void (*cbUpdate
)(), void (*cbSync
)()=NULL
, void (*cbRelease
)() = NULL
);
35 static void initMirror();
36 static void processMirrorUpdates();
37 static void release();
39 static bool exists( const NLMISC::CEntityId
& id
) { return (DataSet
->getDataSetRow( id
).isValid()); }
41 static sint32
x( const NLMISC::CEntityId
& id
) { CMirrorPropValueRO
<sint32
> value( *DataSet
, id
, "X" ); return (sint32
)value(); }
42 static sint32
y( const NLMISC::CEntityId
& id
) { CMirrorPropValueRO
<sint32
> value( *DataSet
, id
, "Y" ); return (sint32
)value(); }
43 static sint32
z( const NLMISC::CEntityId
& id
) { CMirrorPropValueRO
<sint32
> value( *DataSet
, id
, "Z" ); return (sint32
)value(); }
44 static sint32
mode( const NLMISC::CEntityId
& id
) { CMirrorPropValueRO
<uint64
> value( *DataSet
, id
, "Mode" ); return (sint32
)(MBEHAV::TMode(value()).Mode
); }
45 static sint32
behaviour( const NLMISC::CEntityId
& id
) { CMirrorPropValueRO
<uint32
> value( *DataSet
, id
, "Behaviour" ); return (uint32
)value(); }
47 static void initSheet( const NLMISC::CEntityId
& id
, const NLMISC::CSheetId
& sheetId
) { CMirrorPropValue
<uint32
> value( *DataSet
, id
, "Sheet" ); value
= sheetId
.asInt(); }
48 static NLMISC::CSheetId
sheet( const NLMISC::CEntityId
& id
) { CMirrorPropValueRO
<uint32
> value( *DataSet
, id
, "Sheet" ); return NLMISC::CSheetId(value()); }
51 // callbacks used at service connection and disconnection
52 static void cbServiceUp( const std::string
& serviceName
, uint16 serviceId
, void * );
53 static void cbServiceDown( const std::string
& serviceName
, uint16 serviceId
, void * );
56 static CMirror Mirror
;
57 static CMirroredDataSet
*DataSet
;
61 #define TheDataset (*CMirrors::DataSet)
64 #endif // RY_CMS_MIRRORS_H