summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/overmap.cc1
-rw-r--r--crawl-ref/source/shopping.cc27
-rw-r--r--crawl-ref/source/shopping.h1
-rw-r--r--crawl-ref/source/terrain.cc1
4 files changed, 29 insertions, 1 deletions
diff --git a/crawl-ref/source/overmap.cc b/crawl-ref/source/overmap.cc
index 239c78504d..af6283d96d 100644
--- a/crawl-ref/source/overmap.cc
+++ b/crawl-ref/source/overmap.cc
@@ -606,6 +606,7 @@ static bool _unnotice_stair(const level_pos &pos)
bool unnotice_feature(const level_pos &pos)
{
+ shopping_list.forget_pos(pos);
return (_unnotice_portal(pos)
|| _unnotice_portal_vault(pos)
|| _unnotice_altar(pos)
diff --git a/crawl-ref/source/shopping.cc b/crawl-ref/source/shopping.cc
index 58d3aac0b6..9ae19ef18b 100644
--- a/crawl-ref/source/shopping.cc
+++ b/crawl-ref/source/shopping.cc
@@ -2391,7 +2391,32 @@ int ShoppingList::size() const
void ShoppingList::move_things(const coord_def &src, const coord_def &dst)
{
- ASSERT(false); // Not implemented yet
+ for (unsigned int i = 0; i < list->size(); i++)
+ {
+ CrawlHashTable &thing = (*list)[i];
+ level_pos lpos = ShoppingList::thing_pos(thing);
+
+ if (lpos.id != level_id::current())
+ continue;
+
+ if (lpos.pos == src)
+ {
+ lpos.pos = dst;
+ thing[SHOPPING_THING_POS_KEY] = lpos;
+ }
+ }
+}
+
+void ShoppingList::forget_pos(const level_pos &pos)
+{
+ for (unsigned int i = (list->size() - 1); i>= 0; i--)
+ {
+ const CrawlHashTable &thing = (*list)[i];
+ const level_pos lpos = ShoppingList::thing_pos(thing);
+
+ if (lpos == pos)
+ list->erase(i);
+ }
}
void ShoppingList::gold_changed(int old_amount, int new_amount)
diff --git a/crawl-ref/source/shopping.h b/crawl-ref/source/shopping.h
index cc38e1f8be..0679c194da 100644
--- a/crawl-ref/source/shopping.h
+++ b/crawl-ref/source/shopping.h
@@ -50,6 +50,7 @@ public:
void gold_changed(int old_amount, int new_amount);
void move_things(const coord_def &src, const coord_def &dst);
+ void forget_pos(const level_pos &pos);
void display();
diff --git a/crawl-ref/source/terrain.cc b/crawl-ref/source/terrain.cc
index c583815690..5278fd6b12 100644
--- a/crawl-ref/source/terrain.cc
+++ b/crawl-ref/source/terrain.cc
@@ -632,6 +632,7 @@ static bool _dgn_shift_feature(const coord_def &pos)
env.markers.move(pos, dest);
dungeon_events.move_listeners(pos, dest);
+ shopping_list.move_things(pos, dest);
}
return (true);
}