Skip to content
Permalink
Browse files

Maybe fix the Windows segfault when firing at out-of-view monsters

  • Loading branch information...
ethankaminski committed Mar 29, 2013
1 parent ceed705 commit 013812de4dc9960a83099fba15a0c7b8ce3f3543
Showing with 10 additions and 1 deletion.
  1. +5 −0 catacurse.cpp
  2. +5 −1 output.cpp
@@ -157,6 +157,7 @@ inline void FillRectDIB(int x, int y, int width, int height, unsigned char color
{
int j;
for (j=y; j<y+height; j++)
//NOTE TO FUTURE: this breaks if j is negative. Apparently it doesn't break if j is too large, though?
memset(&dcbits[x+j*WindowWidth],color,width);
};

@@ -331,6 +332,10 @@ fin.open("data\\FONTDATA");

WINDOW *newwin(int nlines, int ncols, int begin_y, int begin_x)
{
if (begin_y < 0 || begin_x < 0) {
return NULL; //it's the caller's problem now (since they have logging functions declared)
}

int i,j;
WINDOW *newwindow = new WINDOW;
//newwindow=&_windows[WindowCount];
@@ -931,7 +931,11 @@ void draw_tab(WINDOW *w, int iOffsetX, std::string sText, bool bSelected)

void hit_animation(int iX, int iY, nc_color cColor, char cTile, int iTimeout)
{
/* WINDOW *w_hit = newwin(1, 1, iY+VIEW_OFFSET_Y, iX+VIEW_OFFSET_X);
WINDOW *w_hit = newwin(1, 1, iY+VIEW_OFFSET_Y, iX+VIEW_OFFSET_X);
if (w_hit == NULL) {
return; //we passed in negative values (semi-expected), so let's not segfault
}

mvwputch(w_hit, 0, 0, cColor, cTile);
wrefresh(w_hit);

0 comments on commit 013812d

Please sign in to comment.
You can’t perform that action at this time.