Changeset 233 for trunk/src/game/GridNotifiers.cpp
- Timestamp:
- 11/19/08 13:49:07 (17 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/game/GridNotifiers.cpp
r221 r233 41 41 iter->getSource()->UpdateVisibilityOf(&i_player); 42 42 i_player.UpdateVisibilityOf(iter->getSource()); 43 if (i_player.isPossessedByPlayer()) 44 ((Player*)i_player.GetCharmer())->UpdateVisibilityOf(iter->getSource()); 43 44 if (!i_player.GetSharedVisionList().empty()) 45 for (SharedVisionList::const_iterator it = i_player.GetSharedVisionList().begin(); it != i_player.GetSharedVisionList().end(); ++it) 46 (*it)->UpdateVisibilityOf(iter->getSource()); 45 47 } 46 48 } … … 149 151 if (!i_dist || iter->getSource()->GetDistance(&i_source) <= i_dist) 150 152 { 151 // Send packet to possessor 152 if (iter->getSource()->isPossessedByPlayer()) 153 SendPacket((Player*)iter->getSource()->GetCharmer()); 153 // Send packet to all who are sharing the player's vision 154 if (!iter->getSource()->GetSharedVisionList().empty()) 155 { 156 SharedVisionList::const_iterator it = iter->getSource()->GetSharedVisionList().begin(); 157 for ( ; it != iter->getSource()->GetSharedVisionList().end(); ++it) 158 SendPacket(*it); 159 } 160 154 161 VisitObject(iter->getSource()); 155 162 } … … 164 171 if (!i_dist || iter->getSource()->GetDistance(&i_source) <= i_dist) 165 172 { 166 // Send packet to possessor 167 if (iter->getSource()->isPossessedByPlayer()) 168 SendPacket((Player*)iter->getSource()->GetCharmer()); 173 // Send packet to all who are sharing the creature's vision 174 if (!iter->getSource()->GetSharedVisionList().empty()) 175 { 176 SharedVisionList::const_iterator it = iter->getSource()->GetSharedVisionList().begin(); 177 for ( ; it != iter->getSource()->GetSharedVisionList().end(); ++it) 178 SendPacket(*it); 179 } 180 } 181 } 182 } 183 184 void 185 Deliverer::Visit(DynamicObjectMapType &m) 186 { 187 for (DynamicObjectMapType::iterator iter = m.begin(); iter != m.end(); ++iter) 188 { 189 if (IS_PLAYER_GUID(iter->getSource()->GetCasterGUID())) 190 { 191 // Send packet back to the caster if the caster has vision of dynamic object 192 Player* caster = (Player*)iter->getSource()->GetCaster(); 193 if (caster->GetUInt64Value(PLAYER_FARSIGHT) == iter->getSource()->GetGUID() && 194 (!i_dist || iter->getSource()->GetDistance(&i_source) <= i_dist)) 195 SendPacket(caster); 169 196 } 170 197 } … … 176 203 if (!plr) 177 204 return; 205 206 // Don't send the packet to self if not supposed to 207 if (!i_toSelf && plr == &i_source) 208 return; 209 178 210 // Don't send the packet to possesor if not supposed to 179 211 if (!i_toPossessor && plr->isPossessing() && plr->GetCharmGUID() == i_source.GetGUID()) … … 191 223 MessageDeliverer::VisitObject(Player* plr) 192 224 { 193 if (i_toSelf || plr != &i_source) 194 SendPacket(plr); 225 SendPacket(plr); 195 226 } 196 227 … … 198 229 MessageDistDeliverer::VisitObject(Player* plr) 199 230 { 200 if( (i_toSelf || plr != &i_source ) && 201 (!i_ownTeamOnly || (i_source.GetTypeId() == TYPEID_PLAYER && plr->GetTeam() == ((Player&)i_source).GetTeam())) ) 231 if( !i_ownTeamOnly || (i_source.GetTypeId() == TYPEID_PLAYER && plr->GetTeam() == ((Player&)i_source).GetTeam()) ) 202 232 { 203 233 SendPacket(plr);