summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-03-02 22:28:28 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-03-02 22:28:28 +0000
commit5893e7732cde719d06f519ba558de2f83a201f84 (patch)
tree28783d742ce55b614d8a19a6ab65133c5fe1220d /crawl-ref/source
parente3f71724819986ab6f4999cf728590bb7224ad61 (diff)
downloadcrawl-ref-5893e7732cde719d06f519ba558de2f83a201f84.tar.gz
crawl-ref-5893e7732cde719d06f519ba558de2f83a201f84.zip
Make Options.race and Options.class translate correctly, no matter whether
the old or new species/classes order is used. Entails some more unborking of newgame.cc. Also: make Esc leave the species selection screen (synonym for 'X', quit the game), and use it to jump back to species selection from all other selection possibilities (class, book, weapon, god) as a synonym for Bksp. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3505 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/clua.cc1
-rw-r--r--crawl-ref/source/debug.cc1
-rw-r--r--crawl-ref/source/describe.cc1
-rw-r--r--crawl-ref/source/hiscores.cc1
-rw-r--r--crawl-ref/source/initfile.cc8
-rw-r--r--crawl-ref/source/libgui.cc1
-rw-r--r--crawl-ref/source/monspeak.cc1
-rw-r--r--crawl-ref/source/newgame.cc489
-rw-r--r--crawl-ref/source/newgame.h13
-rw-r--r--crawl-ref/source/output.cc1
-rw-r--r--crawl-ref/source/player.cc149
-rw-r--r--crawl-ref/source/player.h13
-rw-r--r--crawl-ref/source/view.cc1
13 files changed, 367 insertions, 313 deletions
diff --git a/crawl-ref/source/clua.cc b/crawl-ref/source/clua.cc
index 85fca69605..6c4eb6834b 100644
--- a/crawl-ref/source/clua.cc
+++ b/crawl-ref/source/clua.cc
@@ -27,6 +27,7 @@
#include "mapdef.h"
#include "message.h"
#include "mon-util.h"
+#include "newgame.h"
#include "output.h"
#include "player.h"
#include "randart.h"
diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc
index 944e479159..8fdbb4b56e 100644
--- a/crawl-ref/source/debug.cc
+++ b/crawl-ref/source/debug.cc
@@ -75,6 +75,7 @@
#include "monstuff.h"
#include "mon-util.h"
#include "mutation.h"
+#include "newgame.h"
#include "ouch.h"
#include "place.h"
#include "player.h"
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc
index d485075117..beaba54c7b 100644
--- a/crawl-ref/source/describe.cc
+++ b/crawl-ref/source/describe.cc
@@ -49,6 +49,7 @@
#include "message.h"
#include "monstuff.h"
#include "mon-util.h"
+#include "newgame.h"
#include "player.h"
#include "randart.h"
#include "religion.h"
diff --git a/crawl-ref/source/hiscores.cc b/crawl-ref/source/hiscores.cc
index 3059888a16..db21884def 100644
--- a/crawl-ref/source/hiscores.cc
+++ b/crawl-ref/source/hiscores.cc
@@ -48,6 +48,7 @@
#include "libutil.h"
#include "message.h"
#include "mon-util.h"
+#include "newgame.h"
#include "ouch.h"
#include "place.h"
#include "player.h"
diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc
index c69350eed8..0e6e1f2d85 100644
--- a/crawl-ref/source/initfile.cc
+++ b/crawl-ref/source/initfile.cc
@@ -38,6 +38,7 @@
#include "libutil.h"
#include "message.h"
#include "mon-util.h"
+#include "newgame.h"
#include "player.h"
#include "religion.h"
#include "stash.h"
@@ -331,12 +332,7 @@ static char str_to_race( const std::string &str )
if (index == -1)
index = get_species_index_by_name( str.c_str() );
- // skip over the extra draconians here
- if (index > SP_RED_DRACONIAN)
- index -= (SP_CENTAUR - SP_RED_DRACONIAN - 1);
-
- // SP_HUMAN is at 1, therefore we must subtract one.
- return ((index != -1) ? index_to_letter( index - 1 ) : 0);
+ return ((index != -1) ? index_to_letter( index ) : 0);
}
static int str_to_class( const std::string &str )
diff --git a/crawl-ref/source/libgui.cc b/crawl-ref/source/libgui.cc
index 9a1aa7a396..f0213fa513 100644
--- a/crawl-ref/source/libgui.cc
+++ b/crawl-ref/source/libgui.cc
@@ -26,6 +26,7 @@
#include "guic.h"
#include "message.h"
#include "mon-util.h"
+#include "newgame.h"
#include "player.h"
#include "stash.h"
#include "state.h"
diff --git a/crawl-ref/source/monspeak.cc b/crawl-ref/source/monspeak.cc
index 2b7e403e79..b9275036b5 100644
--- a/crawl-ref/source/monspeak.cc
+++ b/crawl-ref/source/monspeak.cc
@@ -34,6 +34,7 @@
#include "monstuff.h"
#include "mon-util.h"
#include "mstuff2.h"
+#include "newgame.h"
#include "player.h"
#include "spells2.h"
#include "spells4.h"
diff --git a/crawl-ref/source/newgame.cc b/crawl-ref/source/newgame.cc
index 86570b19eb..c55ae53353 100644
--- a/crawl-ref/source/newgame.cc
+++ b/crawl-ref/source/newgame.cc
@@ -253,6 +253,150 @@ static job_type get_class(const int index)
: new_jobs_order[index]);
}
+static const char * Species_Abbrev_List[ NUM_SPECIES ] =
+ { "XX", "Hu", "HE", "GE", "DE", "SE", "MD", "Ha",
+ "HO", "Ko", "Mu", "Na", "Gn", "Og", "Tr", "OM",
+ // the draconians
+ "Dr", "Dr", "Dr", "Dr", "Dr", "Dr", "Dr", "Dr", "Dr", "Dr",
+ "Ce", "DG", "Sp", "Mi", "DS", "Gh", "Ke", "Mf", "Vp",
+ // placeholders
+ "HD", "El" };
+
+int get_species_index_by_abbrev( const char *abbrev )
+{
+ COMPILE_CHECK(ARRAYSIZE(Species_Abbrev_List) == NUM_SPECIES, c1);
+
+ for (unsigned i = 0; i < ARRAYSIZE(old_species_order); i++)
+ {
+ const int sp = (Options.use_old_selection_order ? old_species_order[i]
+ : new_species_order[i]);
+
+ if (tolower( abbrev[0] ) == tolower( Species_Abbrev_List[sp][0] )
+ && tolower( abbrev[1] ) == tolower( Species_Abbrev_List[sp][1] ))
+ {
+ return i;
+ }
+ }
+
+ return (-1);
+}
+
+int get_species_index_by_name( const char *name )
+{
+ unsigned int i;
+ int sp = -1;
+
+ std::string::size_type pos = std::string::npos;
+ char lowered_buff[80];
+
+ strncpy( lowered_buff, name, sizeof( lowered_buff ) );
+ strlwr( lowered_buff );
+
+ for (i = 0; i < ARRAYSIZE(old_species_order); i++)
+ {
+ const species_type real_sp
+ = (Options.use_old_selection_order ? old_species_order[i]
+ : new_species_order[i]);
+
+ const std::string lowered_species =
+ lowercase_string(species_name(real_sp,1));
+ pos = lowered_species.find( lowered_buff );
+ if (pos != std::string::npos)
+ {
+ sp = i;
+ if (pos == 0) // prefix takes preference
+ break;
+ }
+ }
+
+ return (sp);
+}
+
+const char *get_species_abbrev( int which_species )
+{
+ ASSERT( which_species > 0 && which_species < NUM_SPECIES );
+
+ return (Species_Abbrev_List[ which_species ]);
+}
+
+static const char * Class_Abbrev_List[ NUM_JOBS ] =
+ { "Fi", "Wz", "Pr", "Th", "Gl", "Ne", "Pa", "As", "Be", "Hu",
+ "Cj", "En", "FE", "IE", "Su", "AE", "EE", "Cr", "DK", "VM",
+ "CK", "Tm", "He", "Re", "St", "Mo", "Wr", "Wn" };
+
+static const char * Class_Name_List[ NUM_JOBS ] =
+ { "Fighter", "Wizard", "Priest", "Thief", "Gladiator", "Necromancer",
+ "Paladin", "Assassin", "Berserker", "Hunter", "Conjurer", "Enchanter",
+ "Fire Elementalist", "Ice Elementalist", "Summoner", "Air Elementalist",
+ "Earth Elementalist", "Crusader", "Death Knight", "Venom Mage",
+ "Chaos Knight", "Transmuter", "Healer", "Reaver", "Stalker",
+ "Monk", "Warper", "Wanderer" };
+
+int get_class_index_by_abbrev( const char *abbrev )
+{
+ COMPILE_CHECK(ARRAYSIZE(Class_Abbrev_List) == NUM_JOBS, c1);
+ COMPILE_CHECK(ARRAYSIZE(Class_Name_List) == NUM_JOBS, c2);
+
+ for (unsigned int i = 0; i < ARRAYSIZE(old_jobs_order); i++)
+ {
+ const job_type job
+ = (Options.use_old_selection_order ? old_jobs_order[i]
+ : new_jobs_order[i]);
+
+ if (tolower( abbrev[0] ) == tolower( Class_Abbrev_List[job][0] )
+ && tolower( abbrev[1] ) == tolower( Class_Abbrev_List[job][1] ))
+ {
+ return i;
+ }
+ }
+
+ return (-1);
+}
+
+const char *get_class_abbrev( int which_job )
+{
+ ASSERT( which_job < NUM_JOBS );
+
+ return (Class_Abbrev_List[ which_job ]);
+}
+
+int get_class_index_by_name( const char *name )
+{
+ char *ptr;
+ char lowered_buff[80];
+ char lowered_class[80];
+
+ strncpy( lowered_buff, name, sizeof( lowered_buff ) );
+ strlwr( lowered_buff );
+
+ int cl = -1;
+ for (unsigned int i = 0; i < ARRAYSIZE(old_jobs_order); i++)
+ {
+ const int job = (Options.use_old_selection_order ? old_jobs_order[i]
+ : new_jobs_order[i]);
+
+ strncpy( lowered_class, Class_Name_List[job], sizeof( lowered_class ) );
+ strlwr( lowered_class );
+
+ ptr = strstr( lowered_class, lowered_buff );
+ if (ptr != NULL)
+ {
+ cl = i;
+ if (ptr == lowered_class) // prefix takes preference
+ break;
+ }
+ }
+
+ return (cl);
+}
+
+const char *get_class_name( int which_job )
+{
+ ASSERT( which_job < NUM_JOBS );
+
+ return (Class_Name_List[ which_job ]);
+}
+
static void reset_newgame_options(void)
{
ng_race = ng_cls = 0;
@@ -1641,9 +1785,9 @@ static bool choose_book( item_def& book, int firstbook, int numbooks )
int keyin = 0;
clrscr();
book.base_type = OBJ_BOOKS;
- book.quantity = 1;
- book.plus = 0;
- book.special = 1;
+ book.quantity = 1;
+ book.plus = 0;
+ book.special = 1;
// using the fact that CONJ_I and MINOR_MAGIC_I are both
// fire books, CONJ_II and MINOR_MAGIC_II are both ice books
@@ -1693,25 +1837,29 @@ static bool choose_book( item_def& book, int firstbook, int numbooks )
keyin = c_getch();
- if (keyin == CK_BKSP || keyin == ' ')
- return false;
- if (keyin == 'X')
+ switch (keyin)
{
+ case 'X':
cprintf(EOL "Goodbye!");
end(0);
+ break;
+ case CK_BKSP:
+ case ESCAPE:
+ case ' ':
+ return false;
+ case '\r':
+ case '\n':
+ if ( Options.prev_book != SBT_NO_SELECTION )
+ {
+ if ( Options.prev_book == SBT_RANDOM )
+ keyin = '*';
+ else
+ keyin = ('a' + Options.prev_book - 1);
+ }
+ default:
+ break;
}
- } while (keyin != '*' &&
- ((keyin != '\r' && keyin != '\n') ||
- Options.prev_book == SBT_NO_SELECTION ) &&
- (keyin < 'a' || keyin >= ('a' + numbooks)));
-
- if ( keyin == '\r' || keyin == '\n' )
- {
- if ( Options.prev_book == SBT_RANDOM )
- keyin = '*';
- else
- keyin = ('a' + Options.prev_book - 1);
- }
+ } while (keyin != '*' && (keyin < 'a' || keyin >= ('a' + numbooks)));
}
if (Options.random_pick || Options.book == SBT_RANDOM || keyin == '*')
@@ -1726,7 +1874,6 @@ static bool choose_book( item_def& book, int firstbook, int numbooks )
return true;
}
-
static bool choose_weapon()
{
const weapon_type startwep[5] = { WPN_SHORT_SWORD, WPN_MACE,
@@ -1791,31 +1938,33 @@ static bool choose_weapon()
keyin = c_getch();
- if (keyin == CK_BKSP || keyin == ' ')
- return false;
-
- if (keyin == 'X')
+ switch (keyin)
{
+ case 'X':
cprintf(EOL "Goodbye!");
end(0);
- }
+ break;
+ case CK_BKSP:
+ case CK_ESCAPE:
+ case ' ':
+ return false;
+ case '\r':
+ case '\n':
+ if (Options.prev_weapon != WPN_UNKNOWN)
+ {
+ if (Options.prev_weapon == WPN_RANDOM)
+ keyin = '*';
+ else
+ {
+ for (int i = 0; i < num_choices; ++i)
+ if (startwep[i] == Options.prev_weapon)
+ keyin = 'a' + i;
+ }
+ }
+ }
}
- while (keyin != '*' &&
- ((keyin != '\r' && keyin != '\n')
- || Options.prev_weapon == WPN_UNKNOWN) &&
- (keyin < 'a' || keyin > ('a' + num_choices)));
+ while (keyin != '*' && (keyin < 'a' || keyin > ('a' + num_choices)));
- if (keyin == '\r' || keyin == '\n')
- {
- if (Options.prev_weapon == WPN_RANDOM)
- keyin = '*';
- else
- {
- for (int i = 0; i < num_choices; ++i)
- if (startwep[i] == Options.prev_weapon)
- keyin = 'a' + i;
- }
- }
if (keyin != '*' && effective_stat_bonus(startwep[keyin-'a']) > -4)
{
@@ -1836,12 +1985,14 @@ static bool choose_weapon()
break;
}
keyin += 'a';
+ ng_weapon = WPN_RANDOM;
+ }
+ else
+ {
+ ng_weapon = startwep[keyin-'a'];
}
you.inv[0].sub_type = startwep[keyin-'a'];
- ng_weapon = (Options.random_pick || Options.weapon == WPN_RANDOM
- || keyin == '*') ? WPN_RANDOM
- : you.inv[0].sub_type;
return true;
}
@@ -2215,14 +2366,18 @@ static void show_name_prompt(int where, bool blankOK,
if (blankOK)
{
if (Options.prev_name.length() && Options.remember_name)
+ {
cprintf(EOL
"Press <Enter> for \"%s\", or . to be prompted later."
EOL,
Options.prev_name.c_str());
+ }
else
+ {
cprintf(EOL
"Press <Enter> to answer this after race and "
"class are chosen." EOL);
+ }
}
cprintf(EOL "What is your name today? ");
@@ -2998,6 +3153,7 @@ spec_query:
switch (keyn)
{
case 'X':
+ case ESCAPE:
cprintf(EOL "Goodbye!");
end(0);
break;
@@ -3228,8 +3384,8 @@ job_query:
cprintf(EOL "Goodbye!");
end(0);
break;
- case ESCAPE:
case CK_BKSP:
+ case ESCAPE:
case ' ':
if (keyn != ' ' || you.species == SP_UNKNOWN)
{
@@ -3556,50 +3712,68 @@ bool give_items_skills()
"Random");
}
- getkey:
- keyn = c_getch();
+ do {
+ keyn = c_getch();
- if ((keyn == '\r' || keyn == '\n')
- && Options.prev_pr != GOD_NO_GOD)
- {
- keyn = Options.prev_pr == GOD_ZIN? 'a' :
- Options.prev_pr == GOD_YREDELEMNUL? 'b' :
- Options.prev_pr == GOD_BEOGH? 'c' :
- '*';
+ if ((keyn == '\r' || keyn == '\n')
+ && Options.prev_pr != GOD_NO_GOD)
+ {
+ keyn = Options.prev_pr == GOD_ZIN? 'a' :
+ Options.prev_pr == GOD_YREDELEMNUL? 'b' :
+ Options.prev_pr == GOD_BEOGH? 'c' :
+ '*';
- }
+ }
- switch (keyn)
- {
- case CK_BKSP:
- case ' ':
- return false;
- case 'X':
- cprintf(EOL "Goodbye!");
- end(0);
- break;
- case '*':
- you.religion = coinflip()? GOD_ZIN : GOD_YREDELEMNUL;
- if (you.species == SP_HILL_ORC && coinflip())
- you.religion = GOD_BEOGH;
- break;
- case 'a':
- you.religion = GOD_ZIN;
- break;
- case 'b':
- you.religion = GOD_YREDELEMNUL;
- break;
- case 'c':
- if (you.species == SP_HILL_ORC)
+ switch (keyn)
{
- you.religion = GOD_BEOGH;
+ case 'X':
+ cprintf(EOL "Goodbye!");
+ end(0);
break;
- } // else fall through
- default:
- goto getkey;
- }
-
- ng_pr = keyn == '*'? GOD_RANDOM : you.religion;
+ case CK_BKSP:
+ case ESCAPE:
+ case ' ':
+ return false;
+ case '\r':
+ case '\n':
+ if (Options.prev_pr == GOD_NO_GOD
+ || Options.prev_pr == GOD_BEOGH
+ && you.species != SP_HILL_ORC)
+ {
+ break;
+ }
+ if (Options.prev_pr != GOD_RANDOM)
+ {
+ Options.prev_pr
+ = static_cast<god_type>(Options.prev_pr);
+ break;
+ }
+ keyn = '*'; // for ng_pr setting
+ // fall-through for random
+ case '*':
+ you.religion = coinflip()? GOD_ZIN : GOD_YREDELEMNUL;
+ if (you.species == SP_HILL_ORC && coinflip())
+ you.religion = GOD_BEOGH;
+ break;
+ case 'a':
+ you.religion = GOD_ZIN;
+ break;
+ case 'b':
+ you.religion = GOD_YREDELEMNUL;
+ break;
+ case 'c':
+ if (you.species == SP_HILL_ORC)
+ {
+ you.religion = GOD_BEOGH;
+ break;
+ } // else fall through
+ default:
+ break;
+ }
+ } while (you.religion == GOD_NO_GOD);
+
+ ng_pr = (keyn == '*'? GOD_RANDOM : you.religion);
}
}
break;
@@ -4147,41 +4321,46 @@ bool give_items_skills()
"Random");
}
- getkey1:
- keyn = c_getch();
-
- if ((keyn == '\r' || keyn == '\n')
- && Options.prev_dk != DK_NO_SELECTION)
- {
- keyn = Options.prev_dk == DK_NECROMANCY? 'a' :
- Options.prev_dk == DK_YREDELEMNUL? 'b' :
- '*';
- }
+ do {
+ keyn = c_getch();
- switch (keyn)
- {
- case CK_BKSP:
- case ' ':
- return false;
- case 'X':
- cprintf(EOL "Goodbye!");
- end(0);
- break;
- case '*':
- choice = coinflip()? DK_NECROMANCY : DK_YREDELEMNUL;
- break;
- case 'a':
- cprintf(EOL "Very well.");
- choice = DK_NECROMANCY;
- break;
- case 'b':
- choice = DK_YREDELEMNUL;
- break;
- default:
- goto getkey1;
- }
-
- ng_dk = keyn == '*'? DK_RANDOM : choice;
+ switch (keyn)
+ {
+ case 'X':
+ cprintf(EOL "Goodbye!");
+ end(0);
+ break;
+ case CK_BKSP:
+ case ESCAPE:
+ case ' ':
+ return false;
+ case '\r':
+ case '\n':
+ if (Options.prev_dk == DK_NO_SELECTION)
+ break;
+
+ if (Options.prev_dk != DK_RANDOM)
+ {
+ choice = Options.prev_dk;
+ break;
+ }
+ keyn = '*'; // for ng_dk setting
+ // fall-through for random
+ case '*':
+ choice = coinflip()? DK_NECROMANCY : DK_YREDELEMNUL;
+ break;
+ case 'a':
+ cprintf(EOL "Very well.");
+ choice = DK_NECROMANCY;
+ break;
+ case 'b':
+ choice = DK_YREDELEMNUL;
+ default:
+ break;
+ }
+ } while (choice == DK_NO_SELECTION);
+
+ ng_dk = (keyn == '*'? DK_RANDOM : choice);
}
switch (choice)
@@ -4263,47 +4442,53 @@ bool give_items_skills()
{
textcolor(BROWN);
cprintf(EOL "Enter - %s" EOL,
- Options.prev_ck == GOD_XOM? "Xom" :
- Options.prev_ck == GOD_MAKHLEB? "Makhleb" :
- "Random");
+ Options.prev_ck == GOD_XOM? "Xom" :
+ Options.prev_ck == GOD_MAKHLEB? "Makhleb"
+ : "Random");
textcolor(LIGHTGREY);
}
- getkey2:
-
- keyn = c_getch();
-
- if ((keyn == '\r' || keyn == '\n')
- && Options.prev_ck != GOD_NO_GOD)
- {
- keyn = Options.prev_ck == GOD_XOM? 'a' :
- Options.prev_ck == GOD_MAKHLEB? 'b' :
- '*';
- }
-
- switch (keyn)
+ do
{
- case CK_BKSP:
- case ' ':
- return false;
- case 'X':
- cprintf(EOL "Goodbye!");
- end(0);
- break;
- case '*':
- you.religion = coinflip()? GOD_XOM : GOD_MAKHLEB;
- break;
- case 'a':
- you.religion = GOD_XOM;
- break;
- case 'b':
- you.religion = GOD_MAKHLEB;
- break;
- default:
- goto getkey2;
- }
+ keyn = c_getch();
- ng_ck = keyn == '*'? GOD_RANDOM : you.religion;
+ switch (keyn)
+ {
+ case 'X':
+ cprintf(EOL "Goodbye!");
+ end(0);
+ break;
+ case CK_BKSP:
+ case CK_ESCAPE:
+ case ' ':
+ return false;
+ case '\r':
+ case '\n':
+ if (Options.prev_ck == GOD_NO_GOD)
+ break;
+
+ if (Options.prev_ck != GOD_RANDOM)
+ {
+ you.religion = static_cast<god_type>(Options.prev_ck);
+ break;
+ }
+ keyn = '*'; // for ng_ck setting
+ // fall-through for random
+ case '*':
+ you.religion = (coinflip()? GOD_XOM : GOD_MAKHLEB);
+ break;
+ case 'a':
+ you.religion = GOD_XOM;
+ break;
+ case 'b':
+ you.religion = GOD_MAKHLEB;
+ // fall through
+ default:
+ break;
+ }
+ } while (you.religion == GOD_NO_GOD);
+
+ ng_ck = (keyn == '*'? GOD_RANDOM : you.religion);
}
if (you.religion == GOD_XOM)
diff --git a/crawl-ref/source/newgame.h b/crawl-ref/source/newgame.h
index 066bab2418..c3bf9f6fce 100644
--- a/crawl-ref/source/newgame.h
+++ b/crawl-ref/source/newgame.h
@@ -13,7 +13,18 @@
#define NEWGAME_H
-// last updated 12may2000 {dlb}
+/* ***********************************************************************
+ * called from: initfile
+ * *********************************************************************** */
+int get_species_index_by_abbrev( const char *abbrev );
+int get_species_index_by_name( const char *name );
+const char *get_species_abbrev( int which_species );
+
+int get_class_index_by_abbrev( const char *abbrev );
+int get_class_index_by_name( const char *name );
+const char *get_class_abbrev( int which_job );
+const char *get_class_name( int which_job );
+
/* ***********************************************************************
* called from: acr
* *********************************************************************** */
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index e03f15cbfb..75fd87be11 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -34,6 +34,7 @@
#include "item_use.h"
#include "menu.h"
#include "message.h"
+#include "newgame.h"
#include "ouch.h"
#include "player.h"
#include "religion.h"
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 2c3caa8a8e..5b74319324 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -3871,14 +3871,14 @@ std::string species_name(species_type speci, int level, bool genus, bool adj)
res = (adj ? "Orcish" : genus ? "Orc" : "Hill Orc");
break;
- case SP_GNOME: res = (adj ? "Gnomish" : "Gnome"); break;
- case SP_OGRE: res = (adj ? "Ogreish" : "Ogre"); break;
- case SP_TROLL: res = (adj ? "Trollish" : "Troll"); break;
- case SP_DEMIGOD: res = (adj ? "Divine" : "Demigod"); break;
- case SP_DEMONSPAWN: res = (adj ? "Demonic" : "Demonspawn" ); break;
- case SP_GHOUL: res = (adj ? "Ghoulish" : "Ghoul"); break;
- case SP_MERFOLK: res = (adj ? "Merfolkian" : "Merfolk"); break;
- default: res = (adj ? "Yakish" : "Yak"); break;
+ case SP_GNOME: res = (adj ? "Gnomish" : "Gnome"); break;
+ case SP_OGRE: res = (adj ? "Ogreish" : "Ogre"); break;
+ case SP_TROLL: res = (adj ? "Trollish" : "Troll"); break;
+ case SP_DEMIGOD: res = (adj ? "Divine" : "Demigod"); break;
+ case SP_DEMONSPAWN: res = (adj ? "Demonic" : "Demonspawn" ); break;
+ case SP_GHOUL: res = (adj ? "Ghoulish" : "Ghoul"); break;
+ case SP_MERFOLK: res = (adj ? "Merfolkian" : "Merfolk"); break;
+ default: res = (adj ? "Yakish" : "Yak"); break;
}
}
return res;
@@ -4572,139 +4572,6 @@ void set_mp(int new_amount, bool max_too)
return;
} // end set_mp()
-
-static const char * Species_Abbrev_List[ NUM_SPECIES ] =
- { "XX", "Hu", "HE", "GE", "DE", "SE", "MD", "Ha",
- "HO", "Ko", "Mu", "Na", "Gn", "Og", "Tr", "OM",
- // the draconians
- "Dr", "Dr", "Dr", "Dr", "Dr", "Dr", "Dr", "Dr", "Dr", "Dr",
- "Ce", "DG", "Sp", "Mi", "DS", "Gh", "Ke", "Mf", "Vp",
- // placeholders
- "HD", "El" };
-
-int get_species_index_by_abbrev( const char *abbrev )
-{
- int i;
- ASSERT(ARRAYSIZE(Species_Abbrev_List) == NUM_SPECIES);
- for (i = SP_HUMAN; i < NUM_SPECIES; i++)
- {
- if (tolower( abbrev[0] ) == tolower( Species_Abbrev_List[i][0] )
- && tolower( abbrev[1] ) == tolower( Species_Abbrev_List[i][1] ))
- {
- break;
- }
- }
-
- return ((i < NUM_SPECIES) ? i : -1);
-}
-
-int get_species_index_by_name( const char *name )
-{
- int i;
- int sp = -1;
-
- std::string::size_type pos = std::string::npos;
- char lowered_buff[80];
-
- strncpy( lowered_buff, name, sizeof( lowered_buff ) );
- strlwr( lowered_buff );
-
- for (i = SP_HUMAN; i < NUM_SPECIES; i++)
- {
- const std::string lowered_species =
- lowercase_string(species_name(static_cast<species_type>(i),0));
- pos = lowered_species.find( lowered_buff );
- if (pos != std::string::npos)
- {
- sp = i;
- if (pos == 0) // prefix takes preference
- break;
- }
- }
-
- return (sp);
-}
-
-const char *get_species_abbrev( int which_species )
-{
- ASSERT( which_species > 0 && which_species < NUM_SPECIES );
-
- return (Species_Abbrev_List[ which_species ]);
-}
-
-
-static const char * Class_Abbrev_List[ NUM_JOBS ] =
- { "Fi", "Wz", "Pr", "Th", "Gl", "Ne", "Pa", "As", "Be", "Hu",
- "Cj", "En", "FE", "IE", "Su", "AE", "EE", "Cr", "DK", "VM",
- "CK", "Tm", "He", "Re", "St", "Mo", "Wr", "Wn" };
-
-static const char * Class_Name_List[ NUM_JOBS ] =
- { "Fighter", "Wizard", "Priest", "Thief", "Gladiator", "Necromancer",
- "Paladin", "Assassin", "Berserker", "Hunter", "Conjurer", "Enchanter",
- "Fire Elementalist", "Ice Elementalist", "Summoner", "Air Elementalist",
- "Earth Elementalist", "Crusader", "Death Knight", "Venom Mage",
- "Chaos Knight", "Transmuter", "Healer", "Reaver", "Stalker",
- "Monk", "Warper", "Wanderer" };
-
-int get_class_index_by_abbrev( const char *abbrev )
-{
- int i;
-
- for (i = 0; i < NUM_JOBS; i++)
- {
- if (tolower( abbrev[0] ) == tolower( Class_Abbrev_List[i][0] )
- && tolower( abbrev[1] ) == tolower( Class_Abbrev_List[i][1] ))
- {
- break;
- }
- }
-
- return ((i < NUM_JOBS) ? i : -1);
-}
-
-const char *get_class_abbrev( int which_job )
-{
- ASSERT( which_job < NUM_JOBS );
-
- return (Class_Abbrev_List[ which_job ]);
-}
-
-int get_class_index_by_name( const char *name )
-{
- int i;
- int cl = -1;
-
- char *ptr;
- char lowered_buff[80];
- char lowered_class[80];
-
- strncpy( lowered_buff, name, sizeof( lowered_buff ) );
- strlwr( lowered_buff );
-
- for (i = 0; i < NUM_JOBS; i++)
- {
- strncpy( lowered_class, Class_Name_List[i], sizeof( lowered_class ) );
- strlwr( lowered_class );
-
- ptr = strstr( lowered_class, lowered_buff );
- if (ptr != NULL)
- {
- cl = i;
- if (ptr == lowered_class) // prefix takes preference
- break;
- }
- }
-
- return (cl);
-}
-
-const char *get_class_name( int which_job )
-{
- ASSERT( which_job < NUM_JOBS );
-
- return (Class_Name_List[ which_job ]);
-}
-
void contaminate_player(int change, bool statusOnly)
{
// get current contamination level
diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h
index 6d5c0baf3e..9cf4c2fe1c 100644
--- a/crawl-ref/source/player.h
+++ b/crawl-ref/source/player.h
@@ -396,19 +396,6 @@ void set_hp(int new_amount, bool max_too);
* *********************************************************************** */
void set_mp(int new_amount, bool max_too);
-
-/* ***********************************************************************
- * called from: newgame
- * *********************************************************************** */
-int get_species_index_by_abbrev( const char *abbrev );
-int get_species_index_by_name( const char *name );
-const char *get_species_abbrev( int which_species );
-
-int get_class_index_by_abbrev( const char *abbrev );
-int get_class_index_by_name( const char *name );
-const char *get_class_abbrev( int which_job );
-const char *get_class_name( int which_job );
-
// last updated 19apr2001 {gdl}
/* ***********************************************************************
* called from:
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index d62aeae652..48615075a9 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -57,6 +57,7 @@
#include "misc.h"
#include "monstuff.h"
#include "mon-util.h"
+#include "newgame.h"
#include "overmap.h"
#include "player.h"
#include "religion.h"