diff options
Diffstat (limited to 'crawl-ref/source/externs.h')
-rw-r--r-- | crawl-ref/source/externs.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h index cf2b98d8d0..1c3a962d5d 100644 --- a/crawl-ref/source/externs.h +++ b/crawl-ref/source/externs.h @@ -92,6 +92,11 @@ class KillMaster; class ghost_demon; struct glyph; +template <typename Z> inline Z sgn(Z x) +{ + return (x < 0 ? -1 : (x > 0 ? 1 : 0)); +} + struct coord_def { int x; @@ -215,6 +220,11 @@ struct coord_def return (copy *= mul); } + coord_def sgn() const + { + return coord_def(::sgn(x), ::sgn(y)); + } + int abs() const { return (x * x + y * y); @@ -536,6 +546,9 @@ public: // Returns true if this item should be preserved as far as possible. bool is_critical() const; + // Returns true if this item should not normally be enchanted. + bool is_mundane() const; + private: std::string name_aux(description_level_type desc, bool terse, bool ident, |