OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4Player.cpp File Reference
Include dependency graph for C4Player.cpp:

Go to the source code of this file.

Functions

int VisibilityCheck (int iVis, int sx, int sy, int cx, int cy)
 

Variables

int igOffX
 
int igOffY
 

Function Documentation

int VisibilityCheck ( int  iVis,
int  sx,
int  sy,
int  cx,
int  cy 
)

Definition at line 1450 of file C4Player.cpp.

References Abs(), GBackSolid(), igOffX, and igOffY.

1451 {
1452  sx -= igOffX; sy -= igOffY; cx -= igOffX; cy -= igOffY;
1453  int st = std::max(1, std::max(Abs(sx - cx), Abs(sy - cy)));
1454  for (int i = 0; i <= st; i++)
1455  {
1456  int x = (sx * (st - i) + cx * i) / st, y = (sy * (st - i) + cy * i) / st;
1457  if (GBackSolid(x, y))
1458  {
1459  if ((iVis -= 2) <= 0)
1460  return 0;
1461  }
1462  }
1463  return iVis;
1464 }
int igOffX
Definition: C4Player.cpp:1448
T Abs(T val)
Definition: Standard.h:42
int igOffY
Definition: C4Player.cpp:1448
bool GBackSolid(int32_t x, int32_t y)
Definition: C4Landscape.h:231

Here is the call graph for this function:

Variable Documentation

int igOffX

Definition at line 1448 of file C4Player.cpp.

Referenced by VisibilityCheck().

int igOffY

Definition at line 1448 of file C4Player.cpp.

Referenced by VisibilityCheck().