there is a function being referenced externally by renderer code in
projectile.c called 'gfxVisible',which is called after the projectile
update,so sometimes it will have a 'died' psDest,because the 'died' check is
performed in projectile update function(so a 'died' psDest is valid at the
beginning of that function,though the 'died' check is missing in gfxVisible
function)

attached the fix and the fix for < DROID_MAXWEAP and < STRUCT_MAXWEAP assert
Index: src/projectile.c
===================================================================
--- src/projectile.c    (revision 2021)
+++ src/projectile.c    (working copy)
@@ -148,8 +148,6 @@
 {
        BOOL bVisible = FALSE;
 
-       CHECK_PROJECTILE(psObj);
-
        // already know it is visible
        if (psObj->bVisible)
        {
@@ -169,28 +167,34 @@
        }
 
        // you can see the source
-       if( (psObj->psSource!=NULL) && 
(psObj->psSource->visible[selectedPlayer]) )
+       if( (psObj->psSource!=NULL) &&
+               (!psObj->psSource->died) &&
+               (psObj->psSource->visible[selectedPlayer]) )
        {
                bVisible = TRUE;
        }
 
        // you can see the destination
-       if( (psObj->psDest!=NULL) && (psObj->psDest->visible[selectedPlayer]) )
+       if( (psObj->psDest!=NULL) &&
+               (!psObj->psDest->died) &&
+               (psObj->psDest->visible[selectedPlayer]) )
        {
                bVisible = TRUE;
        }
 
        // someone elses structure firing at something you can't see
        if ( psObj->psSource != NULL &&
+               !psObj->psSource->died &&
                psObj->psSource->type == OBJ_STRUCTURE &&
                psObj->psSource->player!=selectedPlayer &&
-               ( psObj->psDest == NULL || 
!psObj->psDest->visible[selectedPlayer] ) )
+               ( psObj->psDest == NULL || psObj->psDest->died || 
!psObj->psDest->visible[selectedPlayer] ) )
        {
                bVisible = FALSE;
        }
 
        // something you cannot see firing at a structure that isn't yours
        if ( psObj->psDest != NULL &&
+               !psObj->psDest->died &&
                psObj->psDest->type == OBJ_STRUCTURE &&
                psObj->psDest->player != selectedPlayer &&
                ( psObj->psSource == NULL || 
!psObj->psSource->visible[selectedPlayer] ) )
Index: src/droid.h
===================================================================
--- src/droid.h (revision 2021)
+++ src/droid.h (working copy)
@@ -429,7 +429,7 @@
        assert(droid->type == OBJ_DROID); \
 \
        assert(droid->direction <= 360.0f && droid->direction >= 0.0f); \
-       assert(droid->numWeaps < DROID_MAXWEAPS); \
+       assert(droid->numWeaps <= DROID_MAXWEAPS); \
        assert(droid->listSize < ORDER_LIST_MAX); \
        assert(droid->player < MAX_PLAYERS); \
 \
Index: src/structure.h
===================================================================
--- src/structure.h     (revision 2021)
+++ src/structure.h     (working copy)
@@ -410,7 +410,7 @@
        assert(object->type == OBJ_STRUCTURE); \
        assert(object->player < MAX_PLAYERS); \
        assert(object->pStructureType->type < NUM_DIFF_BUILDINGS); \
-       assert(object->numWeaps < STRUCT_MAXWEAPS); \
+       assert(object->numWeaps <= STRUCT_MAXWEAPS); \
        for (i = 0; i < STRUCT_MAXWEAPS; ++i) \
        { \
                assert(object->turretRotation[i] <= 360); \
_______________________________________________
Warzone-dev mailing list
Warzone-dev@gna.org
https://mail.gna.org/listinfo/warzone-dev

Reply via email to