Implement syncDebugFeature, to check that features are also in synch.
parent
f5893a7fe5
commit
e39b23a437
|
@ -29,6 +29,7 @@
|
||||||
#include "lib/gamelib/gtime.h"
|
#include "lib/gamelib/gtime.h"
|
||||||
#include "lib/sound/audio.h"
|
#include "lib/sound/audio.h"
|
||||||
#include "lib/sound/audio_id.h"
|
#include "lib/sound/audio_id.h"
|
||||||
|
#include "lib/netplay/netplay.h"
|
||||||
|
|
||||||
#include "feature.h"
|
#include "feature.h"
|
||||||
#include "map.h"
|
#include "map.h"
|
||||||
|
@ -449,10 +450,25 @@ void featureRelease(FEATURE *psFeature)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _syncDebugFeature(const char *function, FEATURE *psFeature, char ch)
|
||||||
|
{
|
||||||
|
_syncDebug(function, "%c feature%d = p%d;pos(%d,%d,%d),subtype%d,dam%d,bp%d", ch,
|
||||||
|
psFeature->id,
|
||||||
|
|
||||||
|
psFeature->player,
|
||||||
|
psFeature->pos.x, psFeature->pos.y, psFeature->pos.z,
|
||||||
|
psFeature->psStats->subType,
|
||||||
|
psFeature->psStats->damageable,
|
||||||
|
psFeature->body
|
||||||
|
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/* Update routine for features */
|
/* Update routine for features */
|
||||||
void featureUpdate(FEATURE *psFeat)
|
void featureUpdate(FEATURE *psFeat)
|
||||||
{
|
{
|
||||||
|
syncDebugFeature(psFeat, '<');
|
||||||
|
|
||||||
// if(getRevealStatus())
|
// if(getRevealStatus())
|
||||||
// {
|
// {
|
||||||
// update the visibility for the feature
|
// update the visibility for the feature
|
||||||
|
@ -468,10 +484,12 @@ void featureUpdate(FEATURE *psFeat)
|
||||||
// {
|
// {
|
||||||
destroyFeature(psFeat); // get rid of the now!!!
|
destroyFeature(psFeat); // get rid of the now!!!
|
||||||
// }
|
// }
|
||||||
break;
|
return;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
syncDebugFeature(psFeat, '>');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -70,6 +70,9 @@ int32_t featureDamage(FEATURE *psFeature, UDWORD damage, WEAPON_CLASS weaponClas
|
||||||
|
|
||||||
extern void featureInitVars(void);
|
extern void featureInitVars(void);
|
||||||
|
|
||||||
|
#define syncDebugFeature(psFeature, ch) _syncDebugFeature(__FUNCTION__, psFeature, ch)
|
||||||
|
void _syncDebugFeature(const char *function, FEATURE *psFeature, char ch);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif //__cplusplus
|
#endif //__cplusplus
|
||||||
|
|
|
@ -475,6 +475,8 @@ BOOL recvDroid(NETQUEUE queue)
|
||||||
orderDroidLoc(psDroid, DORDER_MOVE, initialOrders.moveToX, initialOrders.moveToY, ModeImmediate);
|
orderDroidLoc(psDroid, DORDER_MOVE, initialOrders.moveToX, initialOrders.moveToY, ModeImmediate);
|
||||||
cbNewDroid(IdToStruct(initialOrders.factoryId, ANYPLAYER), psDroid);
|
cbNewDroid(IdToStruct(initialOrders.factoryId, ANYPLAYER), psDroid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
syncDebugDroid(psDroid, '+');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -722,6 +722,7 @@ void recvMultiPlayerRandomArtifacts(NETQUEUE queue)
|
||||||
{
|
{
|
||||||
pF->id = ref;
|
pF->id = ref;
|
||||||
pF->player = player;
|
pF->player = player;
|
||||||
|
syncDebugFeature(pF, '+');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -130,6 +130,11 @@ static void objmemDestroy(BASE_OBJECT *psObj)
|
||||||
|
|
||||||
visRemoveVisibility(psObj);
|
visRemoveVisibility(psObj);
|
||||||
free(psObj->watchedTiles);
|
free(psObj->watchedTiles);
|
||||||
|
#ifdef DEBUG
|
||||||
|
psObj->type = (OBJECT_TYPE)(psObj->type + 1000000000); // Hopefully this will trigger an assert if someone uses the freed object.
|
||||||
|
psObj->player += 1000000000; // Hopefully this will trigger an assert and/or crash if someone uses the freed object.
|
||||||
|
psObj->psNext = psObj; // Hopefully this will trigger an infinite loop if someone uses the freed object.
|
||||||
|
#endif //DEBUG
|
||||||
free(psObj);
|
free(psObj);
|
||||||
debug(LOG_MEMORY, "BASE_OBJECT* 0x%p is freed.", psObj);
|
debug(LOG_MEMORY, "BASE_OBJECT* 0x%p is freed.", psObj);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue