summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/view.cc7
-rw-r--r--crawl-ref/source/view.h12
2 files changed, 14 insertions, 5 deletions
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index 801be16f2a..674b576ec8 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -91,6 +91,13 @@
#define MC_ITEM 0x01
#define MC_MONS 0x02
+// Static class members must be initialized outside of the class declaration,
+// or gcc won't define them in view.o and we'll get a linking error.
+const int monster_los::LSIZE = _monster_los_LSIZE;
+const int monster_los::L_VISIBLE = 1;
+const int monster_los::L_UNKNOWN = 0;
+const int monster_los::L_BLOCKED = -1;
+
static FixedVector<feature_def, NUM_FEATURES> Feature;
crawl_view_geometry crawl_view;
diff --git a/crawl-ref/source/view.h b/crawl-ref/source/view.h
index b2251d13cf..02280e573e 100644
--- a/crawl-ref/source/view.h
+++ b/crawl-ref/source/view.h
@@ -244,6 +244,8 @@ unsigned short dos_brand( unsigned short colour,
unsigned brand = CHATTR_REVERSE);
#endif
+#define _monster_los_LSIZE (2 * LOS_RADIUS + 1)
+
// This class can be used to fill the entire surroundings (los_range)
// of a monster or other position with seen/unseen values, so as to be able
// to compare several positions within this range.
@@ -273,11 +275,11 @@ protected:
void check_los_beam(int dx, int dy);
// The (fixed) size of the array.
- static const int LSIZE = 2 * LOS_RADIUS + 1;
+ static const int LSIZE;
- static const int L_VISIBLE = 1;
- static const int L_UNKNOWN = 0;
- static const int L_BLOCKED = -1;
+ static const int L_VISIBLE;
+ static const int L_UNKNOWN;
+ static const int L_BLOCKED;
// The centre of our los field.
int gridx, gridy;
@@ -292,7 +294,7 @@ protected:
int range;
// The array to store the LOS values.
- int los_field[LSIZE][LSIZE];
+ int los_field[_monster_los_LSIZE][_monster_los_LSIZE];
};
#endif