Skip to content

Commit

Permalink
Fixed|libcommon|XG: Erroneous attempt to allocate dummy map line sides
Browse files Browse the repository at this point in the history
As of Doomsday 1.10 the sides of a map line are now automatically
allocated along with the line itself. XG was attempting to allocate
additional sides and then link them to a dummy line itself.
  • Loading branch information
danij-deng committed Aug 13, 2013
1 parent d3eaba0 commit d3b5de5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 40 deletions.
4 changes: 0 additions & 4 deletions doomsday/plugins/common/include/dmu_lib.h
Expand Up @@ -159,10 +159,6 @@ Line *P_AllocDummyLine(void);

void P_FreeDummyLine(Line *line);

Side *P_AllocDummySide(void);

void P_FreeDummySide(Side *side);

/**
* Get the sector on the other side of the line that is NOT the given sector.
*
Expand Down
10 changes: 0 additions & 10 deletions doomsday/plugins/common/src/dmu_lib.cpp
Expand Up @@ -51,16 +51,6 @@ void P_FreeDummyLine(Line *line)
P_FreeDummy(line);
}

Side *P_AllocDummySide()
{
return (Side *)P_AllocDummy(DMU_SIDE, 0);
}

void P_FreeDummySide(Side *side)
{
P_FreeDummy(side);
}

void P_CopyLine(Line *dest, Line *src)
{
xline_t *xsrc = P_ToXLine(src);
Expand Down
18 changes: 3 additions & 15 deletions doomsday/plugins/common/src/p_xgline.c
Expand Up @@ -2523,23 +2523,14 @@ int XL_HitLine(Line *line, int sidenum, mobj_t *thing)

void XL_DoChain(Line *line, int chain, boolean activating, mobj_t *actThing)
{
Side *dummyFrontSideDef, *dummyBackSideDef = NULL;
Line *dummyLineDef;
xline_t *xdummyLineDef;
// We'll use a dummy for the chain.
Line *dummyLineDef = P_AllocDummyLine();
xline_t *xdummyLineDef = P_ToXLine(dummyLineDef);

// We'll use dummies for the chain.
dummyLineDef = P_AllocDummyLine();
xdummyLineDef = P_ToXLine(dummyLineDef);
xdummyLineDef->xg = Z_Calloc(sizeof(xgline_t), PU_MAP, 0);
dummyFrontSideDef = P_AllocDummySide();
P_SetPtrp(dummyLineDef, DMU_FRONT, dummyFrontSideDef);
P_SetPtrp(dummyFrontSideDef, DMU_LINE, dummyLineDef);
P_SetPtrp(dummyLineDef, DMU_FRONT_SECTOR, P_GetPtrp(line, DMU_FRONT_SECTOR));
if(0 != P_GetPtrp(line, DMU_BACK))
{
dummyBackSideDef = P_AllocDummySide();
P_SetPtrp(dummyLineDef, DMU_BACK, dummyBackSideDef);
P_SetPtrp(dummyBackSideDef, DMU_LINE, dummyLineDef);
P_SetPtrp(dummyLineDef, DMU_BACK_SECTOR, P_GetPtrp(line, DMU_BACK_SECTOR));
}

Expand All @@ -2556,9 +2547,6 @@ void XL_DoChain(Line *line, int chain, boolean activating, mobj_t *actThing)

Z_Free(xdummyLineDef->xg);
P_FreeDummyLine(dummyLineDef);
P_FreeDummySide(dummyFrontSideDef);
if(dummyBackSideDef)
P_FreeDummySide(dummyBackSideDef);
}

/**
Expand Down
17 changes: 6 additions & 11 deletions doomsday/plugins/common/src/p_xgsec.c
Expand Up @@ -2616,15 +2616,14 @@ void XS_UpdateLight(Sector* sec)
}
}

void XS_DoChain(Sector* sec, int ch, int activating, void* act_thing)
void XS_DoChain(Sector *sec, int ch, int activating, void *act_thing)
{
xgsector_t* xg;
sectortype_t* info;
xgsector_t *xg;
sectortype_t *info;
float flevtime = TIC2FLT(mapTime);
Line* dummyLine;
xline_t* xdummyLine;
linetype_t* ltype;
Side* dummySideDef;
Line *dummyLine;
xline_t *xdummyLine;
linetype_t *ltype;

xg = P_ToXSector(sec)->xg;
info = &xg->info;
Expand All @@ -2650,11 +2649,8 @@ void XS_DoChain(Sector* sec, int ch, int activating, void* act_thing)
dummyLine = P_AllocDummyLine();
xdummyLine = P_ToXLine(dummyLine);
xdummyLine->xg = Z_Calloc(sizeof(xgline_t), PU_MAP, 0);
dummySideDef = P_AllocDummySide();

P_SetPtrp(dummyLine, DMU_FRONT, dummySideDef);
P_SetPtrp(dummyLine, DMU_FRONT_SECTOR, sec);
P_SetPtrp(dummySideDef, DMU_LINE, dummyLine);

xdummyLine->special = (ch == XSCE_FUNCTION ? activating : info->chain[ch]);

Expand Down Expand Up @@ -2708,7 +2704,6 @@ void XS_DoChain(Sector* sec, int ch, int activating, void* act_thing)
// We're done, free the dummies.
Z_Free(xdummyLine->xg);
P_FreeDummyLine(dummyLine);
P_FreeDummySide(dummySideDef);
}

static boolean checkChainRequirements(Sector* sec, mobj_t* mo, int ch,
Expand Down

0 comments on commit d3b5de5

Please sign in to comment.