Wratted all calls to G_FreeEnt() to avoid crashing and provide debugging

This commit is contained in:
Richard Allen 2003-04-26 22:33:07 +00:00
parent 386ff49727
commit dcdffe91a9
17 changed files with 152 additions and 75 deletions

View file

@ -10,6 +10,9 @@
* Fixed a bug in the replacement code with grenades * Fixed a bug in the replacement code with grenades
* In some circumstanses you would also get chest damage from a headshot * In some circumstanses you would also get chest damage from a headshot
* Bug in the UI radiobind code fixed. * Bug in the UI radiobind code fixed.
* In-game server browser now fixed to show RQ3 3.x games, yay!
* Added an error message to the /radio command to let you know if your bind is messed up and you're trying to play a radio sound that does not exist
* Allowed CTB radio sounds to also be played in other team-based modes
# List fixes here for the 3.0 release # List fixes here for the 3.0 release

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.134 2003/04/26 22:33:06 jbravo
// Wratted all calls to G_FreeEnt() to avoid crashing and provide debugging
//
// Revision 1.133 2003/04/23 17:49:11 slicer // Revision 1.133 2003/04/23 17:49:11 slicer
// Fixed Crash Bug caused by merging 1.32 source code // Fixed Crash Bug caused by merging 1.32 source code
// //
@ -2023,7 +2026,7 @@ void ClientDisconnect(int clientNum)
// JBravo: if the client had a laser, turn it off so it doesnt stay there forever. // JBravo: if the client had a laser, turn it off so it doesnt stay there forever.
if (ent->client->lasersight) { if (ent->client->lasersight) {
G_FreeEntity(ent->client->lasersight); G_FreeEntity(ent->client->lasersight, __LINE__, __FILE__);
ent->client->lasersight = NULL; ent->client->lasersight = NULL;
} }
// stop any following clients // stop any following clients

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.188 2003/04/26 22:33:06 jbravo
// Wratted all calls to G_FreeEnt() to avoid crashing and provide debugging
//
// Revision 1.187 2003/04/19 15:27:30 jbravo // Revision 1.187 2003/04/19 15:27:30 jbravo
// Backing out of most of unlagged. Only optimized prediction and smooth clients // Backing out of most of unlagged. Only optimized prediction and smooth clients
// remains. // remains.
@ -816,7 +819,7 @@ void Cmd_Give_f(gentity_t * ent)
memset(&trace, 0, sizeof(trace)); memset(&trace, 0, sizeof(trace));
Touch_Item(it_ent, ent, &trace); Touch_Item(it_ent, ent, &trace);
if (it_ent->inuse) { if (it_ent->inuse) {
G_FreeEntity(it_ent); G_FreeEntity(it_ent, __LINE__, __FILE__);
} }
} }
} }

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.140 2003/04/26 22:33:06 jbravo
// Wratted all calls to G_FreeEnt() to avoid crashing and provide debugging
//
// Revision 1.139 2003/04/26 02:03:51 jbravo // Revision 1.139 2003/04/26 02:03:51 jbravo
// Helmet fixes // Helmet fixes
// //
@ -1193,7 +1196,7 @@ void player_die(gentity_t * self, gentity_t * inflictor, gentity_t * attacker, i
//JBravo: switch off the lasersight //JBravo: switch off the lasersight
if (self->client->lasersight) { if (self->client->lasersight) {
G_FreeEntity(self->client->lasersight); G_FreeEntity(self->client->lasersight, __LINE__, __FILE__);
self->client->lasersight = NULL; self->client->lasersight = NULL;
} }
// JBravo: clear the gib flag // JBravo: clear the gib flag

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.56 2003/04/26 22:33:06 jbravo
// Wratted all calls to G_FreeEnt() to avoid crashing and provide debugging
//
// Revision 1.55 2003/03/22 20:29:26 jbravo // Revision 1.55 2003/03/22 20:29:26 jbravo
// wrapping linkent and unlinkent calls // wrapping linkent and unlinkent calls
// //
@ -835,7 +838,7 @@ gentity_t *LaunchItem(gitem_t * item, vec3_t origin, vec3_t velocity, int xr_fla
dropped->nextthink = level.time + RQ3_RESPAWNTIME_DEFAULT; dropped->nextthink = level.time + RQ3_RESPAWNTIME_DEFAULT;
} else { } else {
// auto-remove after 30 seconds // auto-remove after 30 seconds
dropped->think = G_FreeEntity; dropped->think = G_RealFreeEntity;
dropped->nextthink = level.time + 30000; dropped->nextthink = level.time + 30000;
} }
@ -977,7 +980,7 @@ void FinishSpawningItem(gentity_t * ent)
trap_Trace(&tr, ent->s.origin, ent->r.mins, ent->r.maxs, dest, ent->s.number, MASK_SOLID); trap_Trace(&tr, ent->s.origin, ent->r.mins, ent->r.maxs, dest, ent->s.number, MASK_SOLID);
if (tr.startsolid) { if (tr.startsolid) {
G_Printf("FinishSpawningItem: %s startsolid at %s\n", ent->classname, vtos(ent->s.origin)); G_Printf("FinishSpawningItem: %s startsolid at %s\n", ent->classname, vtos(ent->s.origin));
G_FreeEntity(ent); G_FreeEntity(ent, __LINE__, __FILE__);
return; return;
} }
// allow to ride movers // allow to ride movers
@ -1320,7 +1323,7 @@ void G_RunItem(gentity_t * ent)
} else if (ent->item && ent->item->giType == IT_HOLDABLE) { } else if (ent->item && ent->item->giType == IT_HOLDABLE) {
RQ3_DroppedItemThink(ent); RQ3_DroppedItemThink(ent);
} else { } else {
G_FreeEntity(ent); G_FreeEntity(ent, __LINE__, __FILE__);
} }
return; return;
} }
@ -1355,7 +1358,7 @@ void RQ3_DroppedWeaponThink(gentity_t * ent)
case WP_KNIFE: case WP_KNIFE:
case WP_GRENADE: case WP_GRENADE:
//Just free the entity //Just free the entity
G_FreeEntity(ent); G_FreeEntity(ent, __LINE__, __FILE__);
return; return;
break; break;
case WP_AKIMBO: case WP_AKIMBO:
@ -1432,7 +1435,7 @@ void RQ3_ResetWeapon(int weapon)
(ent->flags & FL_RQ3_JUNKITEM) == FL_RQ3_JUNKITEM) { (ent->flags & FL_RQ3_JUNKITEM) == FL_RQ3_JUNKITEM) {
//Elder: removed because of possible door collision removal //Elder: removed because of possible door collision removal
//level.time - ent->timestamp >= RQ3_RESPAWNTIME_DEFAULT) { //level.time - ent->timestamp >= RQ3_RESPAWNTIME_DEFAULT) {
G_FreeEntity(ent); G_FreeEntity(ent, __LINE__, __FILE__);
numRemoved++; numRemoved++;
} else { } else {
//rent = ent; //rent = ent;
@ -1477,12 +1480,12 @@ void RQ3_DroppedItemThink(gentity_t * ent)
case HI_SLIPPERS: case HI_SLIPPERS:
case HI_HELMET: case HI_HELMET:
RQ3_ResetItem(ent->item->giTag); RQ3_ResetItem(ent->item->giTag);
G_FreeEntity(ent); G_FreeEntity(ent, __LINE__, __FILE__);
break; break;
default: default:
//Elder: shouldn't have to come here //Elder: shouldn't have to come here
G_Printf("RQ3_DroppedItemThink: Out of range or invalid item %d\n", ent->item->giTag); G_Printf("RQ3_DroppedItemThink: Out of range or invalid item %d\n", ent->item->giTag);
G_FreeEntity(ent); G_FreeEntity(ent, __LINE__, __FILE__);
break; break;
} }
} }

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.141 2003/04/26 22:33:06 jbravo
// Wratted all calls to G_FreeEnt() to avoid crashing and provide debugging
//
// Revision 1.140 2003/04/19 17:41:26 jbravo // Revision 1.140 2003/04/19 17:41:26 jbravo
// Applied changes that where in 1.29h -> 1.32b gamecode. // Applied changes that where in 1.29h -> 1.32b gamecode.
// //
@ -1044,7 +1047,8 @@ gentity_t *G_TempEntity(vec3_t origin, int event);
//Elder: added //Elder: added
gentity_t *G_TempEntity2(vec3_t origin, int event, int eParm); gentity_t *G_TempEntity2(vec3_t origin, int event, int eParm);
void G_Sound(gentity_t * ent, int channel, int soundIndex); void G_Sound(gentity_t * ent, int channel, int soundIndex);
void G_FreeEntity(gentity_t * e); void G_FreeEntity(gentity_t * e, int line, char *file);
void G_RealFreeEntity(gentity_t * e);
//Elder: added //Elder: added
void RQ3_SaveZoomLevel(gentity_t * ent); void RQ3_SaveZoomLevel(gentity_t * ent);

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.147 2003/04/26 22:33:06 jbravo
// Wratted all calls to G_FreeEnt() to avoid crashing and provide debugging
//
// Revision 1.146 2003/04/26 15:23:57 jbravo // Revision 1.146 2003/04/26 15:23:57 jbravo
// grenade replacement fix. Version bumped to 3.1 // grenade replacement fix. Version bumped to 3.1
// //
@ -802,19 +805,19 @@ Written by JBravo to catch the bad gEnt bug
void trap_RQ3LinkEntity(gentity_t *ent, int line, char *file) void trap_RQ3LinkEntity(gentity_t *ent, int line, char *file)
{ {
if (ent == NULL) { if (ent == NULL) {
trap_SendServerCommand(-1, va("print \"^1trap_LinkEntity got called with a NULL ent from line %d of file %s\n\"", line, file)); trap_SendServerCommand(-1, va("print \"^1trap_LinkEntity got called with a NULL ent from line %d of file %s. PLEASE report this to the RQ3 team\n\"", line, file));
G_Printf("^1trap_LinkEntity got called with a NULL ent from line %d of file %s\n", line, file); G_Printf("^1trap_LinkEntity got called with a NULL ent from line %d of file %s. PLEASE report this to the RQ3 team\n", line, file);
G_LogPrintf("trap_LinkEntity got called with a NULL ent from line %d of file %s\n", line, file); G_LogPrintf("trap_LinkEntity got called with a NULL ent from line %d of file %s. PLEASE report this to the RQ3 team\n", line, file);
} }
if (ent-g_entities < 0 || ent-g_entities > level.num_entities) { if (ent-g_entities < 0 || ent-g_entities > level.num_entities) {
trap_SendServerCommand(-1, va("print \"^1trap_LinkEntity got called with a unaligned ent from line %d of file %s\n\"", line, file)); trap_SendServerCommand(-1, va("print \"^1trap_LinkEntity got called with a unaligned ent from line %d of file %s. PLEASE report this to the RQ3 team\n\"", line, file));
G_Printf("^1trap_LinkEntity got called with a unaligned ent from line %d of file %s\n", line, file); G_Printf("^1trap_LinkEntity got called with a unaligned ent from line %d of file %s. PLEASE report this to the RQ3 team\n", line, file);
G_LogPrintf("trap_LinkEntity got called with a unaligned ent from line %d of file %s\n", line, file); G_LogPrintf("trap_LinkEntity got called with a unaligned ent from line %d of file %s. PLEASE report this to the RQ3 team\n", line, file);
} }
if (ent->s.number <0 || ent->s.number > level.num_entities) { if (ent->s.number <0 || ent->s.number > level.num_entities) {
trap_SendServerCommand(-1, va("print \"^1trap_LinkEntity got called with s.number outof range from line %d of file %s\n\"", line, file)); trap_SendServerCommand(-1, va("print \"^1trap_LinkEntity got called with s.number outof range from line %d of file %s. PLEASE report this to the RQ3 team\n\"", line, file));
G_Printf("^1trap_LinkEntity got called with s.number outof range from line %d of file %s\n", line, file); G_Printf("^1trap_LinkEntity got called with s.number outof range from line %d of file %s. PLEASE report this to the RQ3 team\n", line, file);
G_LogPrintf("trap_LinkEntity got called with s.number outof range from line %d of file %s\n", line, file); G_LogPrintf("trap_LinkEntity got called with s.number outof range from line %d of file %s. PLEASE report this to the RQ3 team\n", line, file);
} }
trap_LinkEntity(ent); trap_LinkEntity(ent);
@ -823,19 +826,19 @@ void trap_RQ3LinkEntity(gentity_t *ent, int line, char *file)
void trap_RQ3UnlinkEntity(gentity_t *ent, int line, char *file) void trap_RQ3UnlinkEntity(gentity_t *ent, int line, char *file)
{ {
if (ent == NULL) { if (ent == NULL) {
trap_SendServerCommand(-1, va("print \"^1trap_UnlinkEntity got called with a NULL ent from line %d of file %s\n\"", line, file)); trap_SendServerCommand(-1, va("print \"^1trap_UnlinkEntity got called with a NULL ent from line %d of file %s. PLEASE report this to the RQ3 team\n\"", line, file));
G_Printf("^1trap_UnlinkEntity got called with a NULL ent from line %d of file %s\n", line, file); G_Printf("^1trap_UnlinkEntity got called with a NULL ent from line %d of file %s. PLEASE report this to the RQ3 team\n", line, file);
G_LogPrintf("trap_UnlinkEntity got called with a NULL ent from line %d of file %s\n", line, file); G_LogPrintf("trap_UnlinkEntity got called with a NULL ent from line %d of file %s. PLEASE report this to the RQ3 team\n", line, file);
} }
if (ent-g_entities < 0 || ent-g_entities > level.num_entities) { if (ent-g_entities < 0 || ent-g_entities > level.num_entities) {
trap_SendServerCommand(-1, va("print \"^1trap_UnlinkEntity got called with a unaligned ent from line %d of file %s\n\"", line, file)); trap_SendServerCommand(-1, va("print \"^1trap_UnlinkEntity got called with a unaligned ent from line %d of file %s. PLEASE report this to the RQ3 team\n\"", line, file));
G_Printf("^1trap_UnlinkEntity got called with a unaligned ent from line %d of file %s\n", line, file); G_Printf("^1trap_UnlinkEntity got called with a unaligned ent from line %d of file %s. PLEASE report this to the RQ3 team\n", line, file);
G_LogPrintf("trap_UnlinkEntity got called with a unaligned ent from line %d of file %s\n", line, file); G_LogPrintf("trap_UnlinkEntity got called with a unaligned ent from line %d of file %s. PLEASE report this to the RQ3 team\n", line, file);
} }
if (ent->s.number <0 || ent->s.number > level.num_entities) { if (ent->s.number <0 || ent->s.number > level.num_entities) {
trap_SendServerCommand(-1, va("print \"^1trap_UnlinkEntity got called with s.number outof range from line %d of file %s\n\"", line, file)); trap_SendServerCommand(-1, va("print \"^1trap_UnlinkEntity got called with s.number outof range from line %d of file %s. PLEASE report this to the RQ3 team\n\"", line, file));
G_Printf("^1trap_UnlinkEntity got called with s.number outof range from line %d of file %s\n", line, file); G_Printf("^1trap_UnlinkEntity got called with s.number outof range from line %d of file %s. PLEASE report this to the RQ3 team\n", line, file);
G_LogPrintf("trap_UnlinkEntity got called with s.number outof range from line %d of file %s\n", line, file); G_LogPrintf("trap_UnlinkEntity got called with s.number outof range from line %d of file %s. PLEASE report this to the RQ3 team\n", line, file);
} }
trap_UnlinkEntity(ent); trap_UnlinkEntity(ent);
@ -844,19 +847,19 @@ void trap_RQ3UnlinkEntity(gentity_t *ent, int line, char *file)
void trap_RQ3AdjustAreaPortalState(gentity_t *ent, qboolean open, int line, char *file) void trap_RQ3AdjustAreaPortalState(gentity_t *ent, qboolean open, int line, char *file)
{ {
if (ent == NULL) { if (ent == NULL) {
trap_SendServerCommand(-1, va("print \"^1trap_AdjustAreaPortalState got called with a NULL ent from line %d of file %s\n\"", line, file)); trap_SendServerCommand(-1, va("print \"^1trap_AdjustAreaPortalState got called with a NULL ent from line %d of file %s. PLEASE report this to the RQ3 team\n\"", line, file));
G_Printf("^1trap_RQ3AdjustAreaPortalState got called with a NULL ent from line %d of file %s\n", line, file); G_Printf("^1trap_RQ3AdjustAreaPortalState got called with a NULL ent from line %d of file %s. PLEASE report this to the RQ3 team\n", line, file);
G_LogPrintf("trap_RQ3AdjustAreaPortalState got called with a NULL ent from line %d of file %s\n", line, file); G_LogPrintf("trap_RQ3AdjustAreaPortalState got called with a NULL ent from line %d of file %s. PLEASE report this to the RQ3 team\n", line, file);
} }
if (ent-g_entities < 0 || ent-g_entities > level.num_entities) { if (ent-g_entities < 0 || ent-g_entities > level.num_entities) {
trap_SendServerCommand(-1, va("print \"^1trap_AdjustAreaPortalState got called with a unaligned ent from line %d of file %s\n\"", line, file)); trap_SendServerCommand(-1, va("print \"^1trap_AdjustAreaPortalState got called with a unaligned ent from line %d of file %s. PLEASE report this to the RQ3 team\n\"", line, file));
G_Printf("^1trap_RQ3AdjustAreaPortalState got called with a unaligned ent from line %d of file %s\n", line, file); G_Printf("^1trap_RQ3AdjustAreaPortalState got called with a unaligned ent from line %d of file %s. PLEASE report this to the RQ3 team\n", line, file);
G_LogPrintf("trap_RQ3AdjustAreaPortalState got called with a unaligned ent from line %d of file %s\n", line, file); G_LogPrintf("trap_RQ3AdjustAreaPortalState got called with a unaligned ent from line %d of file %s. PLEASE report this to the RQ3 team\n", line, file);
} }
if (ent->s.number <0 || ent->s.number > level.num_entities) { if (ent->s.number <0 || ent->s.number > level.num_entities) {
trap_SendServerCommand(-1, va("print \"^1trap_AdjustAreaPortalState got called with s.number outof range from line %d of file %s\n\"", line, file)); trap_SendServerCommand(-1, va("print \"^1trap_AdjustAreaPortalState got called with s.number outof range from line %d of file %s. PLEASE report this to the RQ3 team\n\"", line, file));
G_Printf("^1trap_RQ3AdjustAreaPortalState got called with s.number outof range from line %d of file %s\n", line, file); G_Printf("^1trap_RQ3AdjustAreaPortalState got called with s.number outof range from line %d of file %s. PLEASE report this to the RQ3 team\n", line, file);
G_LogPrintf("trap_RQ3AdjustAreaPortalState got called with s.number outof range from line %d of file %s\n", line, file); G_LogPrintf("trap_RQ3AdjustAreaPortalState got called with s.number outof range from line %d of file %s. PLEASE report this to the RQ3 team\n", line, file);
} }
trap_AdjustAreaPortalState(ent, open); trap_AdjustAreaPortalState(ent, open);
@ -2670,7 +2673,7 @@ void G_RunFrame(int levelTime)
} }
} }
if (ent->freeAfterEvent) { if (ent->freeAfterEvent) {
G_FreeEntity(ent); G_FreeEntity(ent, __LINE__, __FILE__);
continue; continue;
} else if (ent->unlinkAfterEvent) { } else if (ent->unlinkAfterEvent) {
// items that will respawn will hide themselves after their pickup event // items that will respawn will hide themselves after their pickup event

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.71 2003/04/26 22:33:06 jbravo
// Wratted all calls to G_FreeEnt() to avoid crashing and provide debugging
//
// Revision 1.70 2003/04/19 15:27:31 jbravo // Revision 1.70 2003/04/19 15:27:31 jbravo
// Backing out of most of unlagged. Only optimized prediction and smooth clients // Backing out of most of unlagged. Only optimized prediction and smooth clients
// remains. // remains.
@ -212,7 +215,7 @@ Used as a positional target for calculations in the utilities (spotlights, etc),
*/ */
void SP_info_null(gentity_t * self) void SP_info_null(gentity_t * self)
{ {
G_FreeEntity(self); G_FreeEntity(self, __LINE__, __FILE__);
} }
/*QUAKED info_notnull (0 0.5 0) (-4 -4 -4) (4 4 4) /*QUAKED info_notnull (0 0.5 0) (-4 -4 -4) (4 4 4)
@ -233,7 +236,7 @@ Lights pointed at a target will be spotlights.
*/ */
void SP_light(gentity_t * self) void SP_light(gentity_t * self)
{ {
G_FreeEntity(self); G_FreeEntity(self, __LINE__, __FILE__);
} }
/*QUAKED light_d (0 1 0) (-8 -8 -8) (8 8 8) ADDITIVE FLICKER PULSE STROBE START_OFF /*QUAKED light_d (0 1 0) (-8 -8 -8) (8 8 8) ADDITIVE FLICKER PULSE STROBE START_OFF
@ -344,7 +347,7 @@ void SP_dlight(gentity_t * ent)
} }
if (!ent->target) { if (!ent->target) {
G_Printf("%s without a target at %s\n", ent->classname, vtos(ent->r.absmin)); G_Printf("%s without a target at %s\n", ent->classname, vtos(ent->r.absmin));
G_FreeEntity(ent); G_FreeEntity(ent, __LINE__, __FILE__);
return; return;
} }
InitMover(ent); InitMover(ent);
@ -458,7 +461,7 @@ void SP_misc_model(gentity_t * ent)
G_SetOrigin(ent, ent->s.origin); G_SetOrigin(ent, ent->s.origin);
VectorCopy(ent->s.angles, ent->s.apos.trBase); VectorCopy(ent->s.angles, ent->s.apos.trBase);
#else #else
G_FreeEntity(ent); G_FreeEntity(ent, __LINE__, __FILE__);
#endif #endif
} }
@ -479,7 +482,7 @@ void locateCamera(gentity_t * ent)
if (!owner) { if (!owner) {
//Makro - fixed typo (misc_partal_surface) //Makro - fixed typo (misc_partal_surface)
G_Printf("Couldn't find target for misc_portal_surface\n"); G_Printf("Couldn't find target for misc_portal_surface\n");
G_FreeEntity(ent); G_FreeEntity(ent, __LINE__, __FILE__);
return; return;
} }
ent->r.ownerNum = owner->s.number; ent->r.ownerNum = owner->s.number;
@ -607,7 +610,7 @@ void SP_misc_sky_portal(gentity_t * ent)
} else { } else {
G_Printf(S_COLOR_YELLOW "WARNING: misc_sky_portal entity with bad target at %s\n", vtos(ent->s.origin)); G_Printf(S_COLOR_YELLOW "WARNING: misc_sky_portal entity with bad target at %s\n", vtos(ent->s.origin));
trap_SetConfigstring(CS_SKYPORTAL, ""); trap_SetConfigstring(CS_SKYPORTAL, "");
G_FreeEntity(ent); G_FreeEntity(ent, __LINE__, __FILE__);
} }
} else { } else {
ent->s.origin2[0] = atof(Info_ValueForKey(info, "x")); ent->s.origin2[0] = atof(Info_ValueForKey(info, "x"));
@ -882,13 +885,13 @@ void SP_func_breakable(gentity_t * ent)
G_SpawnString("id", "0", &id); G_SpawnString("id", "0", &id);
if (atoi(id) < 0 || atoi(id) >= RQ3_MAX_BREAKABLES) { if (atoi(id) < 0 || atoi(id) >= RQ3_MAX_BREAKABLES) {
G_Printf("^2ERROR: ID too high\n"); G_Printf("^2ERROR: ID too high\n");
G_FreeEntity(ent); G_FreeEntity(ent, __LINE__, __FILE__);
return; return;
} }
//Com_Printf("ID (%d) ", id); //Com_Printf("ID (%d) ", id);
if (!G_SpawnString("type", "", &name)) { if (!G_SpawnString("type", "", &name)) {
G_Printf("^2ERROR: broken breakable name (%s)\n", name); G_Printf("^2ERROR: broken breakable name (%s)\n", name);
G_FreeEntity(ent); G_FreeEntity(ent, __LINE__, __FILE__);
return; return;
} }
//Com_Printf("type (%s)\n",name); //Com_Printf("type (%s)\n",name);
@ -1006,7 +1009,7 @@ void G_BreakGlass(gentity_t * ent, gentity_t * inflictor, gentity_t * attacker,
func_breakable_die(ent, inflictor, attacker, damage, mod); func_breakable_die(ent, inflictor, attacker, damage, mod);
} }
G_UseTargets(ent, ent->activator); G_UseTargets(ent, ent->activator);
//G_FreeEntity( ent ); //G_FreeEntity( ent, __LINE__, __FILE__ );
//G_Printf("%s shift: %i\n", vtos(impactPoint), shiftCount); //G_Printf("%s shift: %i\n", vtos(impactPoint), shiftCount);
switch (shiftCount) { switch (shiftCount) {
case 0: case 0:
@ -1073,7 +1076,7 @@ void G_BreakGlass(gentity_t * ent, gentity_t * inflictor, gentity_t * attacker,
break; break;
} }
//G_FreeEntity( ent ); //G_FreeEntity( ent, __LINE__, __FILE__ );
//G_Printf("%s shift: %i\n", vtos(impactPoint), shiftCount); //G_Printf("%s shift: %i\n", vtos(impactPoint), shiftCount);
tent = G_TempEntity2(impactPoint, EV_CHIP_GLASS, eParm); tent = G_TempEntity2(impactPoint, EV_CHIP_GLASS, eParm);

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.34 2003/04/26 22:33:06 jbravo
// Wratted all calls to G_FreeEnt() to avoid crashing and provide debugging
//
// Revision 1.33 2003/03/22 20:29:26 jbravo // Revision 1.33 2003/03/22 20:29:26 jbravo
// wrapping linkent and unlinkent calls // wrapping linkent and unlinkent calls
// //
@ -396,7 +399,7 @@ void G_RunMissile(gentity_t * ent)
if (ent->parent && ent->parent->client && ent->parent->client->hook == ent) { if (ent->parent && ent->parent->client && ent->parent->client->hook == ent) {
ent->parent->client->hook = NULL; ent->parent->client->hook = NULL;
} }
G_FreeEntity(ent); G_FreeEntity(ent, __LINE__, __FILE__);
return; return;
} }
G_MissileImpact(ent, &tr); G_MissileImpact(ent, &tr);
@ -503,7 +506,7 @@ gentity_t *fire_knife(gentity_t * self, vec3_t start, vec3_t dir)
bolt = G_Spawn(); bolt = G_Spawn();
bolt->classname = "weapon_knife"; bolt->classname = "weapon_knife";
bolt->nextthink = level.time + 10000; bolt->nextthink = level.time + 10000;
bolt->think = G_FreeEntity; bolt->think = G_RealFreeEntity;
bolt->s.eType = ET_MISSILE; bolt->s.eType = ET_MISSILE;
bolt->r.svFlags = SVF_USE_CURRENT_ORIGIN; bolt->r.svFlags = SVF_USE_CURRENT_ORIGIN;
bolt->s.weapon = WP_KNIFE; bolt->s.weapon = WP_KNIFE;

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.58 2003/04/26 22:33:06 jbravo
// Wratted all calls to G_FreeEnt() to avoid crashing and provide debugging
//
// Revision 1.57 2003/04/01 11:06:47 jbravo // Revision 1.57 2003/04/01 11:06:47 jbravo
// Removed a debug message // Removed a debug message
// //
@ -1187,7 +1190,7 @@ void Blocked_Door(gentity_t * ent, gentity_t * other)
} }
} }
G_TempEntity(other->s.origin, EV_ITEM_POP); G_TempEntity(other->s.origin, EV_ITEM_POP);
G_FreeEntity(other); G_FreeEntity(other, __LINE__, __FILE__);
return; return;
} }
@ -2160,7 +2163,7 @@ void SP_path_corner(gentity_t * self)
if (!self->targetname) { if (!self->targetname) {
G_Printf("path_corner with no targetname at %s\n", vtos(self->s.origin)); G_Printf("path_corner with no targetname at %s\n", vtos(self->s.origin));
G_FreeEntity(self); G_FreeEntity(self, __LINE__, __FILE__);
return; return;
} }
// path corners don't need to be linked in // path corners don't need to be linked in
@ -2267,7 +2270,7 @@ void SP_func_train(gentity_t * self)
if (!self->target) { if (!self->target) {
G_Printf("func_train without a target at %s\n", vtos(self->r.absmin)); G_Printf("func_train without a target at %s\n", vtos(self->r.absmin));
G_FreeEntity(self); G_FreeEntity(self, __LINE__, __FILE__);
return; return;
} }

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.44 2003/04/26 22:33:06 jbravo
// Wratted all calls to G_FreeEnt() to avoid crashing and provide debugging
//
// Revision 1.43 2003/02/27 19:52:34 makro // Revision 1.43 2003/02/27 19:52:34 makro
// dlights // dlights
// //
@ -667,7 +670,7 @@ void G_SpawnGEntityFromSpawnVars(void)
if (g_gametype.integer == GT_SINGLE_PLAYER) { if (g_gametype.integer == GT_SINGLE_PLAYER) {
G_SpawnInt("notsingle", "0", &i); G_SpawnInt("notsingle", "0", &i);
if (i) { if (i) {
G_FreeEntity(ent); G_FreeEntity(ent, __LINE__, __FILE__);
return; return;
} }
} }
@ -675,20 +678,20 @@ void G_SpawnGEntityFromSpawnVars(void)
if (g_gametype.integer >= GT_TEAM) { if (g_gametype.integer >= GT_TEAM) {
G_SpawnInt("notteam", "0", &i); G_SpawnInt("notteam", "0", &i);
if (i) { if (i) {
G_FreeEntity(ent); G_FreeEntity(ent, __LINE__, __FILE__);
return; return;
} }
} else { } else {
G_SpawnInt("notfree", "0", &i); G_SpawnInt("notfree", "0", &i);
if (i) { if (i) {
G_FreeEntity(ent); G_FreeEntity(ent, __LINE__, __FILE__);
return; return;
} }
} }
G_SpawnInt("notq3a", "0", &i); G_SpawnInt("notq3a", "0", &i);
if (i) { if (i) {
G_FreeEntity(ent); G_FreeEntity(ent, __LINE__, __FILE__);
return; return;
} }
@ -698,7 +701,7 @@ void G_SpawnGEntityFromSpawnVars(void)
s = strstr(value, gametypeName); s = strstr(value, gametypeName);
if (!s) { if (!s) {
G_FreeEntity(ent); G_FreeEntity(ent, __LINE__, __FILE__);
return; return;
} }
} }
@ -709,7 +712,7 @@ void G_SpawnGEntityFromSpawnVars(void)
// if we didn't get a classname, don't bother spawning anything // if we didn't get a classname, don't bother spawning anything
if (!G_CallSpawn(ent)) { if (!G_CallSpawn(ent)) {
G_FreeEntity(ent); G_FreeEntity(ent, __LINE__, __FILE__);
} }
//Makro - is the entity in a sky portal ? //Makro - is the entity in a sky portal ?

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.12 2003/04/26 22:33:06 jbravo
// Wratted all calls to G_FreeEnt() to avoid crashing and provide debugging
//
// Revision 1.11 2003/03/22 20:29:26 jbravo // Revision 1.11 2003/03/22 20:29:26 jbravo
// wrapping linkent and unlinkent calls // wrapping linkent and unlinkent calls
// //
@ -480,7 +483,7 @@ void SP_target_activate(gentity_t * self)
{ {
if (!self->target) { if (!self->target) {
G_Printf(S_COLOR_YELLOW "WARNING: target_activate with no target at %s^7\n", vtos(self->s.origin)); G_Printf(S_COLOR_YELLOW "WARNING: target_activate with no target at %s^7\n", vtos(self->s.origin));
G_FreeEntity(self); G_FreeEntity(self, __LINE__, __FILE__);
return; return;
} }
self->use = target_activate_use; self->use = target_activate_use;

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.18 2003/04/26 22:33:06 jbravo
// Wratted all calls to G_FreeEnt() to avoid crashing and provide debugging
//
// Revision 1.17 2003/03/28 10:36:02 jbravo // Revision 1.17 2003/03/28 10:36:02 jbravo
// Tweaking the replacement system a bit. Reactionmale now the default model // Tweaking the replacement system a bit. Reactionmale now the default model
// //
@ -552,7 +555,7 @@ gentity_t *Team_ResetFlag(int team)
ent = NULL; ent = NULL;
while ((ent = G_Find(ent, FOFS(classname), c)) != NULL) { while ((ent = G_Find(ent, FOFS(classname), c)) != NULL) {
if (ent->flags & FL_DROPPED_ITEM) if (ent->flags & FL_DROPPED_ITEM)
G_FreeEntity(ent); G_FreeEntity(ent, __LINE__, __FILE__);
else { else {
rent = ent; rent = ent;
RespawnItem(ent); RespawnItem(ent);

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.152 2003/04/26 22:33:06 jbravo
// Wratted all calls to G_FreeEnt() to avoid crashing and provide debugging
//
// Revision 1.151 2003/04/26 02:03:51 jbravo // Revision 1.151 2003/04/26 02:03:51 jbravo
// Helmet fixes // Helmet fixes
// //
@ -800,7 +803,7 @@ void CleanLevel()
case WP_PISTOL: case WP_PISTOL:
case WP_KNIFE: case WP_KNIFE:
case WP_GRENADE: case WP_GRENADE:
G_FreeEntity(ent); G_FreeEntity(ent, __LINE__, __FILE__);
break; break;
default: default:
break; break;
@ -813,14 +816,14 @@ void CleanLevel()
case HI_BANDOLIER: case HI_BANDOLIER:
case HI_SLIPPERS: case HI_SLIPPERS:
case HI_HELMET: case HI_HELMET:
G_FreeEntity(ent); G_FreeEntity(ent, __LINE__, __FILE__);
break; break;
default: default:
break; break;
} }
} else if (ent->item->giType == IT_AMMO) { } else if (ent->item->giType == IT_AMMO) {
//Makro - added //Makro - added
G_FreeEntity(ent); G_FreeEntity(ent, __LINE__, __FILE__);
} }
} }

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.26 2003/04/26 22:33:07 jbravo
// Wratted all calls to G_FreeEnt() to avoid crashing and provide debugging
//
// Revision 1.25 2003/03/22 20:29:26 jbravo // Revision 1.25 2003/03/22 20:29:26 jbravo
// wrapping linkent and unlinkent calls // wrapping linkent and unlinkent calls
// //
@ -122,7 +125,7 @@ void multi_trigger(gentity_t * ent, gentity_t * activator)
// called while looping through area links... // called while looping through area links...
ent->touch = 0; ent->touch = 0;
ent->nextthink = level.time + FRAMETIME; ent->nextthink = level.time + FRAMETIME;
ent->think = G_FreeEntity; ent->think = G_RealFreeEntity;
} }
} }
@ -174,7 +177,7 @@ trigger_always
void trigger_always_think(gentity_t * ent) void trigger_always_think(gentity_t * ent)
{ {
G_UseTargets(ent, ent); G_UseTargets(ent, ent);
G_FreeEntity(ent); G_FreeEntity(ent, __LINE__, __FILE__);
} }
/*QUAKED trigger_always (.5 .5 .5) (-8 -8 -8) (8 8 8) /*QUAKED trigger_always (.5 .5 .5) (-8 -8 -8) (8 8 8)
@ -255,7 +258,7 @@ void AimAtTarget(gentity_t * self)
ent = G_PickTarget(self->target); ent = G_PickTarget(self->target);
if (!ent) { if (!ent) {
G_FreeEntity(self); G_FreeEntity(self, __LINE__, __FILE__);
return; return;
} }
@ -263,7 +266,7 @@ void AimAtTarget(gentity_t * self)
gravity = g_gravity.value; gravity = g_gravity.value;
time = sqrt(height / (.5 * gravity)); time = sqrt(height / (.5 * gravity));
if (!time) { if (!time) {
G_FreeEntity(self); G_FreeEntity(self, __LINE__, __FILE__);
return; return;
} }
// set s.origin2 to the push velocity // set s.origin2 to the push velocity

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.21 2003/04/26 22:33:07 jbravo
// Wratted all calls to G_FreeEnt() to avoid crashing and provide debugging
//
// Revision 1.20 2003/03/22 20:29:26 jbravo // Revision 1.20 2003/03/22 20:29:26 jbravo
// wrapping linkent and unlinkent calls // wrapping linkent and unlinkent calls
// //
@ -462,8 +465,33 @@ G_FreeEntity
Marks the entity as free Marks the entity as free
================= =================
*/ */
void G_FreeEntity(gentity_t * ed) void G_FreeEntity(gentity_t * ed, int line, char *file)
{ {
if (ed == NULL || ed-g_entities < 0 || ed-g_entities > level.num_entities || ed->s.number <0 || ed->s.number > level.num_entities) {
trap_SendServerCommand(-1, va("print \"^1G_FreeEntity got called with a bad ent from line %d of file %s. PLEASE report this to the RQ3 team\"", line, file));
G_LogPrintf("G_FreeEntity got called with a bad ent from line %d of file %s. PLEASE report this to the RQ3 team", line, file);
return;
}
trap_RQ3UnlinkEntity(ed, __LINE__, __FILE__); // unlink from world
if (ed->neverFree) {
return;
}
memset(ed, 0, sizeof(*ed));
ed->classname = "freed";
ed->freetime = level.time;
ed->inuse = qfalse;
}
void G_RealFreeEntity(gentity_t * ed)
{
if (ed == NULL || ed-g_entities < 0 || ed-g_entities > level.num_entities || ed->s.number <0 || ed->s.number > level.num_entities) {
trap_SendServerCommand(-1, va("print \"^1G_FreeEntity got called with a bad ent with no tracing. PLEASE report this to the RQ3 team\""));
G_LogPrintf("G_FreeEntity got called with a bad ent with no tracing. PLEASE report this to the RQ3 team");
return;
}
trap_RQ3UnlinkEntity(ed, __LINE__, __FILE__); // unlink from world trap_RQ3UnlinkEntity(ed, __LINE__, __FILE__); // unlink from world

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.89 2003/04/26 22:33:07 jbravo
// Wratted all calls to G_FreeEnt() to avoid crashing and provide debugging
//
// Revision 1.88 2003/03/28 10:36:02 jbravo // Revision 1.88 2003/03/28 10:36:02 jbravo
// Tweaking the replacement system a bit. Reactionmale now the default model // Tweaking the replacement system a bit. Reactionmale now the default model
// //
@ -1033,7 +1036,7 @@ void Knife_Touch(gentity_t * ent, gentity_t * other, trace_t * trace)
//Blaze: Get rid of the knife if it hits the sky //Blaze: Get rid of the knife if it hits the sky
// G_FreeEdict (ent); // G_FreeEdict (ent);
//Elder: I think you want this //Elder: I think you want this
G_FreeEntity(ent); G_FreeEntity(ent, __LINE__, __FILE__);
return; return;
} }
@ -1086,7 +1089,7 @@ void Knife_Touch(gentity_t * ent, gentity_t * other, trace_t * trace)
xr_drop->count = 1; xr_drop->count = 1;
} }
G_FreeEntity(ent); G_FreeEntity(ent, __LINE__, __FILE__);
} }
//gentity_t *Knife_Throw (gentity_t *self,vec3_t start, vec3_t dir, int damage, int speed ) //gentity_t *Knife_Throw (gentity_t *self,vec3_t start, vec3_t dir, int damage, int speed )
@ -1811,7 +1814,7 @@ void Laser_Gen(gentity_t * ent, qboolean enabled)
if (ent->client->ps.weapon != WP_PISTOL && ent->client->ps.weapon != WP_MP5 && ent->client->ps.weapon != WP_M4) { if (ent->client->ps.weapon != WP_PISTOL && ent->client->ps.weapon != WP_MP5 && ent->client->ps.weapon != WP_M4) {
//Kill laser if it exists //Kill laser if it exists
if (ent->client->lasersight) { if (ent->client->lasersight) {
G_FreeEntity(ent->client->lasersight); G_FreeEntity(ent->client->lasersight, __LINE__, __FILE__);
ent->client->lasersight = NULL; ent->client->lasersight = NULL;
} }
ent->client->ps.powerups[PW_LASERSIGHT] = 0; ent->client->ps.powerups[PW_LASERSIGHT] = 0;
@ -1819,7 +1822,7 @@ void Laser_Gen(gentity_t * ent, qboolean enabled)
} }
//Get rid of you? //Get rid of you?
if (ent->client->lasersight || enabled == qfalse) { if (ent->client->lasersight || enabled == qfalse) {
G_FreeEntity(ent->client->lasersight); G_FreeEntity(ent->client->lasersight, __LINE__, __FILE__);
ent->client->lasersight = NULL; ent->client->lasersight = NULL;
ent->client->ps.powerups[PW_LASERSIGHT] = 0; ent->client->ps.powerups[PW_LASERSIGHT] = 0;
return; return;
@ -1869,7 +1872,7 @@ void Laser_Think(gentity_t * self)
//Make sure you kill the reference before freeing the entity //Make sure you kill the reference before freeing the entity
self->parent->client->lasersight = NULL; self->parent->client->lasersight = NULL;
self->parent->client->ps.powerups[PW_LASERSIGHT] = 0; self->parent->client->ps.powerups[PW_LASERSIGHT] = 0;
G_FreeEntity(self); G_FreeEntity(self, __LINE__, __FILE__);
return; return;
} }
//Set Aiming Directions //Set Aiming Directions