mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-19 07:01:09 +00:00
- RR: clear jaildoors array on map start.
this was leaving stale data behind which could cause nasty crashes.
This commit is contained in:
parent
79c671b890
commit
af89c25151
2 changed files with 5 additions and 4 deletions
|
@ -24,9 +24,10 @@ void M_Autosave();
|
||||||
|
|
||||||
template<> inline FSerializer& Serialize(FSerializer& arc, const char* keyname, sectortype*& w, sectortype** def)
|
template<> inline FSerializer& Serialize(FSerializer& arc, const char* keyname, sectortype*& w, sectortype** def)
|
||||||
{
|
{
|
||||||
|
assert(arc.isReading() || w == nullptr || (w >= §or[0] && w <= §or.Last()));
|
||||||
int ndx = w ? sectnum(w) : -1;
|
int ndx = w ? sectnum(w) : -1;
|
||||||
arc(keyname, ndx);
|
arc(keyname, ndx);
|
||||||
w = ndx == -1 ? nullptr : §or[ndx];
|
w = !validSectorIndex(ndx) ? nullptr : §or[ndx];
|
||||||
return arc;
|
return arc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +35,7 @@ template<> inline FSerializer& Serialize(FSerializer& arc, const char* keyname,
|
||||||
{
|
{
|
||||||
int ndx = w ? wallnum(w) : -1;
|
int ndx = w ? wallnum(w) : -1;
|
||||||
arc(keyname, ndx);
|
arc(keyname, ndx);
|
||||||
w = ndx == -1 ? nullptr : &wall[ndx];
|
w = !validWallIndex(ndx) ? nullptr : &wall[ndx];
|
||||||
return arc;
|
return arc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,6 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
|
||||||
BEGIN_DUKE_NS
|
BEGIN_DUKE_NS
|
||||||
|
|
||||||
static int torchcnt;
|
static int torchcnt;
|
||||||
static int jaildoorcnt;
|
|
||||||
static int lightnincnt;
|
static int lightnincnt;
|
||||||
|
|
||||||
static sectortype* torchsector[64];
|
static sectortype* torchsector[64];
|
||||||
|
@ -84,7 +83,7 @@ static int windertime;
|
||||||
|
|
||||||
void lava_cleararrays()
|
void lava_cleararrays()
|
||||||
{
|
{
|
||||||
jaildoorcnt = 0;
|
jaildoors.Clear();
|
||||||
minecarts.Clear();
|
minecarts.Clear();
|
||||||
torchcnt = 0;
|
torchcnt = 0;
|
||||||
lightnincnt = 0;
|
lightnincnt = 0;
|
||||||
|
@ -274,6 +273,7 @@ void dojaildoor(void)
|
||||||
for(auto& jd : jaildoors)
|
for(auto& jd : jaildoors)
|
||||||
{
|
{
|
||||||
auto sectp = jd.sect;
|
auto sectp = jd.sect;
|
||||||
|
if (!sectp) continue; // this is only for allowing old, broken savegames to work, this would crash otherwise.
|
||||||
double speed = max(2, jd.speed) * maptoworld;
|
double speed = max(2, jd.speed) * maptoworld;
|
||||||
|
|
||||||
if (jd.open == 1 || jd.open == 3)
|
if (jd.open == 1 || jd.open == 3)
|
||||||
|
|
Loading…
Reference in a new issue