From 609db36f2e44aa915162422e7408726d76e7b2a1 Mon Sep 17 00:00:00 2001 From: Simon Robertshaw Date: Tue, 17 Apr 2012 16:14:42 +0100 Subject: [PATCH] TPT: Check coordinates of signs before using them to read pmap or pressure 8a11b6b31d --- src/Renderer.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Renderer.cpp b/src/Renderer.cpp index 79b63ecff..dba5a3b4a 100644 --- a/src/Renderer.cpp +++ b/src/Renderer.cpp @@ -379,15 +379,18 @@ void Renderer::DrawSigns() //Displaying special information if (strcmp(signs[i].text, "{p}")==0) { - sprintf(buff, "Pressure: %3.2f", sim->pv[signs[i].y/CELL][signs[i].x/CELL]); //...pressure + float pressure = 0.0f; + if (signs[i].x>=0 && signs[i].x=0 && signs[i].ypv[signs[i].y/CELL][signs[i].x/CELL]; + sprintf(buff, "Pressure: %3.2f", pressure); //...pressure g->drawtext(x+3, y+3, buff, 255, 255, 255, 255); } if (strcmp(signs[i].text, "{t}")==0) { - if (sim->pmap[signs[i].y][signs[i].x]) - sprintf(buff, "Temp: %4.2f", sim->parts[sim->pmap[signs[i].y][signs[i].x]>>8].temp-273.15); //...tempirature + if (signs[i].x>=0 && signs[i].x=0 && signs[i].ypmap[signs[i].y][signs[i].x]) + sprintf(buff, "Temp: %4.2f", sim->parts[sim->pmap[signs[i].y][signs[i].x]>>8].temp-273.15); //...temperature else - sprintf(buff, "Temp: 0.00"); //...tempirature + sprintf(buff, "Temp: 0.00"); //...temperature g->drawtext(x+3, y+3, buff, 255, 255, 255, 255); }