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-08-04 11:35:24 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-08-04 11:35:24 +0000
commit33cc9b2e7e19d9866827331d17d467b2b882e22f (patch)
tree5230f7390f2fb87512b977f026922e3eac52117c /crawl-ref/source/database.cc
parent95e55a6b22e03054efbdf9af7625832883298a2d (diff)
downloadcrawl-ref-33cc9b2e7e19d9866827331d17d467b2b882e22f.tar.gz
crawl-ref-33cc9b2e7e19d9866827331d17d467b2b882e22f.zip
* Move all quotes into quotes.txt and a database of their own.
* Adapt Matthew's code to use quotes if there's enough space left. * Skip the general description of player ghosts that only repeats the specific description but with less information. * Don't refer to ghosts as "xyz's ghost the player ghost" git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6766 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/database.cc')
-rw-r--r--crawl-ref/source/database.cc31
1 files changed, 19 insertions, 12 deletions
diff --git a/crawl-ref/source/database.cc b/crawl-ref/source/database.cc
index 2aaa4f8bd5..68637eb56e 100644
--- a/crawl-ref/source/database.cc
+++ b/crawl-ref/source/database.cc
@@ -94,6 +94,10 @@ static TextDB AllDBs[] =
"database/miscname.txt", // names for miscellaneous things
NULL),
+ TextDB( "db/quotes",
+ "database/quotes.txt", // quotes for items and monsters
+ NULL),
+
TextDB( "db/help", // database for outsourced help texts
"database/help.txt",
NULL),
@@ -104,7 +108,8 @@ static TextDB& RandartDB = AllDBs[1];
static TextDB& SpeakDB = AllDBs[2];
static TextDB& ShoutDB = AllDBs[3];
static TextDB& MiscDB = AllDBs[4];
-static TextDB& HelpDB = AllDBs[5];
+static TextDB& QuotesDB = AllDBs[5];
+static TextDB& HelpDB = AllDBs[6];
// ----------------------------------------------------------------------
// TextDB
@@ -600,23 +605,25 @@ static std::string _query_database(DBM *db, std::string key,
}
/////////////////////////////////////////////////////////////////////////////
+// Quote DB specific functions.
+
+std::string getQuoteString(const std::string &key)
+{
+ if (!QuotesDB)
+ return ("");
+
+ return _query_database(QuotesDB.get(), key, true, true);
+}
+
+/////////////////////////////////////////////////////////////////////////////
// Description DB specific functions.
-std::string getLongDescription(const std::string &key, bool noquote)
+std::string getLongDescription(const std::string &key)
{
if (!DescriptionDB.get())
return ("");
- std::string result = "";
- if (noquote)
- {
- result = _query_database(DescriptionDB.get(), key + " noquote",
- true, true);
- }
- if (result.empty())
- result = _query_database(DescriptionDB.get(), key, true, true);
-
- return result;
+ return _query_database(DescriptionDB.get(), key, true, true);
}
std::vector<std::string> getLongDescKeysByRegex(const std::string &regex,