diff options
author | Enne Walker <enne.walker@gmail.com> | 2010-05-29 16:24:10 -0400 |
---|---|---|
committer | Enne Walker <enne.walker@gmail.com> | 2010-05-30 08:50:37 -0400 |
commit | ca6e3ae38efee3e21d22494140094d71344cdac4 (patch) | |
tree | 2f40b5085806fbf3c765f705071f69a8221e76ae /crawl-ref/source/tilereg-dgn.cc | |
parent | 575cfb8db1e87084ae13b9799f74a3b6be75c0c8 (diff) | |
download | crawl-ref-ca6e3ae38efee3e21d22494140094d71344cdac4.tar.gz crawl-ref-ca6e3ae38efee3e21d22494140094d71344cdac4.zip |
Use tileidx_t for tile indices. Also, cleanup.
This new type defines to unsigned int, but it cleans up a lot of the
int/unsigned int/short confusion all over the codebase for tile indices.
This commit also cleans up tiles code to use coord_def more and to change
function signatures to pass const refs and non-const pointers.
Diffstat (limited to 'crawl-ref/source/tilereg-dgn.cc')
-rw-r--r-- | crawl-ref/source/tilereg-dgn.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/crawl-ref/source/tilereg-dgn.cc b/crawl-ref/source/tilereg-dgn.cc index d2904a8fa9..bd7bcc1e57 100644 --- a/crawl-ref/source/tilereg-dgn.cc +++ b/crawl-ref/source/tilereg-dgn.cc @@ -117,7 +117,7 @@ void DungeonRegion::pack_buffers() if (!crawl_view.in_grid_los(m_overlays[i].gc)) continue; - int idx = m_overlays[i].idx; + tileidx_t idx = m_overlays[i].idx; if (idx >= TILE_MAIN_MAX) continue; @@ -212,7 +212,7 @@ void DungeonRegion::render() const coord_def gc = show2grid(ep); coord_def pc; - to_screen_coords(gc, pc); + to_screen_coords(gc, &pc); // center this coord, which is at the top left of gc's cell pc.x += dx / 2; @@ -252,7 +252,7 @@ void DungeonRegion::draw_minibars() // that gives coords by pixel (the current one), one that gives // them by grid. coord_def player_on_screen; - to_screen_coords(you.pos(), player_on_screen); + to_screen_coords(you.pos(), &player_on_screen); static const float tile_width = wx / mx; static const float tile_height = wy / my; @@ -843,13 +843,13 @@ int tile_click_cell(const coord_def &gc, unsigned char mod) return (click_travel(gc, mod & MOD_CTRL)); } -void DungeonRegion::to_screen_coords(const coord_def &gc, coord_def &pc) const +void DungeonRegion::to_screen_coords(const coord_def &gc, coord_def *pc) const { int cx = gc.x - m_cx_to_gx; int cy = gc.y - m_cy_to_gy; - pc.x = sx + ox + cx * dx; - pc.y = sy + oy + cy * dy; + pc->x = sx + ox + cx * dx; + pc->y = sy + oy + cy * dy; } bool DungeonRegion::on_screen(const coord_def &gc) const |