Resolve "Toggle Free Look with Hotkey"
[ryzomcore.git] / ryzom / server / src / server_share / effect_message.cpp
blobbbd20d22e661bff21183511d647d49f004eeb9b6
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
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.
8 //
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 #include "stdpch.h"
20 #include "effect_message.h"
21 #include "effect_manager.h"
25 //--------------------------------------------------------------
26 // CAddEffectsMessage::callback()
27 //--------------------------------------------------------------
28 void CAddEffectsMessage::callback(const std::string &name, NLNET::TServiceId sid)
30 std::vector< TDataSetRow >::const_iterator itEntities;
31 std::vector< uint32 >::const_iterator itEffectId = EffectIds.begin();
32 std::vector< uint16 >::const_iterator itFamilies = Families.begin();
33 std::vector< TDataSetRow >::const_iterator itCreators = Creators.begin();
35 if ( Entities.size() != EffectIds.size() || EffectIds.size() != Families.size() || Creators.size() != EffectIds.size() )
37 nlwarning("<CAddEffectsMessage::callback> ERROR : different size for the vectors (%u entities), (%u effects), (%u families)",Entities.size(), EffectIds.size(), Families.size());
38 return;
41 const std::vector< TDataSetRow >::const_iterator itEntitiesEnd = Entities.end();
43 for (itEntities = Entities.begin() ; itEntities != itEntitiesEnd ; ++itEntities )
45 CBasicEffect effect( (EFFECT_FAMILIES::TEffectFamily) (*itFamilies), *itCreators ,*itEntities ,*itEffectId);
46 CEffectManager::addEffect( *itEntities, effect );
48 ++itEffectId;
49 ++itFamilies;
50 ++itCreators;
53 } // CAddEffectsMessage::callback //
57 //--------------------------------------------------------------
58 // CRemoveEffectsMessage::callback()
59 //--------------------------------------------------------------
60 void CRemoveEffectsMessage::callback(const std::string &name, NLNET::TServiceId sid)
62 std::vector< TDataSetRow >::const_iterator itEntities;
63 std::vector< uint32 >::const_iterator itEffectId = EffectIds.begin();
65 if ( Entities.size() != EffectIds.size() )
67 nlwarning("<CRemoveEffectsMessage::callback> ERROR : different size for the vectors (%u entities), (%u effects id)",Entities.size(), EffectIds.size() );
68 return;
71 const std::vector< TDataSetRow >::const_iterator itEntitiesEnd = Entities.end();
73 for (itEntities = Entities.begin() ; itEntities != itEntitiesEnd ; ++itEntities )
75 CEffectManager::removeEffect( *itEntities, *itEffectId );
77 ++itEffectId;
79 } // CRemoveEffectsMessage::callback //