aboutsummaryrefslogtreecommitdiff
path: root/cRender.cpp
diff options
context:
space:
mode:
authorGravatar jonas <himself@jonasgunz.de> 2019-01-14 17:30:06 +0100
committerGravatar jonas <himself@jonasgunz.de> 2019-01-14 17:30:06 +0100
commit60ea1ae7257d60d3ee05f1b9d412a1bd441db7cb (patch)
tree819063addd6b1abf972adea2e49a83299280c9b2 /cRender.cpp
parent5d0b6dd79722707afb15642cc8523b36a6391e0d (diff)
downloadtermgl-60ea1ae7257d60d3ee05f1b9d412a1bd441db7cb.tar.gz
RTFM!! Error resulted in illegal coordiante pair for drawLine (x2 > x1)
Diffstat (limited to 'cRender.cpp')
-rw-r--r--cRender.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/cRender.cpp b/cRender.cpp
index a01418e..41908e1 100644
--- a/cRender.cpp
+++ b/cRender.cpp
@@ -88,6 +88,12 @@ int cRender::drawPoint(char _c, sPos _pos, bool _overrideCollision, WORD _color)
int cRender::drawLine(char _c, sPos _pos1, sPos _pos2, bool _overrideCollision, WORD _color)
{
+ if(_pos1.x > _pos2.x)
+ {
+ //Shit WILL go wrong
+ return drawLine(_c, _pos2, _pos1, _overrideCollision, _color);
+ }
+
if (_pos1.x == _pos2.x) { //Horizontal line
for (int i = _pos1.y; i <= _pos2.y; i++)
{