summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJacob1 <jfu614@gmail.com>2012-03-14 22:58:52 (GMT)
committer Jacob1 <jfu614@gmail.com>2012-03-14 22:58:52 (GMT)
commit134869d5e22847873e4fbff03bcd2f7a72fdaebe (patch)
treead5568fcf9fea54c39aeaeed8240eece47802761 /src
parent5a98d30a8f576f630e912fd3480ff14989e16038 (diff)
downloadpowder-134869d5e22847873e4fbff03bcd2f7a72fdaebe.zip
powder-134869d5e22847873e4fbff03bcd2f7a72fdaebe.tar.gz
Fix rx = 0 crash
Diffstat (limited to 'src')
-rw-r--r--src/graphics.c3
-rw-r--r--src/powder.c7
2 files changed, 4 insertions, 6 deletions
diff --git a/src/graphics.c b/src/graphics.c
index 567b497..410617c 100644
--- a/src/graphics.c
+++ b/src/graphics.c
@@ -3633,9 +3633,6 @@ void render_cursor(pixel *vid, int x, int y, int t, int rx, int ry)
if (rx<=0)
for (j = y - ry; j <= y + ry; j++)
xor_pixel(x, j, vid);
- else if (ry<=0)
- for (i = x - rx; i <= x + rx; i++)
- xor_pixel(i, y, vid);
else
{
int tempy = y, i, j, jmax, oldy;
diff --git a/src/powder.c b/src/powder.c
index 8c000e5..13924d3 100644
--- a/src/powder.c
+++ b/src/powder.c
@@ -3086,10 +3086,11 @@ int create_parts(int x, int y, int rx, int ry, int c, int flags, int fill)
else // normal draw
fn = 3;
- if (rx==0&&ry==0)
+ if (rx<=0) //workaround for rx == 0 crashing. todo: find a better fix later.
{
- if (create_parts2(fn,i,j,c,rx,ry,flags))
- f = 1;
+ for (j = y - ry; j <= y + ry; j++)
+ if (create_parts2(fn,x,j,c,rx,ry,flags))
+ f = 1;
}
else
{