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 NL_VISION_RECEIVER_H
20 #define NL_VISION_RECEIVER_H
22 #include "nel/misc/types_nl.h"
23 #include "game_share/player_vision_delta.h"
24 #include "entity_container.h"
30 * \author Olivier Cado
31 * \author Nevrax France
44 /// Vision management : Get the first modified vision since the last EndUpdatedVision
45 inline TEntityIndex
getFirstUpdatedVision()
47 return( _FirstUpdatedEntityVision
);
50 /// Vision management : Get the next modified vision
51 inline TEntityIndex
getNextUpdatedVision( const TEntityIndex
& entityIndex
)
53 return( TheEntityContainer
->getEntity(entityIndex
)->NextUpdatedEntityVision
);
56 /// Vision management : Allow to loop on vision updates
57 inline bool visionChanged()
59 return _HasPendingDelta
;
62 /// End an updating session
63 void endUpdatedVision();
67 /// Apply a new delta of vision
68 bool setVision( const CPlayerVisionDelta
&visionDelta
);
70 /// UpdateVision, unserial update vision message and process it
71 void updateNewVision( NLNET::CMessage
& msgin
);
73 friend void cbDeltaNewVision( NLNET::CMessage
& msgin
, const std::string
&serviceName
, NLNET::TServiceId serviceId
);
77 TEntityIndex _FirstUpdatedEntityVision
;
79 // Queue to allow merging of several vision updates receives within the same cycle
80 bool _HasPendingDelta
;
81 std::queue
< std::list
<CPlayerVisionDelta
> > _NextDeltas
;
85 // Callback for delta vision update received
86 void cbDeltaNewVision( NLNET::CMessage
& msgin
, const std::string
&serviceName
, NLNET::TServiceId serviceId
);
88 #endif // NL_VISION_RECEIVER_H
90 /* End of vision_receiver.h */