summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Noonan <steven@uplinklabs.net>2009-09-20 18:09:20 -0700
committerSteven Noonan <steven@uplinklabs.net>2009-09-25 14:32:29 -0700
commitcc048878478df69796822c164e85e88c023deb43 (patch)
treea25c63b492484825e279b83b33186fea185473e9
parent7ddbb5591ef05997318b0f56cb1bc2c29fdd3227 (diff)
downloadcrawl-ref-cc048878478df69796822c164e85e88c023deb43.tar.gz
crawl-ref-cc048878478df69796822c164e85e88c023deb43.zip
libgui: fix declaration consistency
Lots of little things here. The forward declarations for some of these functions simply did not match the function definitions. - clrscr() was declared twice - cprintf(), putch(), putwch(), window(), clrscr() all returned 'void' instead of 'int'. - getch() and strlwr() were defined extern "C", but not declared as such. Also made libgui.cc functions behave like their ncurses equivalents, except that our functions always return the ncurses 'OK' (0) response. Signed-off-by: Steven Noonan <steven@uplinklabs.net>
-rw-r--r--crawl-ref/source/libgui.cc17
-rw-r--r--crawl-ref/source/libgui.h15
2 files changed, 18 insertions, 14 deletions
diff --git a/crawl-ref/source/libgui.cc b/crawl-ref/source/libgui.cc
index f199d7193d..173877eed0 100644
--- a/crawl-ref/source/libgui.cc
+++ b/crawl-ref/source/libgui.cc
@@ -102,16 +102,18 @@ void gui_init_view_params(crawl_view_geometry &geom)
geom.viewsz.y = 17;
}
-void putch(unsigned char chr)
+int putch(unsigned char chr)
{
// object's method
TextRegion::text_mode->putch(chr);
+ return 0;
}
-void putwch(unsigned chr)
+int putwch(unsigned chr)
{
// No unicode support.
putch(static_cast<unsigned char>(chr));
+ return 0;
}
void writeWChar(unsigned char *ch)
@@ -241,7 +243,7 @@ void get_input_line_gui(char *const buff, int len)
} // while (!done)
}
-void cprintf(const char *format,...)
+int cprintf(const char *format,...)
{
char buffer[2048]; // One full screen if no control seq...
va_list argp;
@@ -250,6 +252,7 @@ void cprintf(const char *format,...)
va_end(argp);
// object's method
TextRegion::text_mode->addstr(buffer);
+ return 0;
}
void textcolor(int color)
@@ -304,8 +307,9 @@ void put_colour_ch(int colour, unsigned ch)
putwch(ch);
}
-void window(int x1, int y1, int x2, int y2)
+int window(int x1, int y1, int x2, int y2)
{
+ return 0;
}
int getch_ck()
@@ -318,9 +322,10 @@ int getch()
return getch_ck();
}
-void clrscr()
+int clrscr()
{
- return (tiles.clrscr());
+ tiles.clrscr();
+ return 0;
}
void message_out(int which_line, int colour, const char *s, int firstcol, bool newline)
diff --git a/crawl-ref/source/libgui.h b/crawl-ref/source/libgui.h
index 302d14f1e8..5b5e024f55 100644
--- a/crawl-ref/source/libgui.h
+++ b/crawl-ref/source/libgui.h
@@ -30,11 +30,10 @@ void gui_init_view_params(crawl_view_geometry &geom);
bool gui_get_mouse_grid_pos(coord_def &gc);
/* text display */
-void clrscr(void);
void textcolor(int color);
int wherex();
int wherey();
-void cprintf(const char *format,...);
+int cprintf(const char *format,...);
void clear_to_end_of_line(void);
void clear_to_end_of_screen(void);
int get_number_of_lines(void);
@@ -43,8 +42,8 @@ void get_input_line_gui(char *const buff, int len);
void _setcursortype(int curstype);
void textbackground(int bg);
void textcolor(int col);
-void putch(unsigned char chr);
-void putwch(unsigned chr);
+int putch(unsigned char chr);
+int putwch(unsigned chr);
void put_colour_ch(int colour, unsigned ch);
void writeWChar(unsigned char *ch);
@@ -55,11 +54,11 @@ inline void enable_smart_cursor(bool) { }
inline bool is_smart_cursor_enabled() { return false; }
-void window(int x1, int y1, int x2, int y2);
+int window(int x1, int y1, int x2, int y2);
-int getch();
+extern "C" int getch();
int getch_ck();
-void clrscr();
+int clrscr();
void message_out(int which_line, int colour, const char *s, int firstcol = 0, bool newline = true);
void cgotoxy(int x, int y, int region = GOTO_CRT);
void clear_message_window();
@@ -68,7 +67,7 @@ void update_screen();
int kbhit();
#ifdef UNIX
-char *strlwr(char *str);
+extern "C" char *strlwr(char *str);
int itoa(int value, char *strptr, int radix);
int stricmp(const char *str1, const char *str2);
#endif