summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/luadgn.cc
diff options
context:
space:
mode:
authorpauldubois <pauldubois@c06c8d41-db1a-0410-9941-cceddc491573>2008-03-17 05:54:42 +0000
committerpauldubois <pauldubois@c06c8d41-db1a-0410-9941-cceddc491573>2008-03-17 05:54:42 +0000
commit8ba172496400cc74a2fa7d343d9859339f1a0f5d (patch)
tree09715fca1c835aca87d0da9d629ad5f9e0157e54 /crawl-ref/source/luadgn.cc
parent314a2c0efb7083bc9703b6e2f6ee4e054d000cc1 (diff)
downloadcrawl-ref-8ba172496400cc74a2fa7d343d9859339f1a0f5d.tar.gz
crawl-ref-8ba172496400cc74a2fa7d343d9859339f1a0f5d.zip
Cleanup/refactoring of tags.cc. No functional changes. I've been
running with and without this patch applied for about a week, and none of my saves have broken, so I'm ready to commit it. - Tag system no longer uses one big (shared!) global buffer. This was the original impetus behind the change... - Change every use of tagHeader into reader or writer (touches a lot). - Split tagHeader into two classes: reader and writer. Turns out every place that used tagHeader only cared about reading or writing and not about tags at all. There was nothing left in tagHeader, so it disappeared along with a bunch of grotty special-case code. - Not done: merge the files.cc read/writeThing code with the tags.cc marshall/unmarshallThing code. This patch is big enough already. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3685 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/luadgn.cc')
-rw-r--r--crawl-ref/source/luadgn.cc18
1 files changed, 9 insertions, 9 deletions
diff --git a/crawl-ref/source/luadgn.cc b/crawl-ref/source/luadgn.cc
index 57442e5d1e..ee432892be 100644
--- a/crawl-ref/source/luadgn.cc
+++ b/crawl-ref/source/luadgn.cc
@@ -1735,7 +1735,7 @@ static int file_marshall(lua_State *ls)
{
if (lua_gettop(ls) != 2)
luaL_error(ls, "Need two arguments: tag header and value");
- tagHeader &th(*static_cast<tagHeader*>( lua_touserdata(ls, 1) ));
+ writer &th(*static_cast<writer*>( lua_touserdata(ls, 1) ));
if (lua_isnumber(ls, 2))
marshallLong(th, luaL_checklong(ls, 2));
else if (lua_isstring(ls, 2))
@@ -1751,8 +1751,8 @@ static int file_marshall(lua_State *ls)
static int file_unmarshall_number(lua_State *ls)
{
if (lua_gettop(ls) != 1)
- luaL_error(ls, "Need tag header as one argument");
- tagHeader &th(*static_cast<tagHeader*>( lua_touserdata(ls, 1) ));
+ luaL_error(ls, "Need reader as one argument");
+ reader &th(*static_cast<reader*>( lua_touserdata(ls, 1) ));
lua_pushnumber(ls, unmarshallLong(th));
return (1);
}
@@ -1760,8 +1760,8 @@ static int file_unmarshall_number(lua_State *ls)
static int file_unmarshall_string(lua_State *ls)
{
if (lua_gettop(ls) != 1)
- luaL_error(ls, "Need tag header as one argument");
- tagHeader &th(*static_cast<tagHeader*>( lua_touserdata(ls, 1) ));
+ luaL_error(ls, "Need reader as one argument");
+ reader &th(*static_cast<reader*>( lua_touserdata(ls, 1) ));
lua_pushstring(ls, unmarshallString(th).c_str());
return (1);
}
@@ -1769,8 +1769,8 @@ static int file_unmarshall_string(lua_State *ls)
static int file_unmarshall_fn(lua_State *ls)
{
if (lua_gettop(ls) != 1)
- luaL_error(ls, "Need tag header as one argument");
- tagHeader &th(*static_cast<tagHeader*>( lua_touserdata(ls, 1) ));
+ luaL_error(ls, "Need reader as one argument");
+ reader &th(*static_cast<reader*>( lua_touserdata(ls, 1) ));
const std::string s(unmarshallString(th, LUA_CHUNK_MAX_SIZE));
dlua_chunk chunk = dlua_chunk::precompiled(s);
if (chunk.load(dlua))
@@ -1792,7 +1792,7 @@ static int file_marshall_meta(lua_State *ls)
if (lua_gettop(ls) != 2)
luaL_error(ls, "Need two arguments: tag header and value");
- tagHeader &th(*static_cast<tagHeader*>( lua_touserdata(ls, 1) ));
+ writer &th(*static_cast<writer*>( lua_touserdata(ls, 1) ));
lua_persist_type ptype = LPT_NONE;
if (lua_isnumber(ls, 2))
@@ -1813,7 +1813,7 @@ static int file_marshall_meta(lua_State *ls)
static int file_unmarshall_meta(lua_State *ls)
{
- tagHeader &th(*static_cast<tagHeader*>( lua_touserdata(ls, 1) ));
+ reader &th(*static_cast<reader*>( lua_touserdata(ls, 1) ));
const lua_persist_type ptype =
static_cast<lua_persist_type>(unmarshallByte(th));
switch (ptype)