From 0ad225d1fcf8788baf9647974a82b17a9a482d15 Mon Sep 17 00:00:00 2001 From: jacob1 Date: Wed, 7 Jan 2015 19:32:49 -0500 Subject: [PATCH] update VIBR randoms, fix any VINE in old saves also --- src/client/GameSave.cpp | 11 +++++++++++ src/simulation/elements/VIBR.cpp | 9 +++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/client/GameSave.cpp b/src/client/GameSave.cpp index 8144e540c..6e2d9ae7e 100644 --- a/src/client/GameSave.cpp +++ b/src/client/GameSave.cpp @@ -1024,6 +1024,12 @@ void GameSave::readOPS(char * data, int dataLength) particles[newIndex].flags |= FLAG_PHOTDECO; } break; + case PT_VINE: + if (savedVersion < 91) + { + particles[newIndex].tmp = 1; + } + break; } //note: PSv was used in version 77.0 and every version before, add something in PSv too if the element is that old newIndex++; @@ -1676,6 +1682,11 @@ void GameSave::readPSv(char * data, int dataLength) particles[i-1].ctype = 0; } } + if (ver < 91) + { + if (particles[i-1].type == PT_VINE) + particles[i-1].tmp = 1; + } } } diff --git a/src/simulation/elements/VIBR.cpp b/src/simulation/elements/VIBR.cpp index 439b962cc..e639c0453 100644 --- a/src/simulation/elements/VIBR.cpp +++ b/src/simulation/elements/VIBR.cpp @@ -116,18 +116,19 @@ int Element_VIBR::update(UPDATE_FUNC_ARGS) { if (!parts[i].tmp2) { rndstore = rand(); - sim->create_part(i, x, y, PT_EXOT); - parts[i].tmp2 = rand()%1000; int index = sim->create_part(-3,x+((rndstore>>4)&3)-1,y+((rndstore>>6)&3)-1,PT_ELEC); if (index != -1) parts[index].temp = 7000; index = sim->create_part(-3,x+((rndstore>>8)&3)-1,y+((rndstore>>10)&3)-1,PT_PHOT); if (index != -1) parts[index].temp = 7000; - index = sim->create_part(-1,x+((rndstore>>12)&3)-1,y+rand()%3-1,PT_BREC); + int rx = ((rndstore>>12)&3)-1; + rndstore = rand(); + index = sim->create_part(-1,x+rx-1,y+rndstore%3-1,PT_BREC); if (index != -1) parts[index].temp = 7000; - parts[i].tmp2 = (rndstore>>16) % 1000; + sim->create_part(i, x, y, PT_EXOT); + parts[i].tmp2 = (rndstore>>2)%1000; parts[i].temp=9000; sim->pv[y/CELL][x/CELL] += 50;