diff options
author | Haran Pilpel <haranp@users.sourceforge.net> | 2010-01-13 12:08:41 +0200 |
---|---|---|
committer | Haran Pilpel <haranp@users.sourceforge.net> | 2010-01-13 12:08:41 +0200 |
commit | 526626fe4e3c9bd87234d9b8701a5cfdb19ad7b8 (patch) | |
tree | 3341012879e5c2d086744d9f269c7c2702805b93 | |
parent | cce3c6e018e1ec88a1b49eaf2fbfde88f51ada01 (diff) | |
download | crawl-ref-526626fe4e3c9bd87234d9b8701a5cfdb19ad7b8.tar.gz crawl-ref-526626fe4e3c9bd87234d9b8701a5cfdb19ad7b8.zip |
Fix line_reader crashing at random on non-tiles build. This is #ifdefed out for
tiles. This is a hack.
-rw-r--r-- | crawl-ref/source/cio.cc | 10 | ||||
-rw-r--r-- | crawl-ref/source/ng-input.cc | 8 |
2 files changed, 11 insertions, 7 deletions
diff --git a/crawl-ref/source/cio.cc b/crawl-ref/source/cio.cc index 370492536b..13059d67fd 100644 --- a/crawl-ref/source/cio.cc +++ b/crawl-ref/source/cio.cc @@ -401,7 +401,7 @@ void line_reader::cursorto(int ncx) { int x = (start_x + ncx - 1) % wrapcol + 1; int y = start_y + (start_x + ncx - 1) / wrapcol; - ::cgotoxy(x, y, get_cursor_region()); + cgotoxy(x, y, get_cursor_region()); } int line_reader::read_line(bool clear_previous) @@ -417,6 +417,12 @@ int line_reader::read_line(bool clear_previous) start_x = wherex(); start_y = wherey(); +#ifndef USE_TILE + // FIXME: what exactly is going on here? + // Update the active region. + cgotoxy(start_x, start_y, GOTO_CRT); +#endif + length = strlen(buffer); // Remember the previous cursor position, if valid. @@ -479,7 +485,7 @@ void line_reader::backspace() char *c = cur; while (*c) { - *c = c[1]; + *c = *(c+1); c++; } --pos; diff --git a/crawl-ref/source/ng-input.cc b/crawl-ref/source/ng-input.cc index 499a3e2143..4a097049f8 100644 --- a/crawl-ref/source/ng-input.cc +++ b/crawl-ref/source/ng-input.cc @@ -178,17 +178,15 @@ static bool _read_player_name(std::string &name, if (ret == CK_ESCAPE) return (false); - if (ret != CK_ESCAPE && existing.size()) + if (!existing.empty()) { menu.set_search(name); menu.show(); const MenuEntry *sel = menu.selected_entry(); if (sel) { - const player_save_info &p = - *static_cast<player_save_info*>( sel->data ); - name = p.name; - return (true); + name = static_cast<player_save_info*>(sel->data)->name; + return true; } } |