summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2009-10-21 08:53:14 +0200
committerRobert Vollmert <rvollmert@gmx.net>2009-10-21 08:53:14 +0200
commit6b4885b07d0a5228d7dc20cbbb210a1a168bc8da (patch)
treefb2d389b1ada652eab6fc9076dfa32ba503416ce
parent6dc31aef7899c75449f7203809f676057b65f5a3 (diff)
downloadcrawl-ref-6b4885b07d0a5228d7dc20cbbb210a1a168bc8da.tar.gz
crawl-ref-6b4885b07d0a5228d7dc20cbbb210a1a168bc8da.zip
Complete rename to mapgrd.
Previously, I had renamed only the C++-side of things. Also update documentation.
-rw-r--r--crawl-ref/docs/develop/level_design.txt6
-rw-r--r--crawl-ref/source/dat/clua/dungeon.lua4
-rw-r--r--crawl-ref/source/l_dgnbld.cc4
-rw-r--r--crawl-ref/source/l_mapgrd.cc30
4 files changed, 22 insertions, 22 deletions
diff --git a/crawl-ref/docs/develop/level_design.txt b/crawl-ref/docs/develop/level_design.txt
index 9731563da1..8aae316a24 100644
--- a/crawl-ref/docs/develop/level_design.txt
+++ b/crawl-ref/docs/develop/level_design.txt
@@ -1865,15 +1865,15 @@ mons_from_index, change_level_flags, change_branch_flags,
set_random_mon_list
-Additionally, the dgn module provides a global "grd" variable that
+Additionally, the dgn module provides a global "mapgrd" variable that
can access the current map glyphs. The top left symbol in the map
can be assigned like this:
- grd[1][1] = 'x'
+ mapgrd[1][1] = 'x'
The bottom right symbol can be assigned like this:
- grd[width()][height()] = "."
+ mapgrd[width()][height()] = "."
Lua API - global game state
diff --git a/crawl-ref/source/dat/clua/dungeon.lua b/crawl-ref/source/dat/clua/dungeon.lua
index b1cc8de795..f6892870d1 100644
--- a/crawl-ref/source/dat/clua/dungeon.lua
+++ b/crawl-ref/source/dat/clua/dungeon.lua
@@ -76,8 +76,8 @@ function dgn_map_meta_wrap(map, tab)
end
end
- -- Convenience global variable, e.g. grd[x][y] = 'x'
- meta['grd'] = dgn.grd_table(map)
+ -- Convenience global variable, e.g. mapgrd[x][y] = 'x'
+ meta['mapgrd'] = dgn.mapgrd_table(map)
meta['_G'] = meta
meta.wrapped_instance = map
diff --git a/crawl-ref/source/l_dgnbld.cc b/crawl-ref/source/l_dgnbld.cc
index 9071d95a95..634fea0d47 100644
--- a/crawl-ref/source/l_dgnbld.cc
+++ b/crawl-ref/source/l_dgnbld.cc
@@ -13,7 +13,7 @@
#include "dungeon.h"
// Return a metatable for a point on the map_lines grid.
-static int dgn_grd_table(lua_State *ls)
+static int dgn_mapgrd_table(lua_State *ls)
{
MAP(ls, 1, map);
@@ -340,7 +340,7 @@ static int dgn_fill_disconnected_zones(lua_State *ls)
const struct luaL_reg dgn_build_dlib[] =
{
-{ "grd_table", dgn_grd_table },
+{ "mapgrd_table", dgn_mapgrd_table },
{ "width", dgn_width },
{ "height", dgn_height },
{ "fill_area", dgn_fill_area },
diff --git a/crawl-ref/source/l_mapgrd.cc b/crawl-ref/source/l_mapgrd.cc
index 9431fda173..a1ea880594 100644
--- a/crawl-ref/source/l_mapgrd.cc
+++ b/crawl-ref/source/l_mapgrd.cc
@@ -6,7 +6,7 @@
#include "mapdef.h"
/////////////////////////////////////////////////////////////////////
-// grd and grd_col handling (i.e. map_lines in a metatable)
+// mapgrd and mapgrd_col handling (i.e. map_lines in a metatable)
struct mapcolumn
{
@@ -14,7 +14,7 @@ struct mapcolumn
int col;
};
-static int grd_get(lua_State *ls)
+static int mapgrd_get(lua_State *ls)
{
// Return a metatable for this column in the map grid.
map_def *map = *(map_def **) luaL_checkudata(ls, 1, MAPGRD_METATABLE);
@@ -28,12 +28,12 @@ static int grd_get(lua_State *ls)
return (1);
}
-static int grd_set(lua_State *ls)
+static int mapgrd_set(lua_State *ls)
{
return (luaL_error(ls, "%s", "Cannot assign to read-only table."));
}
-static char* grd_glyph(lua_State *ls, int &col, int &row)
+static char* mapgrd_glyph(lua_State *ls, int &col, int &row)
{
mapcolumn *mapc = (mapcolumn *)luaL_checkudata(ls, 1, MAPGRD_COL_METATABLE);
row = luaL_checkint(ls, 2);
@@ -49,10 +49,10 @@ static char* grd_glyph(lua_State *ls, int &col, int &row)
return (&lines(mc));
}
-static int grd_col_get(lua_State *ls)
+static int mapgrd_col_get(lua_State *ls)
{
int col, row;
- char *gly = grd_glyph(ls, col, row);
+ char *gly = mapgrd_glyph(ls, col, row);
if (!gly)
return (luaL_error(ls, "Invalid coords: %d, %d", col, row));
@@ -65,16 +65,16 @@ static int grd_col_get(lua_State *ls)
return (1);
}
-static int grd_col_set(lua_State *ls)
+static int mapgrd_col_set(lua_State *ls)
{
int col, row;
- char *gly = grd_glyph(ls, col, row);
+ char *gly = mapgrd_glyph(ls, col, row);
if (!gly)
return (luaL_error(ls, "Invalid coords: %d, %d", col, row));
const char *str = luaL_checkstring(ls, 3);
if (!str[0] || str[1])
- return (luaL_error(ls, "%s", "grd must be set to a single char."));
+ return (luaL_error(ls, "%s", "mapgrd must be set to a single char."));
(*gly) = str[0];
@@ -83,26 +83,26 @@ static int grd_col_set(lua_State *ls)
void dluaopen_mapgrd(lua_State *ls)
{
- // grd table
+ // mapgrd table
luaL_newmetatable(ls, MAPGRD_METATABLE);
lua_pushstring(ls, "__index");
- lua_pushcfunction(ls, grd_get);
+ lua_pushcfunction(ls, mapgrd_get);
lua_settable(ls, -3);
lua_pushstring(ls, "__newindex");
- lua_pushcfunction(ls, grd_set);
+ lua_pushcfunction(ls, mapgrd_set);
lua_settable(ls, -3);
lua_pop(ls, 1);
- // grd col table
+ // mapgrd col table
luaL_newmetatable(ls, MAPGRD_COL_METATABLE);
lua_pushstring(ls, "__index");
- lua_pushcfunction(ls, grd_col_get);
+ lua_pushcfunction(ls, mapgrd_col_get);
lua_settable(ls, -3);
lua_pushstring(ls, "__newindex");
- lua_pushcfunction(ls, grd_col_set);
+ lua_pushcfunction(ls, mapgrd_col_set);
lua_settable(ls, -3);
lua_pop(ls, 1);