From 81b12532efb337e803cd89b290209a2f79a1678d Mon Sep 17 00:00:00 2001 From: ennewalker Date: Sat, 19 Apr 2008 00:13:29 +0000 Subject: [1941577] Fixed issue where title line sometimes contained characters from species line. This was due to the title writing (blank) strings that were too long and wrapping around to the next line. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4349 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/guic.cc | 4 ++++ crawl-ref/source/output.cc | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/guic.cc b/crawl-ref/source/guic.cc index 3b3671f6b6..9e3eb26505 100644 --- a/crawl-ref/source/guic.cc +++ b/crawl-ref/source/guic.cc @@ -701,6 +701,10 @@ void TextRegionClass::textbackground(int col) void TextRegionClass::cgotoxy(int x, int y) { + ASSERT(x >= 1); + ASSERT(y >= 1); + ASSERT(x <= text_mode->mx); + ASSERT(y <= text_mode->my); print_x = x-1; print_y = y-1; diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc index 94a331dfcf..b931ff01bf 100644 --- a/crawl-ref/source/output.cc +++ b/crawl-ref/source/output.cc @@ -904,7 +904,7 @@ void redraw_skill(const std::string &your_name, const std::string &class_name) std::string title = your_name + " the " + class_name; int in_len = title.length(); - const int WIDTH = 40; // use crawl_view.hudsz.x instead? + const int WIDTH = crawl_view.hudsz.x; if (in_len > WIDTH) { in_len -= 3; // what we're getting back from removing "the" @@ -923,7 +923,7 @@ void redraw_skill(const std::string &your_name, const std::string &class_name) cgotoxy(1, 1, GOTO_STAT); textcolor( YELLOW ); - cprintf( "%-41s", title.c_str() ); + cprintf( "%-*s", WIDTH, title.c_str() ); cgotoxy(1, 2, GOTO_STAT); cprintf("%s", species_name( you.species, you.experience_level ).c_str()); -- cgit v1.2.3-54-g00ecf