summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/tilereg.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-06-15 20:09:19 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-06-15 20:09:19 +0000
commit141a6b8304cb7a55cad08cd1de379e43ca83b38b (patch)
tree56a1e039e771a49242d2c3ae3a3c4e3ceecb598f /crawl-ref/source/tilereg.cc
parentceb4c8964c99e64f6adebad119e1bbbafafedd62 (diff)
downloadcrawl-ref-141a6b8304cb7a55cad08cd1de379e43ca83b38b.tar.gz
crawl-ref-141a6b8304cb7a55cad08cd1de379e43ca83b38b.zip
Apply my recent commits to trunk.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9984 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/tilereg.cc')
-rw-r--r--crawl-ref/source/tilereg.cc26
1 files changed, 17 insertions, 9 deletions
diff --git a/crawl-ref/source/tilereg.cc b/crawl-ref/source/tilereg.cc
index a3879ab2a1..b7ee5377c7 100644
--- a/crawl-ref/source/tilereg.cc
+++ b/crawl-ref/source/tilereg.cc
@@ -10,6 +10,7 @@
#include "AppHdr.h"
REVISION("$Rev$");
+#include <cmath>
#include "cio.h"
#include "debug.h"
#include "describe.h"
@@ -428,7 +429,7 @@ void DungeonRegion::pack_doll(const dolls_data &doll, int x, int y)
TILEP_PART_HAIR,
TILEP_PART_BEARD,
TILEP_PART_HELM,
- TILEP_PART_DRCHEAD // 15
+ TILEP_PART_DRCHEAD // 15
};
int flags[TILEP_PART_MAX];
@@ -1194,7 +1195,7 @@ void DungeonRegion::add_text_tag(text_tag_type type, const std::string &tag,
{
TextTag t;
t.tag = tag;
- t.gc = gc;
+ t.gc = gc;
m_tags[type].push_back(t);
}
@@ -1243,6 +1244,7 @@ InventoryRegion::InventoryRegion(ImageManager* im, FTFont *tag_font,
InventoryRegion::~InventoryRegion()
{
delete[] m_flavour;
+ m_flavour = NULL;
}
void InventoryRegion::clear()
@@ -1364,9 +1366,12 @@ void InventoryRegion::pack_buffers()
if (item.flag & TILEI_FLAG_FLOOR)
{
+ if (i >= (unsigned int) mx * my)
+ break;
+
int num_floor = tile_dngn_count(env.tile_default.floor);
m_buf_dngn.add(env.tile_default.floor
- + m_flavour[i] % num_floor, x, y);
+ + m_flavour[i] % num_floor, x, y);
}
else
m_buf_dngn.add(TILE_ITEM_SLOT, x, y);
@@ -2166,8 +2171,8 @@ TextRegion::TextRegion(FTFont *font) :
void TextRegion::on_resize()
{
- delete cbuf;
- delete abuf;
+ delete[] cbuf;
+ delete[] abuf;
int size = mx * my;
cbuf = new unsigned char[size];
@@ -2295,13 +2300,14 @@ void TextRegion::cgotoxy(int x, int y)
print_x = x-1;
print_y = y-1;
+#if 0
if (cursor_region != NULL && cursor_flag)
{
cursor_x = -1;
cursor_y = -1;
cursor_region = NULL;
}
-
+#endif
if (cursor_flag)
{
cursor_x = print_x;
@@ -2461,7 +2467,7 @@ void MessageRegion::render()
{
idx = cursor_x + mx * cursor_y;
char_back = cbuf[idx];
- col_back = abuf[idx];
+ col_back = abuf[idx];
cbuf[idx] = '_';
abuf[idx] = WHITE;
@@ -2663,7 +2669,7 @@ void MenuRegion::place_entries()
continue;
}
- if (height + max_entry_height > end_height)
+ if (height + max_entry_height > end_height && column <= max_columns)
{
height = 0;
column++;
@@ -2715,6 +2721,8 @@ void MenuRegion::place_entries()
int text_sy = m_entries[i].sy;
text_sy += (entry_height - m_font_entry->char_height()) / 2;
+ // Split menu entries that don't fit into a single lines into two
+ // lines.
if (Options.tile_menu_icons
&& text_sx + text_width > entry_start + column_width)
{
@@ -2848,7 +2856,7 @@ int MenuRegion::maxpagesize() const
// Similar to the definition of max_entry_height in place_entries().
const int div = (Options.tile_menu_icons ? 32
- : m_font_entry->char_height());
+ : m_font_entry->char_height() + 1);
const int pagesize = ((my - more_height) / div) * m_max_columns;