summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/database.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-03-19 16:20:19 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-03-19 16:20:19 +0000
commit6bd53ca4cc1bc582b1204fc68134533c5b86ba60 (patch)
treeeb51fba2eaa0bd1fdce047fa13a7f3cab368d36c /crawl-ref/source/database.cc
parent7f3aa8091bff87364d2c3eaa6de0f20b47f90d51 (diff)
downloadcrawl-ref-6bd53ca4cc1bc582b1204fc68134533c5b86ba60.tar.gz
crawl-ref-6bd53ca4cc1bc582b1204fc68134533c5b86ba60.zip
Outsourcing Xom speech.
"You hear the rejoicing of dolorous and dpeg!" Xom is fascinated! git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3723 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/database.cc')
-rw-r--r--crawl-ref/source/database.cc24
1 files changed, 18 insertions, 6 deletions
diff --git a/crawl-ref/source/database.cc b/crawl-ref/source/database.cc
index e566d5a7ea..beafcdfbdd 100644
--- a/crawl-ref/source/database.cc
+++ b/crawl-ref/source/database.cc
@@ -66,29 +66,36 @@ static TextDB AllDBs[] =
"descript/gods.txt",
"descript/branches.txt",
0),
+
TextDB( "db/randart",
"database/randname.txt",
"database/rand_wpn.txt", // mostly weapons
"database/rand_arm.txt", // mostly armour
"database/rand_all.txt", // jewellery and general
0),
+
TextDB( "db/speak",
"database/monspeak.txt", // monster speech
"database/wpnnoise.txt", // noisy weapon speech
"database/insult.txt", // imp/demon taunts
+ "database/godspeak.txt", // god speech
0),
+
TextDB( "db/shout",
"database/shout.txt",
"database/insult.txt", // imp/demon taunts, again
0),
- TextDB( "db/help", "database/help.txt", 0),
+
+ TextDB( "db/help",
+ "database/help.txt",
+ 0),
};
static TextDB& DescriptionDB = AllDBs[0];
-static TextDB& RandartDB = AllDBs[1];
-static TextDB& SpeakDB = AllDBs[2];
-static TextDB& ShoutDB = AllDBs[3];
-static TextDB& HelpDB = AllDBs[4];
+static TextDB& RandartDB = AllDBs[1];
+static TextDB& SpeakDB = AllDBs[2];
+static TextDB& ShoutDB = AllDBs[3];
+static TextDB& HelpDB = AllDBs[4];
// ----------------------------------------------------------------------
// TextDB
@@ -103,7 +110,10 @@ TextDB::TextDB(const char* db_name, ...)
while (true)
{
const char* input_file = va_arg(args, const char *);
- if (input_file == 0) break;
+
+ if (input_file == 0)
+ break;
+
ASSERT( strstr(input_file, ".txt") != 0 ); // probably forgot the terminating 0
_input_files.push_back(input_file);
}
@@ -114,8 +124,10 @@ void TextDB::init()
{
if (_needs_update())
_regenerate_db();
+
const std::string full_db_path = get_savedir_path(_db_name);
_db = dbm_open(full_db_path.c_str(), O_RDONLY, 0660);
+
if (_db == NULL)
end(1, true, "Failed to open DB: %s", full_db_path.c_str());
}