summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/wiz-you.cc
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-08-07 00:00:29 -0400
committerJesse Luehrs <doy@tozt.net>2014-08-07 00:05:14 -0400
commit0abe53da1a5c1c1b834f67354ffc6514a98e7fe8 (patch)
tree749b18cb6734af08a2147fb2ec939369ae763d59 /crawl-ref/source/wiz-you.cc
parent5242a192e5a0ee025abbd3a9dea5eecd70b9af5a (diff)
downloadcrawl-ref-0abe53da1a5c1c1b834f67354ffc6514a98e7fe8.tar.gz
crawl-ref-0abe53da1a5c1c1b834f67354ffc6514a98e7fe8.zip
set species from dump file
Diffstat (limited to 'crawl-ref/source/wiz-you.cc')
-rw-r--r--crawl-ref/source/wiz-you.cc56
1 files changed, 47 insertions, 9 deletions
diff --git a/crawl-ref/source/wiz-you.cc b/crawl-ref/source/wiz-you.cc
index 0f0b9b42ee..b10b599e8f 100644
--- a/crawl-ref/source/wiz-you.cc
+++ b/crawl-ref/source/wiz-you.cc
@@ -51,16 +51,9 @@ static void _swap_equip(equipment_type a, equipment_type b)
you.melded.set(b, tmp);
}
-void wizard_change_species()
+static species_type _find_species(string species)
{
- char specs[80];
-
- msgwin_get_line("What species would you like to be now? " ,
- specs, sizeof(specs));
-
- if (specs[0] == '\0')
- return;
- string spec = lowercase_string(specs);
+ string spec = lowercase_string(species);
species_type sp = SP_UNKNOWN;
@@ -83,6 +76,11 @@ void wizard_change_species()
}
}
+ return sp;
+}
+
+static void _wizard_change_species_to(species_type sp)
+{
// Can't use magic cookies or placeholder species.
if (!is_valid_species(sp))
{
@@ -231,6 +229,21 @@ void wizard_change_species()
#endif
redraw_screen();
}
+
+void wizard_change_species()
+{
+ char specs[80];
+
+ msgwin_get_line("What species would you like to be now? " ,
+ specs, sizeof(specs));
+
+ if (specs[0] == '\0')
+ return;
+
+ species_type sp = _find_species(specs);
+
+ _wizard_change_species_to(sp);
+}
#endif
#ifdef WIZARD
@@ -1132,6 +1145,29 @@ static bool _chardump_check_stats3(const vector<string> &tokens)
return false;
}
+static bool _chardump_check_char(const vector<string> &tokens)
+{
+ size_t size = tokens.size();
+
+ if (size <= 8)
+ return false;
+
+ for (size_t k = 1; k < size; k++)
+ {
+ if (tokens[k] == "Turns:")
+ {
+ string race = tokens[k-2].substr(1);
+ string role = tokens[k-1].substr(0, tokens[k-1].length() - 1);
+
+ _wizard_change_species_to(_find_species(race));
+ // XXX role
+ return true;
+ }
+ }
+
+ return false;
+}
+
static void _wizard_modify_character(string inputdata)
{
vector<string> tokens = split_string(" ", inputdata);
@@ -1144,6 +1180,8 @@ static void _wizard_modify_character(string inputdata)
return;
if (_chardump_check_stats3(tokens))
return;
+ if (_chardump_check_char(tokens))
+ return;
}
/**