Pol  Revision:50b1c95
realmlos2.cpp
Go to the documentation of this file.
1 
7 #include "realm.h"
8 
9 #include "../los.h"
10 #include "../mobile/charactr.h"
11 
12 namespace Pol
13 {
14 namespace Realms
15 {
16 bool Realm::has_los( const Core::UObject& iatt, const Core::UObject& itgt ) const
17 {
18  if ( iatt.realm != itgt.realm )
19  return false;
20  if ( iatt.isa( Core::UObject::CLASS_CHARACTER ) )
21  {
22  const Mobile::Character& chr = static_cast<const Mobile::Character&>( iatt );
23  if ( chr.ignores_line_of_sight() )
24  return true;
25  }
26 
27  Core::LosObj att( iatt );
28  Core::LosObj tgt( itgt );
29  return has_los( att, tgt );
30 }
31 
32 bool Realm::has_los( const Mobile::Character& iatt, const Core::UObject& itgt ) const
33 {
34  bool remote;
35  Items::Item* remote_container = iatt.search_remote_containers( itgt.serial, &remote );
36  if ( ( remote_container != NULL ) && remote )
37  return true;
38  if ( iatt.realm != itgt.realm )
39  return false;
40  if ( iatt.ignores_line_of_sight() )
41  return true;
42 
43  Core::LosObj att( iatt );
44  Core::LosObj tgt( itgt );
45  return has_los( att, tgt );
46 }
47 }
48 }
bool isa(UOBJ_CLASS uobj_class) const
Definition: uobject.h:407
bool has_los(const Core::LosObj &att, const Core::LosObj &tgt) const
Definition: realmlos.cpp:162
Realms::Realm * realm
Definition: uobject.h:346
Items::Item * search_remote_containers(u32 find_serial, bool *isRemoteContainer) const
Definition: charactr.cpp:4174
bool ignores_line_of_sight() const
Definition: charactr.h:1002
Definition: berror.cpp:11