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/>.
20 #include "nel/misc/types_nl.h"
22 #include "game_share/utils.h"
24 #include "server_share/r2_variables.h"
25 #include "game_share/r2_messages.h"
27 #include "gpm_service.h"
29 #include "world_position_manager.h"
31 //#include "game_share/tick_event_handler.h"
32 //#include "game_share/msg_client_server.h"
33 //#include "game_share/mode_and_behaviour.h" //TEMP!!!
34 //#include "game_share/news_types.h"
35 //#include "game_share/bot_chat_types.h"
36 //#include "game_share/brick_types.h"
37 //#include "game_share/loot_harvest_state.h"
38 //#include "game_share/synchronised_message.h"
41 using namespace NLMISC
;
42 using namespace NLNET
;
47 /****************************************************************\
49 \****************************************************************/
51 void cbAddEntity( CMessage& msgin, const string &serviceName, uint16 serviceId )
53 // Only for invisible group entities (other entities use the mirror system)
58 // entity pos (x, y, z, theta) at tick
68 // the tick when this entity should be added
69 //--------------------------------- DEBUG ONLY--------------------------------
70 NLMISC::TGameCycle tick;
71 //msgin.serial( tick );
72 tick = CTickEventHandler::getGameCycle();
73 //--------------------------------- DEBUG ONLY--------------------------------
77 msgin.serial( sheet );
79 uint8 continent = INVALID_CONTINENT_INDEX;
80 if (msgin.getPos() != (sint32)msgin.length())
81 msgin.serial(continent);
84 if (msgin.getPos() != (sint32)msgin.length())
87 nlinfo("<cbAddEntity> Add entity %s at pos (%d,%d,%d)", id.toString().c_str(), x,y,z );
88 CWorldPositionManager::addEntity( id, x, y, z, t, continent, cell, tick, sheet, id.getDynamicId() );
92 /****************************************************************\
94 \****************************************************************/
96 void cbAddIAObject( CMessage& msgin, const string &serviceName, uint16 serviceId )
98 nlerror( "TODO: process ADD_IA_OBJECT" );
103 /****************************************************************\
105 \****************************************************************/
106 /*void cbAddEntities( CMessage& msgin, const string &serviceName, uint16 serviceId )
108 //nlinfo("received ADD_ENTITIES request");
110 uint32 entitiesCount;
111 msgin.serial( entitiesCount );
113 for( uint32 i = 0; i < entitiesCount; i++ )
118 // entity pos (x, y, z, theta) at tick
128 // the tick when this entity should be added
129 //--------------------------------- DEBUG ONLY--------------------------------
130 NLMISC::TGameCycle tick;
131 //msgin.serial( tick );
132 tick = CTickEventHandler::getGameCycle();
133 //--------------------------------- DEBUG ONLY--------------------------------
137 msgin.serial( sheet );
139 nlinfo("<cbAddEntities> Add entity %s at pos (%d,%d,%d)", id.toString().c_str(), x,y,z );
140 CWorldPositionManager::addEntity(id, x, y, z, t, INVALID_CONTINENT_INDEX, 0, tick, sheet, id.getDynamicId() );
142 } // cbAddEntities //
145 /****************************************************************\
147 \****************************************************************/
149 void cbRemoveEntity( CMessage& msgin, const string &serviceName, uint16 serviceId )
151 // Only for invisible group entities (other entities use the mirror system)
156 nlinfo("received REMOVE_ENTITY request for id %s", id.toString().c_str() );
158 CWorldPositionManager::onRemoveEntity( id );
160 } // cbRemoveEntity //
163 /****************************************************************\
165 \****************************************************************/
166 /*void cbRemoveEntities( CMessage& msgin, const string &serviceName, uint16 serviceId )
168 nlinfo("received REMOVE_ENTITIES request");
171 msgin.serialCont( ids );
173 list<CEntityId> idsAgents;
175 list<CEntityId>::iterator it;
176 for( it = ids.begin(); it!=ids.end(); ++it )
178 CWorldPositionManager::removeEntity( *it );
179 nlinfo(" REMOVE_ENTITY id %s", (*it).toString().c_str() );
181 if( (*it).getType() == RYZOMID::npc )
183 idsAgents.push_back( *it );
187 if( idsAgents.size() != 0 )
189 CMessage msgout("REMOVE_ENTITY");
191 for ( it = idsAgents.begin() ; it != idsAgents.end() ; ++it)
192 msgout.serial( const_cast<CEntityId&> (*it) );
194 sendMessageViaMirror( "AgS", msgout );
197 }*/ // cbRemoveEntities //
200 /****************************************************************\
201 CGPMPlayerPrivilegeInst::callback
202 \****************************************************************/
203 void CGPMPlayerPrivilegeInst::callback (const std::string
&name
, NLNET::TServiceId id
)
205 CWorldEntity
* entity
= CWorldPositionManager::getEntityPtr(PlayerIndex
);
207 if (entity
== NULL
|| entity
->PlayerInfos
== NULL
)
209 nlwarning("CGPMPlayerPrivilegeInst::callback(): entity '%d' is not a player", PlayerIndex
.getIndex());
213 // enable/disable speed checking, only enabled for basic players
214 entity
->PlayerInfos
->CheckSpeed
= (Type
== CGPMPlayerPrivilege::Player
);
217 /****************************************************************\
219 \****************************************************************/
220 void cbSetPlayerFlags( CMessage
& msgin
, const string
&serviceName
, NLNET::TServiceId serviceId
)
222 R2::CMessageSetGPMSPlayerFlags msgData
;
223 msgin
.serial(msgData
);
225 CWorldEntity
* entity
= CWorldPositionManager::getEntityPtr(msgData
.PlayerIndex
);
227 DROP_IF(entity
== NULL
|| entity
->PlayerInfos
== NULL
, NLMISC::toString("cbSetPlayerFlags(): entity '%d' is not a player", msgData
.PlayerIndex
.getIndex()), return);
229 // enable/disable speed checking, only enabled for basic players
230 entity
->PlayerInfos
->CheckSpeed
= msgData
.LimitSpeed
;
233 /****************************************************************\
235 \****************************************************************/
236 void cbBag( CMessage
& msgin
, const string
&serviceName
, NLNET::TServiceId serviceId
)
239 vector
<CEntitySheetId
> content
;
242 msgin
.serialCont(content
);
244 TDataSetRow index
= CWorldPositionManager::getEntityIndex(id
);
246 CWorldPositionManager::setContent(index
, content
);
251 /****************************************************************\
253 \****************************************************************/
254 void cbLoadContinent( CMessage
& msgin
, const string
&serviceName
, NLNET::TServiceId serviceId
)
260 // load continent index
261 msgin
.serial(continent
);
263 // load continent name
266 // load continent filename
269 // load continent in position manager
270 CWorldPositionManager::loadContinent(name
, file
, continent
);
273 /****************************************************************\
275 \****************************************************************/
276 void cbRemoveContinent( CMessage
& msgin
, const string
&serviceName
, NLNET::TServiceId serviceId
)
280 // load continent index
281 msgin
.serial(continent
);
283 // remove continent from position manager
284 CWorldPositionManager::removeContinent(continent
);
288 /****************************************************************\
290 \****************************************************************/
291 void cbCreateIndoorUnit( CMessage
& msgin
, const string
&serviceName
, NLNET::TServiceId serviceId
)
293 DROP_IF(IsRingShard
,"Creating indoor units not supported on ring shards!",return);
297 // cell id (should be >= 2)
302 nlwarning("cbCreateIndoorUnit(): try to create unit using id < 2");
306 CWorldPositionManager::createIndoorCell(cell
);
308 nlinfo("MSG: Creating indoor unit %d",cell
);
311 /****************************************************************\
313 \****************************************************************/
314 void cbCreateBuilding( CMessage
& msgin
, const string
&serviceName
, NLNET::TServiceId serviceId
)
320 msgin
.serial(continent
);
322 msgin
.serial(position
);
324 CWorldPositionManager::createBuildingInstance(continent
, id
, position
);
327 /****************************************************************\
329 \****************************************************************/
330 void cbCreateObstacle( CMessage
& msgin
, const string
&serviceName
, NLNET::TServiceId serviceId
)
336 while (msgin
.getPos() < (sint32
)msgin
.length())
338 msgin
.serial(id
, file
, position
, angle
);
339 CWorldPositionManager::instanciatePacsPrim(id
, file
, position
, angle
);
343 /****************************************************************\
345 \****************************************************************/
346 void cbRemoveObstacle( CMessage
& msgin
, const string
&serviceName
, NLNET::TServiceId serviceId
)
350 while (msgin
.getPos() < (sint32
)msgin
.length())
353 CWorldPositionManager::removePacsPrim(id
);
357 /****************************************************************\
359 \****************************************************************/
360 void cbSetObstacle( CMessage
& msgin
, const string
&serviceName
, NLNET::TServiceId serviceId
)
365 while (msgin
.getPos() < (sint32
)msgin
.length())
367 msgin
.serial(id
, obstacle
);
368 CWorldPositionManager::setObstacle(id
, obstacle
);
372 /****************************************************************\
373 cbUpdateEntityPosition()
374 \****************************************************************/
376 void cbUpdateEntityPosition( CMessage& msgin, const string &serviceName, uint16 serviceId )
378 H_BEFORE(cbUpdatePosition);
379 //Use only for tp, update position and clear behaviours list
380 //nlinfo("received UPDATE_ENTITY_POSITION request");
385 // entity pos (x, y, z, theta) at tick
394 NLMISC::TGameCycle tick;
395 msgin.serial( tick );
397 // nlwarning("GPMS Received Update Position, Pos(%.3f,%.3f,%.3f), theta = %.3f", x, y, z,t );
399 CWorldPositionManager::setEntityPosition(id, x, y, z, t, tick);
400 H_AFTER(cbUpdatePosition);
401 } // cbUpdateEntityPosition //
404 /****************************************************************\
405 cbUpdateEntitiesPositions()
406 \****************************************************************/
408 void cbUpdateEntitiesPositions( CMessage& msgin, const string &serviceName, uint16 serviceId )
410 H_BEFORE(cbUpdatePositions);
411 //Use only for tp, update position and clear behaviours list
412 //nlinfo("received UPDATE_ENTITIES_POSITIONS request");
414 uint16 entitiesCount;
415 msgin.serial( entitiesCount );
417 NLMISC::CEntityId sid;
420 NLMISC::TGameCycle tick;
422 for (uint16 i = 0 ; i < entitiesCount ; ++i)
429 msgin.serial( tick );
431 //nlinfo("Entity %s: received (%.3f,%.3f,%.3f), theta = %.3f", sid.toString().c_str(), x*0.001, y*0.001, z*0.001,t );
433 CWorldPositionManager::setEntityPosition(sid, x, y, z, t, tick);
436 H_AFTER(cbUpdatePositions);
437 } // cbUpdateEntitiesPositions //
440 /****************************************************************\
441 cbUpdateEntitiesPositions()
442 \****************************************************************/
444 void cbUpdateEntitiesPositionsUsingSize( CMessage& msgin, const string &serviceName, uint16 serviceId )
446 H_BEFORE(cbUpdatePositions);
447 //nlinfo("received UPDATE_ENTITIES_POSITIONS request");
449 NLMISC::CEntityId sid;
452 NLMISC::TGameCycle tick;
454 while (msgin.getPos() < (sint32)msgin.length())
461 msgin.serial( tick );
463 //nlinfo("Entity %s: received (%.3f,%.3f,%.3f), theta = %.3f", id.toString().c_str(), x*0.001, y*0.001, z*0.001,t );
465 CWorldPositionManager::setEntityPosition(sid, x, y, z, t, tick);
468 H_AFTER(cbUpdatePositions);
469 } // cbUpdateEntitiesPositions //
473 /// Update orientation of several entities
474 void cbUpdateEntitiesOrientations( CMessage& msgin, const string &serviceName, uint16 serviceId )
476 /// Update position of several entities (for re-spawn, position correction, server resync...)
477 void cbUpdateEntitiesPositionsUsingSize( CMessage& msgin, const string &serviceName, uint16 serviceId )
479 /// Update orientation of several entities
480 void cbUpdateEntitiesOrientationsUsingSize( CMessage& msgin, const string &serviceName, uint16 serviceId )
485 /****************************************************************\
487 \****************************************************************/
488 void cbEntityTeleportation( CMessage
& msgin
, const string
&serviceName
, NLNET::TServiceId serviceId
)
491 NLMISC::TGameCycle tick
;
494 TDataSetRow index
= CWorldPositionManager::getEntityIndex(id
);
496 if (!index
.isValid())
499 // if no position provided, teleport entity to nowhere
500 if (msgin
.getPos() == (sint32
)msgin
.length())
504 // update the entity position in the ring vision universe
505 pCGPMS
->RingVisionUniverse
->setEntityPosition(index
,0,0);
507 // update the player coordinates in the mirror
508 CMirrorPropValue1DS
<sint32
>( TheDataset
, index
, DSPropertyPOSX
)= 0;
509 CMirrorPropValue1DS
<sint32
>( TheDataset
, index
, DSPropertyPOSY
)= 0;
510 CMirrorPropValue1DS
<sint32
>( TheDataset
, index
, DSPropertyPOSZ
)= 0;
514 CWorldPositionManager::teleport(index
, 0, 0, 0, 0.0f
, NO_CONTINENT_INDEX
, 0, CTickEventHandler::getGameCycle());
517 nlinfo("MSG: Teleporting entity %d to continent 0 (0, 0, 0)",index
.getIndex());
521 // entity pos (x, y, z, theta) at tick
531 msgin
.serial( tick
);
533 // use default continent 0
534 uint8 continent
= INVALID_CONTINENT_INDEX
;
535 if (msgin
.getPos() != (sint32
)msgin
.length())
536 msgin
.serial(continent
);
539 if (msgin
.getPos() != (sint32
)msgin
.length())
544 //nlwarning("cbEntityTeleportation(): cell=%d for %s should be zero or negative, forced to 0", cell, id.toString().c_str());
548 uint8 move_to_new_cell
= 0;
549 if (msgin
.getPos() != (sint32
)msgin
.length())
550 msgin
.serial(move_to_new_cell
);
554 // update the ring vision universe position
555 pCGPMS
->RingVisionUniverse
->setEntityPositionDelayed(index
,x
,y
,tick
);
557 // tell the move checker to teleport the entity too
558 pCGPMS
->MoveChecker
->teleport(index
, x
, y
, tick
);
560 // update the player coordinates in the mirror
561 CMirrorPropValue1DS
<sint32
>( TheDataset
, index
, DSPropertyPOSX
)= x
;
562 CMirrorPropValue1DS
<sint32
>( TheDataset
, index
, DSPropertyPOSY
)= y
;
563 CMirrorPropValue1DS
<sint32
>( TheDataset
, index
, DSPropertyPOSZ
)= z
;
564 CMirrorPropValue1DS
<float>( TheDataset
, index
, DSPropertyORIENTATION
)= t
;
568 if (move_to_new_cell
== 1)
570 //nlinfo("MSG: Sliding entity %d to cell %d) at tick: %d",index.getIndex(),cell,tick);
571 CWorldPositionManager::updateEntityPosition(CWorldPositionManager::getEntityPtr(index
), cell
);
575 //nlinfo("MSG: Teleporting entity %d to continent %d cell %d (%d, %d, %d) at tick: %d",index.getIndex(),continent,cell,x,y,z,tick);
576 CWorldPositionManager::teleport(index
, x
, y
, z
, t
, continent
, cell
, tick
);
581 // lock entity after a real teleport
582 CWorldPositionManager::lock(index
, 10);
584 } // cbEntityTeleportation //
587 /****************************************************************\
589 \****************************************************************/
590 void cbEntityPosition( CMessage
& msgin
, const string
&serviceName
, NLNET::TServiceId serviceId
)
593 // sender.serial( msgin );
598 TDataSetRow index
= CWorldPositionManager::getEntityIndex(id
);
600 const CWorldEntity
*pEntity
= CWorldPositionManager::getEntity( index
);
604 CMessage
msgout( "ENTITY_POS" );
606 // msgout.serial( sender );
611 msgout
.serial( val
);
614 msgout
.serial( val
);
617 msgout
.serial( val
);
619 float t
= pEntity
->Theta();
622 sendMessageViaMirror (serviceId
, msgout
);
626 nlwarning("Entity position : entity %s is not in the GPMS", id
.toString().c_str());
629 } // cbEntityPosition //
631 /****************************************************************\
632 Attach child entity to a father
633 \****************************************************************/
634 void cbAttach( NLNET::CMessage
& msgin
, const std::string
&serviceName
, NLNET::TServiceId serviceId
)
636 CEntityId father
, child
;
639 msgin
.serial(father
);
641 msgin
.serial(x
, y
, z
);
643 TDataSetRow indexFather
= CWorldPositionManager::getEntityIndex(father
);
644 TDataSetRow indexChild
= CWorldPositionManager::getEntityIndex(child
);
646 CWorldPositionManager::attach(indexFather
, indexChild
, x
, y
, z
);
649 /****************************************************************\
650 Detach child entity of its current father
651 \****************************************************************/
652 void cbDetach( NLNET::CMessage
& msgin
, const std::string
&serviceName
, NLNET::TServiceId serviceId
)
658 TDataSetRow childIndex
= CWorldPositionManager::getEntityIndex(child
);
660 CWorldPositionManager::detach(childIndex
);
663 /****************************************************************\
664 set player dead status
665 \****************************************************************/
666 void cbSetDeadStatus( NLNET::CMessage
& msgin
, const std::string
&serviceName
, NLNET::TServiceId serviceId
)
671 msgin
.serial(player
);
672 msgin
.serial(status
);
674 TDataSetRow index
= CWorldPositionManager::getEntityIndex(player
);
675 CWorldEntity
*entity
= CWorldPositionManager::getEntityPtr(index
);
676 entity
->Dead
= status
;
678 nlinfo("player status changed to dead");
680 nlinfo("player status changed to alive");
684 /****************************************************************\
686 \****************************************************************/
687 void cbAcquireControl( NLNET::CMessage
& msgin
, const std::string
&serviceName
, NLNET::TServiceId serviceId
)
689 CEntityId slave
, master
;
692 msgin
.serial(slave
, master
);
693 msgin
.serial(x
, y
, z
);
695 TDataSetRow indexSlave
= CWorldPositionManager::getEntityIndex(slave
);
696 TDataSetRow indexMaster
= CWorldPositionManager::getEntityIndex(master
);
698 CWorldPositionManager::acquireControl(indexSlave
, indexMaster
, x
, y
, z
);
702 pCGPMS
->RingVisionUniverse
->setEntityPosition(indexMaster
,x
,y
);
703 pCGPMS
->RingVisionUniverse
->setEntityPosition(indexSlave
,x
,y
);
706 nlinfo("MSG: Master %s acquire control of slave %s at (%d, %d, %d)",master
.toString().c_str(),slave
.toString().c_str(),x
,y
,z
);
711 /****************************************************************\
713 \****************************************************************/
714 void cbLeaveControl( NLNET::CMessage
& msgin
, const std::string
&serviceName
, NLNET::TServiceId serviceId
)
718 msgin
.serial(master
);
720 TDataSetRow indexMaster
= CWorldPositionManager::getEntityIndex(master
);
722 CWorldPositionManager::leaveControl(indexMaster
);
724 nlinfo("MSG: Master %s release control of slave",master
.toString().c_str());
728 /****************************************************************\
729 activate player self slot
730 \****************************************************************/
731 void cbActivateSelf( NLNET::CMessage
& msgin
, const std::string
&serviceName
, NLNET::TServiceId serviceId
)
733 #ifdef HANDLE_SLOT0_SPECIAL
738 TDataSetRow index
= CWorldPositionManager::getEntityIndex(id
);
739 CWorldEntity
*entity
= CWorldPositionManager::getEntityPtr(index
);
740 CWorldPositionManager::activateSelfSlot(entity
);
744 /****************************************************************\
745 desactivate player self slot
746 \****************************************************************/
747 void cbDesactivateSelf( NLNET::CMessage
& msgin
, const std::string
&serviceName
, NLNET::TServiceId serviceId
)
749 #ifdef HANDLE_SLOT0_SPECIAL
754 TDataSetRow index
= CWorldPositionManager::getEntityIndex(id
);
755 CWorldEntity
*entity
= CWorldPositionManager::getEntityPtr(index
);
756 CWorldPositionManager::desactivateSelfSlot(entity
);
760 // The following removed by Sadge because the entity has been removed from the mirror by the time the message arrives,
761 // making it redundant
762 ///****************************************************************\
763 // disable vision processing
764 //\****************************************************************/
765 //void cbDisableVisionProcessing( NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId )
771 // TDataSetRow index = CWorldPositionManager::getEntityIndex(id);
772 // CWorldPositionManager::setPlayerVisionProcessing(index, false);
776 /****************************************************************\
777 Subscribe to a trigger
778 \****************************************************************/
779 void cbTriggerSubscribe( NLNET::CMessage
& msgin
, const std::string
&serviceName
, NLNET::TServiceId serviceId
)
781 while ((uint32
)msgin
.getPos() < msgin
.length())
785 msgin
.serial(name
, id
);
786 CWorldPositionManager::triggerSubscribe(serviceId
, name
, id
);
790 /****************************************************************\
791 Unsubscribe to a trigger
792 \****************************************************************/
793 void cbTriggerUnsubscribe( NLNET::CMessage
& msgin
, const std::string
&serviceName
, NLNET::TServiceId serviceId
)
795 while ((uint32
)msgin
.getPos() < msgin
.length())
799 CWorldPositionManager::triggerUnsubscribe(serviceId
, id
);
804 /****************************************************************\
805 request all entities arround an entity
806 \****************************************************************/
807 void cbEntitiesArroundEntity( NLNET::CMessage
& msgin
, const std::string
&serviceName
, NLNET::TServiceId serviceId
)
809 CEntityId id
; // base entity for decide list of entities arround this
810 list
< string
> propertySubscribe
; // list of properties subscribe
813 msgin
.serialCont( propertySubscribe
);
815 CWorldPositionManager::requestForEntityAround( serviceId
, id
, propertySubscribe
);
817 nlinfo("Service %s asked for local mirror around entity %s",serviceName
.c_str(), id
.toString().c_str() );
820 /****************************************************************\
821 end subscription for all entities arround an entity
822 \****************************************************************/
823 void cbEndEntitiesArroundEntity( NLNET::CMessage
& msgin
, const std::string
&serviceName
, NLNET::TServiceId serviceId
)
825 CEntityId id
; // base entity for decide list of entities arround this
829 CWorldPositionManager::unrequestForEntityAround( serviceId
, id
);
830 nlinfo("Service %s unsubscribe for local mirror around entity %s",serviceName
.c_str(), id
.toString().c_str() );
834 /****************************************************************\
835 ponctual vision request
836 \****************************************************************/
837 void cbVisionRequest( NLNET::CMessage
& msgin
, const std::string
&serviceName
, NLNET::TServiceId serviceId
)
843 msgin
.serial(rid
, x
, y
, range
);
845 static vector
<pair
<CEntityId
, sint32
> > entities
;
849 CWorldPositionManager::visionRequest(x
, y
, range
, entities
);
851 // build vision answer
852 CMessage
msgout("VISION_ANSWER");
855 const uint size
= (uint
)entities
.size();
856 for ( i
= 0 ; i
< size
; ++i
)
857 msgout
.serial(entities
[i
].first
, entities
[i
].second
);
859 // send it to requester
860 sendMessageViaMirror(serviceId
, msgout
);
863 /****************************************************************\
864 ponctual vision request
865 \****************************************************************/
866 void cbR2ForceVisionReset( NLNET::CMessage
& msgin
, const std::string
&serviceName
, NLNET::TServiceId serviceId
)
873 TDataSetRow entityIndex
= TheDataset
.getDataSetRow( eid
);
874 BOMB_IF(!entityIndex
.isValid() , "Try to reset the vision of a invalid player "+eid
.toString(), return);
876 pCGPMS
->RingVisionUniverse
->forceResetVision(entityIndex
);
883 //----------------------------
885 //----------------------------
886 TUnifiedCallbackItem CbGPMSArray
[]=
888 // Callbacks for all service use GPMS
889 //{ "ADD_ENTITY", cbAddEntity }, // create a single entity
890 //{ "ADD_ENTITIES", cbAddEntities }, // create a set of entities
891 //{ "ADD_IA_OBJECT", cbAddIAObject }, // create an object only visible from ia agents
892 //{ "REPLACE_ENTITY", cbReplaceEntity}, // replace an entity by another entity
893 //{ "REMOVE_ENTITY", cbRemoveEntity }, // remove a single entity
894 //{ "REMOVE_ENTITIES", cbRemoveEntities }, // removes a set of entities
895 /*?DEAD?*/ { "BAG", cbBag
}, // updates content of an entity (bag only ?)
897 /*?DEAD?*/ { "LOAD_CONTINENT", cbLoadContinent
}, // load a continent
898 /*?DEAD?*/ { "REMOVE_CONTINENT", cbRemoveContinent
}, // remove a continent
899 { "CREATE_INDOOR_UNIT", cbCreateIndoorUnit
}, // create an indoor unit, for latter teleport
900 /*?DEAD?*/ { "CREATE_BUILDING", cbCreateBuilding
}, // create a dynamic outdoor building
901 /*?DEAD?*/ { "CREATE_OBSTACLE", cbCreateObstacle
}, // create a dynamic obstacle from a pacs_prim file
902 /*?DEAD?*/ { "REMOVE_OBSTACLE", cbRemoveObstacle
}, // remove a dynamic obstacle
903 /*?DEAD?*/ { "SET_OBSTACLE", cbSetObstacle
}, // set dynamic obstacle state
905 /*?DEAD?*/ { "TRIGGER_SUBSCRIBE", cbTriggerSubscribe
},
906 /*?DEAD?*/ { "TRIGGER_UNSUBSCRIBE", cbTriggerUnsubscribe
},
908 //{ "UPDATE_ENTITY_POS", cbUpdateEntityPosition}, // update a single entity position
909 //{ "UPDATE_ENTITIES_POSITIONS", cbUpdateEntitiesPositions}, // update a set of entities positions
910 //{ "UPDATE_ENTITIES_POS", cbUpdateEntitiesPositionsUsingSize }, // update a set of entities positions
911 { "ENTITY_TELEPORTATION", cbEntityTeleportation
}, // teleport a single entity (if no position, remove from cell map)
913 /*?DEAD?*/ { "ATTACH", cbAttach
}, // attach an entity (child) to an another (father) using direct local position
914 /*?DEAD?*/ { "DETACH", cbDetach
}, // detach an entity of its father
915 { "SET_DEAD_STATUS", cbSetDeadStatus
}, // entity acquire control of another entity
916 { "ACQUIRE_CONTROL", cbAcquireControl
}, // entity acquire control of another entity
917 { "LEAVE_CONTROL", cbLeaveControl
}, // entity leave control of another entity
919 /*?DEAD?*/ { "ACTIV_SELF", cbActivateSelf
},
920 /*?DEAD?*/ { "DESACTIV_SELF", cbDesactivateSelf
},
922 // The following removed by Sadge because the entity has been removed from the mirror by the time the message arrives,
923 // making it redundant
924 // / *?DEAD?* / { "DISABLE_VISION_PROC", cbDisableVisionProcessing }, // ask for player vision not to be updated any longer
926 /*?DEAD?*/ { "ENTITY_POS", cbEntityPosition
}, // ask for position of an entity
928 /*?DEAD?*/ { "ASK_VISION_ARROUND_ENTITY", cbEntitiesArroundEntity
}, // ask for vision update around an entity
929 /*?DEAD?*/ { "UNASK_VISION_ARROUND_ENTITY",cbEndEntitiesArroundEntity
}, // remove vision update around an entity
931 /*?DEAD?*/ { "VISION_REQUEST", cbVisionRequest
},
932 { "SET_PLAYER_FLAGS", cbSetPlayerFlags
}, // set flags for player (limit speed, etc)
933 { "R2_VISION_REFRESH", cbR2ForceVisionReset
}, // force the update of the vision (because some message must have been discared in Ring (in edition mode the network is not listen)
938 //-------------------------------------------------------------------------
939 // singleton initialisation and release
941 void CMessages::init()
943 // setup the callback array
944 CUnifiedNetwork::getInstance()->addCallbackArray( CbGPMSArray
, sizeof(CbGPMSArray
)/sizeof(CbGPMSArray
[0]) );
947 void CMessages::release()