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:
@@ -70,6 +70,11 @@ typedef HLINK HELEMENT;
|
|||||||
#define IGNORE_VELOCITY (1 << 13)
|
#define IGNORE_VELOCITY (1 << 13)
|
||||||
#define CREW_OBJECT (1 << 14)
|
#define CREW_OBJECT (1 << 14)
|
||||||
#define BACKGROUND_OBJECT (1 << 15)
|
#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
|
#define HYPERJUMP_LIFE 15
|
||||||
|
|||||||
@@ -109,28 +109,36 @@ crc_processELEMENT(crc_State *state, const ELEMENT *val) {
|
|||||||
#ifdef DUMP_CRC_OPS
|
#ifdef DUMP_CRC_OPS
|
||||||
crc_log("START crc_processELEMENT().");
|
crc_log("START crc_processELEMENT().");
|
||||||
#endif
|
#endif
|
||||||
crc_processELEMENT_FLAGS(state, val->state_flags);
|
if (val->state_flags & BACKGROUND_OBJECT) {
|
||||||
crc_processCOUNT(state, val->life_span);
|
// The element never influences the state of other elements,
|
||||||
crc_processCOUNT(state, val->crew_level);
|
// and is to be excluded from checksums.
|
||||||
crc_processBYTE(state, val->mass_points);
|
#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
|
// 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
|
// 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.
|
// as this does not have to be the same for both sides.
|
||||||
{
|
{
|
||||||
extern void new_ship(ELEMENT *ElementPtr);
|
extern void new_ship(ELEMENT *ElementPtr);
|
||||||
BYTE turn_wait = val->turn_wait;
|
BYTE turn_wait = val->turn_wait;
|
||||||
|
|
||||||
if (val->preprocess_func == new_ship)
|
if (val->preprocess_func == new_ship)
|
||||||
turn_wait = 0;
|
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
|
#ifdef DUMP_CRC_OPS
|
||||||
crc_log("END crc_processELEMENT().");
|
crc_log("END crc_processELEMENT().");
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user