mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-22 03:55:11 +00:00
fixed a bug where sync objects could be duplicated (#35)
this would happen if the sync object was spawned before the other players in the level's area sync was valid
This commit is contained in:
parent
533404ca10
commit
8845b3ef0c
1 changed files with 15 additions and 0 deletions
|
@ -158,6 +158,21 @@ void network_receive_spawn_objects(struct Packet* p) {
|
|||
id = gNetworkSystem->get_id_str(p->localIndex);
|
||||
name = gNetworkPlayers[p->localIndex].name;
|
||||
}
|
||||
|
||||
// Don't overwrite existing sync objects
|
||||
{
|
||||
u32 syncID = data.rawData[0x04]; // o->oSyncID
|
||||
struct SyncObject *so = sync_object_get(syncID);
|
||||
if (so && so->o) {
|
||||
if (so->o->behavior == get_behavior_from_id(data.behaviorId)) {
|
||||
LOG_ERROR("recieved duplicate sync object with id %d from %s (%s)", syncID, name, id);
|
||||
} else {
|
||||
LOG_ERROR("recieved duplicate sync object with id %d with different behavior %s from %s (%s)", syncID, get_behavior_name_from_id(data.behaviorId), name, id);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
LOG_INFO("rx spawn object %s from %s (%s)", get_behavior_name_from_id(data.behaviorId), name, id);
|
||||
LOG_CONSOLE("rx spawn object %s from %s\\#dcdcdc\\ (%s)", get_behavior_name_from_id(data.behaviorId), name, id);
|
||||
snprintf(gLastRemoteBhv, 256, "%s %s (%s)", get_behavior_name_from_id(data.behaviorId), name, id);
|
||||
|
|
Loading…
Reference in a new issue