diff --git a/src/p_lights.c b/src/p_lights.c index 58ab2e79944583d29d83c16e21283d8669358471..ba39bc72e13c4d2631936251909e6f5c1fc15d21 100644 --- a/src/p_lights.c +++ b/src/p_lights.c @@ -30,7 +30,7 @@ void P_RemoveLighting(sector_t *sector) // The thinker is the first member in all the lighting action structs, // so just let the thinker get freed, and that will free the whole // structure. - P_RemoveThinker(&((elevator_t *)sector->lightingdata)->thinker); + P_RemoveThinker(&((thinkerdata_t *)sector->lightingdata)->thinker); sector->lightingdata = NULL; } } @@ -144,7 +144,7 @@ void P_SpawnLightningFlash(sector_t *sector) minlight = ((lightflash_t *)sector->lightingdata)->minlight; } - P_RemoveThinker(&((elevator_t *)sector->lightingdata)->thinker); + P_RemoveThinker(&((thinkerdata_t *)sector->lightingdata)->thinker); } sector->lightingdata = NULL; diff --git a/src/p_spec.c b/src/p_spec.c index c460c5a9822a86ac463795fb587616652d4c4874..250aa4eef668e2179ebd231bf6586606dc1003f1 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2143,12 +2143,8 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) if (sectors[secnum].lightingdata) { // Stop the lighting madness going on in this sector! - P_RemoveThinker(&((elevator_t *)sectors[secnum].lightingdata)->thinker); + P_RemoveThinker(&((thinkerdata_t *)sectors[secnum].lightingdata)->thinker); sectors[secnum].lightingdata = NULL; - - // No, it's not an elevator_t, but any struct with a thinker_t named - // 'thinker' at the beginning will do here. (We don't know what it - // actually is: could be lightlevel_t, fireflicker_t, glow_t, etc.) } if (!(line->args[1] & TMLC_NOSECTOR)) @@ -2534,7 +2530,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) TAG_ITER_SECTORS(line->args[0], secnum) if (sectors[secnum].lightingdata) { - P_RemoveThinker(&((elevator_t *)sectors[secnum].lightingdata)->thinker); + P_RemoveThinker(&((thinkerdata_t *)sectors[secnum].lightingdata)->thinker); sectors[secnum].lightingdata = NULL; } break; @@ -3689,12 +3685,8 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) if (sectors[secnum].lightingdata) { // Stop any lighting effects going on in the sector - P_RemoveThinker(&((elevator_t *)sectors[secnum].lightingdata)->thinker); + P_RemoveThinker(&((thinkerdata_t *)sectors[secnum].lightingdata)->thinker); sectors[secnum].lightingdata = NULL; - - // No, it's not an elevator_t, but any struct with a thinker_t named - // 'thinker' at the beginning will do here. (We don't know what it - // actually is: could be lightlevel_t, fireflicker_t, glow_t, etc.) } if (line->args[2] == TML_FLOOR) @@ -8040,7 +8032,7 @@ static void P_ResetColormapFader(sector_t *sector) // The thinker is the first member in all the action structs, // so just let the thinker get freed, and that will free the whole // structure. - P_RemoveThinker(&((elevator_t *)sector->fadecolormapdata)->thinker); + P_RemoveThinker(&((thinkerdata_t *)sector->fadecolormapdata)->thinker); sector->fadecolormapdata = NULL; } } diff --git a/src/p_spec.h b/src/p_spec.h index adebf99d2834d4767637d770043241a5398fb206..c81839f22bd628233f0ad75b9f0b175d0d437e1e 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -219,6 +219,12 @@ void P_RunNightsCapsuleTouchExecutors(mobj_t *actor, boolean entering, boolean e UINT16 P_GetFFloorID(ffloor_t *fflr); ffloor_t *P_GetFFloorByID(sector_t *sec, UINT16 id); +// Use this when you don't know the type of your thinker data struct but need to access its thinker. +typedef struct +{ + thinker_t thinker; +} thinkerdata_t; + // // P_LIGHTS //