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 "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());
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
);
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() );
71 const std::vector
< TDataSetRow
>::const_iterator itEntitiesEnd
= Entities
.end();
73 for (itEntities
= Entities
.begin() ; itEntities
!= itEntitiesEnd
; ++itEntities
)
75 CEffectManager::removeEffect( *itEntities
, *itEffectId
);
79 } // CRemoveEffectsMessage::callback //