File: l_subvault.cc

package info (click to toggle)
crawl 2%3A0.7.1-3
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 30,420 kB
  • ctags: 23,018
  • sloc: cpp: 244,317; ansic: 16,144; perl: 2,214; makefile: 984; python: 488; objc: 250; ruby: 200; sh: 140
file content (57 lines) | stat: -rw-r--r-- 1,112 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
 * File:       l_subvault.cc
 * Summary:    Subvault routines (library "dgn").
 */

#include "AppHdr.h"

#include "coord.h"
#include "cluautil.h"
#include "l_libs.h"
#include "mapdef.h"

static int dgn_is_subvault(lua_State *ls)
{
    MAP(ls, 1, map);

    lua_pushboolean(ls, map->is_subvault());
    return (1);
}

static int dgn_default_subvault_glyphs(lua_State *ls)
{
    MAP(ls, 1, map);

    map->apply_subvault_mask();
    return (0);
}

static int dgn_subvault_cell_valid(lua_State *ls)
{
    MAP(ls, 1, map);
    coord_def c;
    c.x = luaL_checkint(ls, 2);
    c.y = luaL_checkint(ls, 3);

    lua_pushboolean(ls, map->subvault_cell_valid(c));
    return (1);
}

static int dgn_subvault_size(lua_State *ls)
{
    MAP(ls, 1, map);

    lua_pushnumber(ls, map->subvault_width());
    lua_pushnumber(ls, map->subvault_height());
    return (2);
}

const struct luaL_reg dgn_subvault_dlib[] =
{
{ "is_subvault", dgn_is_subvault },
{ "default_subvault_glyphs", dgn_default_subvault_glyphs },
{ "subvault_cell_valid", dgn_subvault_cell_valid },
{ "subvault_size", dgn_subvault_size },

{ NULL, NULL }
};