summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/libutil.h
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-03-11 15:31:45 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-03-11 15:31:45 +0000
commit04ef4ac34d7bbc5358a3adbf542071599e71c515 (patch)
treef1a7f48c32bd700ac49cace190c67b3f5434df7f /crawl-ref/source/libutil.h
parent370f12250ba294042472a110a006769e42f1bff4 (diff)
downloadcrawl-ref-04ef4ac34d7bbc5358a3adbf542071599e71c515.tar.gz
crawl-ref-04ef4ac34d7bbc5358a3adbf542071599e71c515.zip
[1657502] Added use_fake_cursor option to make Crawl draw a cursor for Unix
terminals that cannot draw cursors on black spaces or darkgrey areas. May need some work, since the fake cursor tends to leave artifacts on the scrolling edge. Removed the +1 X offset to the viewport. Fixed crash when monster wielding a weapon of orc slaying hits player (Erik). git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1016 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/libutil.h')
-rw-r--r--crawl-ref/source/libutil.h15
1 files changed, 6 insertions, 9 deletions
diff --git a/crawl-ref/source/libutil.h b/crawl-ref/source/libutil.h
index a84ab5a166..d5b7bf081e 100644
--- a/crawl-ref/source/libutil.h
+++ b/crawl-ref/source/libutil.h
@@ -19,6 +19,8 @@
#include <string>
#include <vector>
+void cursorxy(int x, int y);
+
// Converts a key to a direction key, converting keypad and other sequences
// to vi key sequences (shifted/control key directions are also handled). Non
// direction keys (hopefully) pass through unmangled.
@@ -307,12 +309,8 @@ public:
bool compile() const
{
- // This function is const because compiled_pattern is not really part of
- // the state of the object.
-
- void *&cp = const_cast<text_pattern*>( this )->compiled_pattern;
return !empty()?
- !!(cp = compile_pattern(pattern.c_str(), ignore_case))
+ !!(compiled_pattern = compile_pattern(pattern.c_str(), ignore_case))
: false;
}
@@ -324,8 +322,7 @@ public:
bool valid() const
{
return isvalid &&
- (compiled_pattern ||
- (const_cast<text_pattern*>( this )->isvalid = compile()));
+ (compiled_pattern || (isvalid = compile()));
}
bool matches(const char *s, int length) const
@@ -350,8 +347,8 @@ public:
private:
std::string pattern;
- void *compiled_pattern;
- bool isvalid;
+ mutable void *compiled_pattern;
+ mutable bool isvalid;
bool ignore_case;
};