mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-22 03:55:11 +00:00
Add range checks to model index
This commit is contained in:
parent
4688ffe1f0
commit
b8e70fb46f
2 changed files with 3 additions and 2 deletions
|
@ -13,7 +13,7 @@ struct NetworkPlayer* gNetworkPlayerServer = NULL;
|
|||
static char sDefaultPlayerName[] = "Player";
|
||||
|
||||
void network_player_init(void) {
|
||||
gNetworkPlayers[0].modelIndex = configPlayerModel;
|
||||
gNetworkPlayers[0].modelIndex = (configPlayerModel < CT_MAX) ? configPlayerModel : 0;
|
||||
gNetworkPlayers[0].paletteIndex = configPlayerPalette;
|
||||
}
|
||||
|
||||
|
@ -187,6 +187,7 @@ u8 network_player_connected(enum NetworkPlayerType type, u8 globalIndex, u8 mode
|
|||
if (name[0] == '\0') {
|
||||
name = sDefaultPlayerName;
|
||||
}
|
||||
if (modelIndex >= CT_MAX) { modelIndex = 0; }
|
||||
|
||||
if (type == NPT_LOCAL) {
|
||||
struct NetworkPlayer* np = &gNetworkPlayers[0];
|
||||
|
|
|
@ -98,7 +98,7 @@ void network_receive_network_players(struct Packet* p) {
|
|||
gNetworkSystem->save_id(localIndex, networkId);
|
||||
}
|
||||
} else {
|
||||
np->modelIndex = modelIndex;
|
||||
np->modelIndex = (modelIndex < CT_MAX) ? modelIndex : 0;
|
||||
np->paletteIndex = paletteIndex;
|
||||
network_player_update_model(localIndex);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue