summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Cline <zelgadis@sourceforge.net>2009-11-23 00:07:19 -0800
committerMatthew Cline <zelgadis@sourceforge.net>2009-11-23 00:07:19 -0800
commitb71fe38f3c177a6a912b9c80f5c32ae0a85edb75 (patch)
tree1ccc77ee6fbdd93d681b120a6f589ae55ba6690f
parent99426d184cb992f9839f0c17d393c0c188244e45 (diff)
downloadcrawl-ref-b71fe38f3c177a6a912b9c80f5c32ae0a85edb75.tar.gz
crawl-ref-b71fe38f3c177a6a912b9c80f5c32ae0a85edb75.zip
Give "struct dist" a constructor, for initing
Fix Valgrind warnings about uninialized values in the dist struct (now class) by giving it a constrcutor which initializes all values.
-rw-r--r--crawl-ref/source/directn.cc7
-rw-r--r--crawl-ref/source/directn.h6
2 files changed, 12 insertions, 1 deletions
diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc
index 665f41c81b..7545738668 100644
--- a/crawl-ref/source/directn.cc
+++ b/crawl-ref/source/directn.cc
@@ -129,6 +129,13 @@ static void _describe_oos_square(const coord_def& where);
static void _extend_move_to_edge(dist &moves);
static std::string _get_monster_desc(const monsters *mon);
+dist::dist()
+ : isValid(false), isTarget(false), isMe(false), isEndpoint(false),
+ isCancel(true), choseRay(false), target(), delta(), ray(),
+ prev_target(MHITNOT)
+{
+}
+
void direction_choose_compass( dist& moves, targetting_behaviour *beh)
{
moves.isValid = true;
diff --git a/crawl-ref/source/directn.h b/crawl-ref/source/directn.h
index 13b2dd7c60..500b6089cb 100644
--- a/crawl-ref/source/directn.h
+++ b/crawl-ref/source/directn.h
@@ -40,8 +40,12 @@ public:
};
// output from direction() function:
-struct dist
+class dist
{
+public:
+ dist();
+
+public:
bool isValid; // valid target chosen?
bool isTarget; // target (true), or direction (false)?
bool isMe; // selected self (convenience: target == you.pos())