From 0abe53da1a5c1c1b834f67354ffc6514a98e7fe8 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Thu, 7 Aug 2014 00:00:29 -0400 Subject: set species from dump file --- crawl-ref/source/wiz-you.cc | 56 +++++++++++++++++++++++++++++++++++++-------- 1 file 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 &tokens) return false; } +static bool _chardump_check_char(const vector &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 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; } /** -- cgit v1.2.3-54-g00ecf