summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2011-10-04 14:28:00 +0200
committerAdam Borowski <kilobyte@angband.pl>2011-10-04 15:27:12 +0200
commit8853420b21448eda2235ae8f0b10e9f629013caa (patch)
tree801aeb67d74f0e4b8efc70dfb61f399a24e90b13
parent56bc8b5a0496afbf58f32a44307ea19d9b50cb47 (diff)
downloadcrawl-ref-8853420b21448eda2235ae8f0b10e9f629013caa.tar.gz
crawl-ref-8853420b21448eda2235ae8f0b10e9f629013caa.zip
Adjust saves from before the food reform.
-rw-r--r--crawl-ref/source/mutation.cc17
-rw-r--r--crawl-ref/source/mutation.h1
-rw-r--r--crawl-ref/source/tag-version.h1
-rw-r--r--crawl-ref/source/tags.cc17
4 files changed, 36 insertions, 0 deletions
diff --git a/crawl-ref/source/mutation.cc b/crawl-ref/source/mutation.cc
index a7f0931a7a..587dd1f836 100644
--- a/crawl-ref/source/mutation.cc
+++ b/crawl-ref/source/mutation.cc
@@ -1841,6 +1841,23 @@ void roll_demonspawn_mutations()
_select_ds_mutations()));
}
+void adjust_racial_mutation(mutation_type mut, int diff)
+{
+ if (diff < 0)
+ {
+ you.mutation[mut] = std::max(you.mutation[mut] + diff, 0);
+ you.innate_mutations[mut] = std::max(you.innate_mutations[mut] + diff, 0);
+ }
+ else
+ {
+ const mutation_def& mdef = get_mutation_def(mut);
+ you.mutation[mut] = std::min<int>(you.mutation[mut] + diff,
+ mdef.levels);
+ you.innate_mutations[mut] = std::min<int>(you.innate_mutations[mut] + diff,
+ mdef.levels);
+ }
+}
+
bool perma_mutate(mutation_type which_mut, int how_much)
{
ASSERT(is_valid_mutation(which_mut));
diff --git a/crawl-ref/source/mutation.h b/crawl-ref/source/mutation.h
index 30f4861d58..46dd0b84c1 100644
--- a/crawl-ref/source/mutation.h
+++ b/crawl-ref/source/mutation.h
@@ -84,6 +84,7 @@ std::string mutation_name(mutation_type which_mutat, int level = -1,
bool colour = false);
void roll_demonspawn_mutations();
+void adjust_racial_mutation(mutation_type mut, int diff);
bool perma_mutate(mutation_type which_mut, int how_much);
int how_mutated(bool all = false, bool levels = false);
diff --git a/crawl-ref/source/tag-version.h b/crawl-ref/source/tag-version.h
index ce2dd143c3..0677187588 100644
--- a/crawl-ref/source/tag-version.h
+++ b/crawl-ref/source/tag-version.h
@@ -55,6 +55,7 @@ enum tag_minor_version
TAG_MINOR_UNPONDERIFY, // Give Cheibriadites back their old gear.
TAG_MINOR_SKILL_RESTRICTIONS, // Add restrictions to which skills can be trained.
TAG_MINOR_NUM_LEVEL_CONN, // Fix level connectivity data hard-coding NUM_BRANCHES.
+ TAG_MINOR_FOOD_MUTATIONS, // Food reform racial mutation upgrades.
NUM_TAG_MINORS,
TAG_MINOR_VERSION = NUM_TAG_MINORS - 1
diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc
index 9ad52d9f21..ec7c1f294f 100644
--- a/crawl-ref/source/tags.cc
+++ b/crawl-ref/source/tags.cc
@@ -50,6 +50,7 @@
#include "mon-info.h"
#include "mon-util.h"
#include "mon-transit.h"
+#include "mutation.h"
#include "quiver.h"
#include "religion.h"
#include "skills.h"
@@ -2107,6 +2108,22 @@ static void tag_read_you(reader &th)
you.innate_mutations[MUT_FRAIL] = 0;
you.innate_mutations[MUT_ROBUST] = 0;
}
+ if (th.getMinorVersion() < TAG_MINOR_FOOD_MUTATIONS)
+ {
+ switch (you.species)
+ {
+ case SP_OGRE:
+ adjust_racial_mutation(MUT_SAPROVOROUS, -1);
+ adjust_racial_mutation(MUT_CARNIVOROUS, 1);
+ break;
+ case SP_CENTAUR:
+ adjust_racial_mutation(MUT_FAST_METABOLISM, -1);
+ adjust_racial_mutation(MUT_HERBIVOROUS, 1);
+ break;
+ default:
+ break;
+ }
+ }
#endif
count = unmarshallByte(th);