Allow host to own objects when no one else is connected
This commit is contained in:
parent
f8c5fb0725
commit
e17cba85f3
|
@ -269,7 +269,7 @@ void network_update(void) {
|
|||
gNetworkAreaTimer = (clock_elapsed_ticks() - gNetworkAreaTimerClock);
|
||||
|
||||
// send out update packets
|
||||
if (gNetworkType != NT_NONE && network_player_any_connected()) {
|
||||
if (gNetworkType != NT_NONE) {
|
||||
network_player_update();
|
||||
if (sCurrPlayMode == PLAY_MODE_NORMAL || sCurrPlayMode == PLAY_MODE_PAUSED) {
|
||||
network_update_player();
|
||||
|
|
|
@ -112,7 +112,7 @@ struct NetworkPlayer* get_network_player_smallest_global(void) {
|
|||
}
|
||||
|
||||
void network_player_update(void) {
|
||||
|
||||
if (!network_player_any_connected()) { return; }
|
||||
//#ifndef DEVELOPMENT
|
||||
if (gNetworkType == NT_SERVER) {
|
||||
for (int i = 1; i < MAX_PLAYERS; i++) {
|
||||
|
|
|
@ -58,7 +58,7 @@ static bool should_own_object(struct SyncObject* so) {
|
|||
}
|
||||
if (so->o->oHeldState == HELD_HELD && so->o->heldByPlayerIndex == 0) { return true; }
|
||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
||||
if (!is_player_active(&gMarioStates[i])) { continue; }
|
||||
if (i != 0 && !is_player_active(&gMarioStates[i])) { continue; }
|
||||
if (player_distance(&gMarioStates[0], so->o) > player_distance(&gMarioStates[i], so->o)) { return false; }
|
||||
}
|
||||
if (so->o->oHeldState == HELD_HELD && so->o->heldByPlayerIndex != 0) { return false; }
|
||||
|
@ -570,7 +570,9 @@ void network_update_objects(void) {
|
|||
if (timeSinceUpdate < updateRate) { continue; }
|
||||
|
||||
// update!
|
||||
network_send_object(gSyncObjects[i].o);
|
||||
if (network_player_any_connected()) {
|
||||
network_send_object(gSyncObjects[i].o);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -338,5 +338,6 @@ void network_receive_player(struct Packet* p) {
|
|||
}
|
||||
|
||||
void network_update_player(void) {
|
||||
if (!network_player_any_connected()) { return; }
|
||||
network_send_player(0);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue