Don't checksum elements with BACKGROUND_OBJECT set. Allows for certain types

of graphics mods which don't influence netplay synchronisation.




git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2793 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
Meep-Eep
2007-06-29 15:05:18 +00:00
parent 165f30c9a5
commit 5205cb3444
2 changed files with 32 additions and 19 deletions
+5
View File
@@ -70,6 +70,11 @@ typedef HLINK HELEMENT;
#define IGNORE_VELOCITY (1 << 13)
#define CREW_OBJECT (1 << 14)
#define BACKGROUND_OBJECT (1 << 15)
// The BACKGROUND_OBJECT flag existed originally but wasn't used.
// It can now be used for objects that never influence the state
// of other elements; elements that have this flag set are not
// included in the checksum used for netplay games.
// It can be used for graphical mods that don't impede netplay.
#define HYPERJUMP_LIFE 15
+27 -19
View File
@@ -109,28 +109,36 @@ crc_processELEMENT(crc_State *state, const ELEMENT *val) {
#ifdef DUMP_CRC_OPS
crc_log("START crc_processELEMENT().");
#endif
crc_processELEMENT_FLAGS(state, val->state_flags);
crc_processCOUNT(state, val->life_span);
crc_processCOUNT(state, val->crew_level);
crc_processBYTE(state, val->mass_points);
if (val->state_flags & BACKGROUND_OBJECT) {
// The element never influences the state of other elements,
// and is to be excluded from checksums.
#ifdef DUMP_CRC_OPS
crc_log(" BACKGROUND_OBJECT element omited");
#endif
} else {
crc_processELEMENT_FLAGS(state, val->state_flags);
crc_processCOUNT(state, val->life_span);
crc_processCOUNT(state, val->crew_level);
crc_processBYTE(state, val->mass_points);
// HACK: when a ship is being destroyed, turn_wait is abused to store
// the side this ship is on. This must be excluded from the checksum
// as this does not have to be the same for both sides.
{
extern void new_ship(ELEMENT *ElementPtr);
BYTE turn_wait = val->turn_wait;
if (val->preprocess_func == new_ship)
turn_wait = 0;
// HACK: when a ship is being destroyed, turn_wait is abused to store
// the side this ship is on. This must be excluded from the checksum
// as this does not have to be the same for both sides.
{
extern void new_ship(ELEMENT *ElementPtr);
BYTE turn_wait = val->turn_wait;
if (val->preprocess_func == new_ship)
turn_wait = 0;
crc_processBYTE(state, turn_wait);
crc_processBYTE(state, turn_wait);
}
crc_processBYTE(state, val->thrust_wait);
crc_processVELOCITY_DESC(state, &val->velocity);
crc_processSTATE(state, &val->current);
crc_processSTATE(state, &val->next);
}
crc_processBYTE(state, val->thrust_wait);
crc_processVELOCITY_DESC(state, &val->velocity);
crc_processSTATE(state, &val->current);
crc_processSTATE(state, &val->next);
#ifdef DUMP_CRC_OPS
crc_log("END crc_processELEMENT().");
#endif