fix piston bugs, fix crashes, don't use bluescreens when compiled with debug mode in visual studio
This commit is contained in:
parent
e7a3fd1c29
commit
3203e597b9
@ -779,7 +779,7 @@ int main(int argc, char * argv[])
|
|||||||
engine->Begin(XRES+BARSIZE, YRES+MENUSIZE);
|
engine->Begin(XRES+BARSIZE, YRES+MENUSIZE);
|
||||||
engine->SetFastQuit(Client::Ref().GetPrefBool("FastQuit", true));
|
engine->SetFastQuit(Client::Ref().GetPrefBool("FastQuit", true));
|
||||||
|
|
||||||
#ifndef DEBUG
|
#if !defined(DEBUG) && !defined(_DEBUG)
|
||||||
//Get ready to catch any dodgy errors
|
//Get ready to catch any dodgy errors
|
||||||
signal(SIGSEGV, SigHandler);
|
signal(SIGSEGV, SigHandler);
|
||||||
signal(SIGFPE, SigHandler);
|
signal(SIGFPE, SigHandler);
|
||||||
|
@ -252,7 +252,7 @@ void PreviewModel::Update()
|
|||||||
delete updateSaveDataInfo;
|
delete updateSaveDataInfo;
|
||||||
updateSaveDataInfo = NULL;
|
updateSaveDataInfo = NULL;
|
||||||
|
|
||||||
if (save)
|
if (save && saveData)
|
||||||
{
|
{
|
||||||
commentsTotal = save->Comments;
|
commentsTotal = save->Comments;
|
||||||
try
|
try
|
||||||
@ -279,7 +279,7 @@ void PreviewModel::Update()
|
|||||||
delete updateSaveInfoInfo;
|
delete updateSaveInfoInfo;
|
||||||
updateSaveInfoInfo = NULL;
|
updateSaveInfoInfo = NULL;
|
||||||
|
|
||||||
if (save)
|
if (save && saveData)
|
||||||
{
|
{
|
||||||
commentsTotal = save->Comments;
|
commentsTotal = save->Comments;
|
||||||
try
|
try
|
||||||
|
@ -308,7 +308,7 @@ void Simulation::Restore(const Snapshot & snap)
|
|||||||
{
|
{
|
||||||
parts_lastActiveIndex = NPART-1;
|
parts_lastActiveIndex = NPART-1;
|
||||||
|
|
||||||
for(int i; i<NPART; i++)
|
for(int i = 0; i<NPART; i++)
|
||||||
elementCount[i] = 0;
|
elementCount[i] = 0;
|
||||||
|
|
||||||
std::copy(snap.AirPressure.begin(), snap.AirPressure.end(), &pv[0][0]);
|
std::copy(snap.AirPressure.begin(), snap.AirPressure.end(), &pv[0][0]);
|
||||||
|
@ -168,7 +168,7 @@ int Element_PSTN::update(UPDATE_FUNC_ARGS)
|
|||||||
int Element_PSTN::CanMoveStack(Simulation * sim, int stackX, int stackY, int directionX, int directionY, int maxSize, int amount, bool retract, int block)
|
int Element_PSTN::CanMoveStack(Simulation * sim, int stackX, int stackY, int directionX, int directionY, int maxSize, int amount, bool retract, int block)
|
||||||
{
|
{
|
||||||
int posX, posY, r, spaces = 0, currentPos = 0;
|
int posX, posY, r, spaces = 0, currentPos = 0;
|
||||||
if (amount == 0)
|
if (amount <= 0)
|
||||||
return 0;
|
return 0;
|
||||||
for(posX = stackX, posY = stackY; currentPos < maxSize + amount; posX += directionX, posY += directionY) {
|
for(posX = stackX, posY = stackY; currentPos < maxSize + amount; posX += directionX, posY += directionY) {
|
||||||
if (!(posX < XRES && posY < YRES && posX >= 0 && posY >= 0)) {
|
if (!(posX < XRES && posY < YRES && posX >= 0 && posY >= 0)) {
|
||||||
@ -176,14 +176,14 @@ int Element_PSTN::CanMoveStack(Simulation * sim, int stackX, int stackY, int dir
|
|||||||
}
|
}
|
||||||
r = sim->pmap[posY][posX];
|
r = sim->pmap[posY][posX];
|
||||||
if (sim->IsWallBlocking(posX, posY, 0) || (block && (r&0xFF) == block))
|
if (sim->IsWallBlocking(posX, posY, 0) || (block && (r&0xFF) == block))
|
||||||
break;
|
return spaces;
|
||||||
if(!r) {
|
if(!r) {
|
||||||
spaces++;
|
spaces++;
|
||||||
tempParts[currentPos++] = -1;
|
tempParts[currentPos++] = -1;
|
||||||
if(spaces >= amount)
|
if(spaces >= amount)
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
if(spaces < maxSize && !retract)
|
if(spaces < maxSize && currentPos < maxSize && (!retract || ((r&0xFF) == PT_FRME) && posX == stackX && posY == stackY))
|
||||||
tempParts[currentPos++] = r>>8;
|
tempParts[currentPos++] = r>>8;
|
||||||
else
|
else
|
||||||
return spaces;
|
return spaces;
|
||||||
@ -212,7 +212,7 @@ int Element_PSTN::MoveStack(Simulation * sim, int stackX, int stackY, int direct
|
|||||||
posY = stackY + (c*newY);
|
posY = stackY + (c*newY);
|
||||||
posX = stackX + (c*newX);
|
posX = stackX + (c*newX);
|
||||||
if (posX < XRES && posY < YRES && posX >= 0 && posY >= 0 && (sim->pmap[posY][posX]&0xFF) == PT_FRME) {
|
if (posX < XRES && posY < YRES && posX >= 0 && posY >= 0 && (sim->pmap[posY][posX]&0xFF) == PT_FRME) {
|
||||||
int val = CanMoveStack(sim, posX+realDirectionX, posY+realDirectionY, realDirectionX, realDirectionY, maxSize, amount, retract, block);
|
int val = CanMoveStack(sim, posX, posY, realDirectionX, realDirectionY, maxSize, amount, retract, block);
|
||||||
if(val < amount)
|
if(val < amount)
|
||||||
amount = val;
|
amount = val;
|
||||||
} else {
|
} else {
|
||||||
@ -224,7 +224,7 @@ int Element_PSTN::MoveStack(Simulation * sim, int stackX, int stackY, int direct
|
|||||||
posY = stackY - (c*newY);
|
posY = stackY - (c*newY);
|
||||||
posX = stackX - (c*newX);
|
posX = stackX - (c*newX);
|
||||||
if (posX < XRES && posY < YRES && posX >= 0 && posY >= 0 && (sim->pmap[posY][posX]&0xFF) == PT_FRME) {
|
if (posX < XRES && posY < YRES && posX >= 0 && posY >= 0 && (sim->pmap[posY][posX]&0xFF) == PT_FRME) {
|
||||||
int val = CanMoveStack(sim, posX+realDirectionX, posY+realDirectionY, realDirectionX, realDirectionY, maxSize, amount, retract, block);
|
int val = CanMoveStack(sim, posX, posY, realDirectionX, realDirectionY, maxSize, amount, retract, block);
|
||||||
if(val < amount)
|
if(val < amount)
|
||||||
amount = val;
|
amount = val;
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user