summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/travel.cc
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-04-11 17:18:15 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-04-11 17:18:15 +0000
commit38ee7a2c66d01a47b69b17e78a477b2f2832b388 (patch)
tree93c9dbe85bc6df72bb3b2ce21fccb3167f717c0a /crawl-ref/source/travel.cc
parent066c6135d4b75050cb29d16465c43daf81e640e0 (diff)
downloadcrawl-ref-38ee7a2c66d01a47b69b17e78a477b2f2832b388.tar.gz
crawl-ref-38ee7a2c66d01a47b69b17e78a477b2f2832b388.zip
Allow waypoints to be deleted (Sigurd).
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1287 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/travel.cc')
-rw-r--r--crawl-ref/source/travel.cc59
1 files changed, 54 insertions, 5 deletions
diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc
index 663a83009c..04a8800126 100644
--- a/crawl-ref/source/travel.cc
+++ b/crawl-ref/source/travel.cc
@@ -3016,6 +3016,44 @@ void TravelCache::update_waypoints() const
}
}
+void TravelCache::delete_waypoint()
+{
+ if (!get_waypoint_count())
+ return;
+
+ while (get_waypoint_count())
+ {
+ mesclr();
+ mpr("Existing waypoints:");
+ list_waypoints();
+ mpr("Delete which waypoint? (* - delete all, Esc - exit) ",
+ MSGCH_PROMPT);
+
+ int key = getch();
+ if (key >= '0' && key <= '9')
+ {
+ key -= '0';
+ if (waypoints[key].is_valid())
+ {
+ waypoints[key].reset();
+ continue;
+ }
+ }
+ else if (key == '*')
+ {
+ for (int i = 0; i < TRAVEL_WAYPOINT_COUNT; ++i)
+ waypoints[i].reset();
+ break;
+ }
+
+ canned_msg(MSG_OK);
+ return;
+ }
+
+ mesclr();
+ mpr("All waypoints deleted. Have a nice day!");
+}
+
void TravelCache::add_waypoint(int x, int y)
{
if (you.level_type == LEVEL_LABYRINTH || you.level_type == LEVEL_ABYSS
@@ -3026,16 +3064,27 @@ void TravelCache::add_waypoint(int x, int y)
}
mesclr();
- if (get_waypoint_count())
+
+ const bool waypoints_exist = get_waypoint_count();
+ if (waypoints_exist)
{
- mpr("Existing waypoints");
+ mpr("Existing waypoints:");
list_waypoints();
}
- mpr("Assign waypoint to what number? (0-9) ", MSGCH_PROMPT);
- int keyin = get_ch();
+ mprf(MSGCH_PROMPT, "Assign waypoint to what number? (0-9%s) ",
+ waypoints_exist? ", D - delete waypoint" : "");
- if (keyin < '0' || keyin > '9') return;
+ int keyin = tolower(get_ch());
+
+ if (waypoints_exist && keyin == 'd')
+ {
+ delete_waypoint();
+ return;
+ }
+
+ if (keyin < '0' || keyin > '9')
+ return;
int waynum = keyin - '0';