summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-06 00:05:32 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-06 00:05:32 +0000
commit9eb2c4a0906be48b60a5bb297abf507e6112c7bc (patch)
treefb6fd0bdbee2aa1721b2195b7a4009a10e2020b1 /crawl-ref
parentde3ab3ce26d65fe03341feda94103982a01d8922 (diff)
downloadcrawl-ref-9eb2c4a0906be48b60a5bb297abf507e6112c7bc.tar.gz
crawl-ref-9eb2c4a0906be48b60a5bb297abf507e6112c7bc.zip
In the interest of efficency only call StashTrack.update_corpses()
when absolutelty necessary, rather than whenever the player isn't delayed. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5493 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/acr.cc6
-rw-r--r--crawl-ref/source/chardump.cc2
-rw-r--r--crawl-ref/source/stash.cc5
3 files changed, 7 insertions, 6 deletions
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc
index c9dcd815d8..969fff663f 100644
--- a/crawl-ref/source/acr.cc
+++ b/crawl-ref/source/acr.cc
@@ -1441,12 +1441,6 @@ static void _input()
_world_reacts();
return;
}
- else
- {
- // Don't do this while delayed, so as to not slow down resting
- // and travel by iterating over all stahses once per player turn.
- StashTrack.update_corpses();
- }
if ( you.turn_is_over )
{
diff --git a/crawl-ref/source/chardump.cc b/crawl-ref/source/chardump.cc
index fd54f88a5b..832ffd76ea 100644
--- a/crawl-ref/source/chardump.cc
+++ b/crawl-ref/source/chardump.cc
@@ -1197,6 +1197,8 @@ static bool write_dump( const std::string &fname, dump_params &par)
file_name += strip_filename_unsafe_chars(fname);
+ StashTrack.update_corpses();
+
std::string stash_file_name;
stash_file_name = file_name;
stash_file_name += ".lst";
diff --git a/crawl-ref/source/stash.cc b/crawl-ref/source/stash.cc
index 694a2996a4..7bfcd18ba8 100644
--- a/crawl-ref/source/stash.cc
+++ b/crawl-ref/source/stash.cc
@@ -615,6 +615,9 @@ void Stash::_update_corpses(long rot_time)
void Stash::add_item(const item_def &item, bool add_to_front)
{
+ if (_is_rottable(item))
+ StashTrack.update_corpses();
+
if (add_to_front)
items.insert(items.begin(), item);
else
@@ -1569,6 +1572,8 @@ void StashTracker::search_stashes()
{
char buf[400];
+ this->update_corpses();
+
stash_search_reader reader(buf, sizeof buf);
bool validline = false;