fix crash when drawing particles in invalid coordinates (using console)
This commit is contained in:
parent
846d7d8064
commit
17d79e8d8e
@ -1172,10 +1172,10 @@ void Renderer::render_parts()
|
|||||||
fnx = sim->parts[i].x;
|
fnx = sim->parts[i].x;
|
||||||
fny = sim->parts[i].y;
|
fny = sim->parts[i].y;
|
||||||
|
|
||||||
if((sim->photons[ny][nx]&0xFF) && !(sim->elements[t].Properties & TYPE_ENERGY) && t!=PT_STKM && t!=PT_STKM2 && t!=PT_FIGH)
|
|
||||||
continue;
|
|
||||||
if(nx >= XRES || nx < 0 || ny >= YRES || ny < 0)
|
if(nx >= XRES || nx < 0 || ny >= YRES || ny < 0)
|
||||||
continue;
|
continue;
|
||||||
|
if((sim->photons[ny][nx]&0xFF) && !(sim->elements[t].Properties & TYPE_ENERGY) && t!=PT_STKM && t!=PT_STKM2 && t!=PT_FIGH)
|
||||||
|
continue;
|
||||||
|
|
||||||
//Defaults
|
//Defaults
|
||||||
pixel_mode = 0 | PMODE_FLAT;
|
pixel_mode = 0 | PMODE_FLAT;
|
||||||
|
@ -1,10 +1,3 @@
|
|||||||
/*
|
|
||||||
* PreviewController.cpp
|
|
||||||
*
|
|
||||||
* Created on: Jan 21, 2012
|
|
||||||
* Author: Simon
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include "client/Client.h"
|
#include "client/Client.h"
|
||||||
#include "PreviewController.h"
|
#include "PreviewController.h"
|
||||||
|
@ -1,10 +1,3 @@
|
|||||||
/*
|
|
||||||
* PreviewModel.cpp
|
|
||||||
*
|
|
||||||
* Created on: Jan 21, 2012
|
|
||||||
* Author: Simon
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include "PreviewModel.h"
|
#include "PreviewModel.h"
|
||||||
#include "client/Client.h"
|
#include "client/Client.h"
|
||||||
@ -25,7 +18,6 @@ PreviewModel::PreviewModel():
|
|||||||
commentsPageNumber(1),
|
commentsPageNumber(1),
|
||||||
commentBoxEnabled(false)
|
commentBoxEnabled(false)
|
||||||
{
|
{
|
||||||
// TODO Auto-generated constructor stub
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,10 +1,3 @@
|
|||||||
/*
|
|
||||||
* PreviewView.cpp
|
|
||||||
*
|
|
||||||
* Created on: Jan 21, 2012
|
|
||||||
* Author: Simon
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
@ -274,7 +267,7 @@ void PreviewView::OnDraw()
|
|||||||
g->drawrect(Position.X, Position.Y, (XRES/2)+1, (YRES/2)+1, 255, 255, 255, 100);
|
g->drawrect(Position.X, Position.Y, (XRES/2)+1, (YRES/2)+1, 255, 255, 255, 100);
|
||||||
g->draw_line(Position.X+XRES/2, Position.Y+1, Position.X+XRES/2, Position.Y+Size.Y-2, 200, 200, 200, 255);
|
g->draw_line(Position.X+XRES/2, Position.Y+1, Position.X+XRES/2, Position.Y+Size.Y-2, 200, 200, 200, 255);
|
||||||
|
|
||||||
if(!(!votesUp && !votesDown))
|
if(votesUp || votesDown)
|
||||||
{
|
{
|
||||||
float ryf;
|
float ryf;
|
||||||
int nyu, nyd;
|
int nyu, nyd;
|
||||||
@ -573,5 +566,7 @@ PreviewView::~PreviewView()
|
|||||||
RemoveComponent(submitCommentButton);
|
RemoveComponent(submitCommentButton);
|
||||||
delete submitCommentButton;
|
delete submitCommentButton;
|
||||||
}
|
}
|
||||||
|
if(savePreview)
|
||||||
|
delete savePreview;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3555,7 +3555,7 @@ void Simulation::update_particles_i(int start, int inc)
|
|||||||
{
|
{
|
||||||
golnum = parts[r>>8].ctype+1;
|
golnum = parts[r>>8].ctype+1;
|
||||||
if (golnum<=0 || golnum>NGOLALT) {
|
if (golnum<=0 || golnum>NGOLALT) {
|
||||||
parts[r>>8].type = PT_NONE;
|
kill_part(r>>8);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (parts[r>>8].tmp == grule[golnum][9]-1) {
|
if (parts[r>>8].tmp == grule[golnum][9]-1) {
|
||||||
@ -3575,7 +3575,7 @@ void Simulation::update_particles_i(int start, int inc)
|
|||||||
} else {
|
} else {
|
||||||
parts[r>>8].tmp --;
|
parts[r>>8].tmp --;
|
||||||
if (parts[r>>8].tmp<=0)
|
if (parts[r>>8].tmp<=0)
|
||||||
parts[r>>8].type = PT_NONE;//using kill_part makes it not work
|
kill_part(r>>8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//}
|
//}
|
||||||
@ -3604,7 +3604,7 @@ void Simulation::update_particles_i(int start, int inc)
|
|||||||
parts[r>>8].tmp --;
|
parts[r>>8].tmp --;
|
||||||
}
|
}
|
||||||
if (r && parts[r>>8].tmp<=0)
|
if (r && parts[r>>8].tmp<=0)
|
||||||
parts[r>>8].type = PT_NONE;//using kill_part makes it not work
|
kill_part(r>>8);
|
||||||
}
|
}
|
||||||
for ( z = 0; z<=NGOL; z++)
|
for ( z = 0; z<=NGOL; z++)
|
||||||
gol2[ny][nx][z] = 0;//this improves performance A LOT compared to the memset, i was getting ~23 more fps with this.
|
gol2[ny][nx][z] = 0;//this improves performance A LOT compared to the memset, i was getting ~23 more fps with this.
|
||||||
|
Reference in New Issue
Block a user