summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/godcompanions.cc
diff options
context:
space:
mode:
authorDracoOmega <draco_omega@live.com>2013-03-08 21:38:09 -0330
committerDracoOmega <draco_omega@live.com>2013-03-09 14:38:05 -0330
commit7981c5d0f5da64664260b83d783b75d82cb27af1 (patch)
treea306c6c540e949c1d83edec99ae5c9b957b4511a /crawl-ref/source/godcompanions.cc
parent885b5f1ec66695cd77cf3a71cecef68178d365a6 (diff)
downloadcrawl-ref-7981c5d0f5da64664260b83d783b75d82cb27af1.tar.gz
crawl-ref-7981c5d0f5da64664260b83d783b75d82cb27af1.zip
Add a temporary routine to clean up after some invalid god companions
This should prevent one crash caused by saves containing cloned companions and allow those players to continue their games, but should be unnecessary once all cloning bugs are fully quashed.
Diffstat (limited to 'crawl-ref/source/godcompanions.cc')
-rw-r--r--crawl-ref/source/godcompanions.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/crawl-ref/source/godcompanions.cc b/crawl-ref/source/godcompanions.cc
index 2cd21b7159..8b7efca773 100644
--- a/crawl-ref/source/godcompanions.cc
+++ b/crawl-ref/source/godcompanions.cc
@@ -177,3 +177,20 @@ void wizard_list_companions()
mon->mid, branches[comp->level.branch].abbrevname, comp->level.depth);
}
}
+
+#if TAG_MAJOR_VERSION == 34
+// A temporary routine to clean up some references to invalid companions and
+// prevent crashes on load. Should be unnecessary once the cloning bugs that
+// allow the creation of these invalid companions are fully mopped up
+void fixup_bad_companions()
+{
+ for(map<mid_t, companion>::iterator i = companion_list.begin();
+ i != companion_list.end();)
+ {
+ if (invalid_monster_type(i->second.mons.mons.type))
+ companion_list.erase(i++);
+ else
+ ++i;
+ }
+}
+#endif