summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/database.h
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-04-20 22:11:09 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-04-20 22:11:09 +0000
commit06195a1e5d1bc504543da231baf90558df168064 (patch)
treefdc4afaccd40403625a0eafbde495f9e31d0c088 /crawl-ref/source/database.h
parent01d472dce8be0fa04ff3a66b5c35bc1dc98a110d (diff)
downloadcrawl-ref-06195a1e5d1bc504543da231baf90558df168064.tar.gz
crawl-ref-06195a1e5d1bc504543da231baf90558df168064.zip
Fixed source to build on Linux. Should still build on Mac OS, but this is
untested. Will probably not build out-of-the-box on other BSDs (we need an autoconf script to use the right dbm headers). DOS and Windows builds are still broken pending adding Berkeley DB 1.x sources to the Crawl tree, which I'll probably do sometime tomorrow. Renamed descriptions.txt -> descript.txt to fit into DOS filename limits. The descript.txt -> descript.db conversion is now performed automatically by Crawl on startup if descript.txt is newer than descript.db (or descript.db does not exist). descript.db is saved in the save directory which is a convenient directory that is guaranteed writable by Crawl. The makedb.pl script is no longer necessary (and is unreliable anyway, because it's easy to have multiple dbm versions with incompatible db formats and have the installed Perl link with one while Crawl uses the other, leading to nasty segfaults). Some .des file changes (Erik). Deep elf sorcerers are M_EVIL. Ghosts get mephitic cloud. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1337 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/database.h')
-rw-r--r--crawl-ref/source/database.h31
1 files changed, 18 insertions, 13 deletions
diff --git a/crawl-ref/source/database.h b/crawl-ref/source/database.h
index 71b8474033..364a87c7b6 100644
--- a/crawl-ref/source/database.h
+++ b/crawl-ref/source/database.h
@@ -10,29 +10,34 @@
#ifndef DATABASE_H
#define DATABASE_H
-#undef DEBUG // hack
-#define NDEBUG
+#include "AppHdr.h"
#include "externs.h"
+#include <list>
-#ifdef __cplusplus
extern "C" {
-#endif
+#ifdef DB_NDBM
-#include <ndbm.h>
+# include <ndbm.h>
+# define DPTR_COERCE void *
+
+#else
+
+# define DB_DBM_HSEARCH 1
+# include <db.h>
+# define DPTR_COERCE char *
-// For convenience during shutdown.
-typedef struct dbList_s dbList_t;
-#ifdef __cplusplus
-}
#endif
-extern dbList_t *openDBList;
+}
+
+typedef std::list<DBM *> db_list;
+
+extern db_list openDBList;
void databaseSystemInit();
void databaseSystemShutdown();
DBM *openDB(const char *dbFilename);
-datum *database_fetch(DBM *database, char *key);
-
+datum database_fetch(DBM *database, const std::string &key);
-std::string getLongDescription(const char *key);
+std::string getLongDescription(const std::string &key);
#endif