Merge branch 'coop' of github.com:sm64ex-coop-dev/sm64ex-coop into coop
This commit is contained in:
commit
91988cc426
|
@ -45,7 +45,7 @@ void DynOS_Actor_AddCustom(const SysPath &aFilename, const char *aActorName) {
|
|||
}
|
||||
|
||||
// Alloc and init the actors gfx list
|
||||
ActorGfx actorGfx = { 0 };
|
||||
ActorGfx actorGfx = { };
|
||||
actorGfx.mGfxData = _GfxData;
|
||||
actorGfx.mGraphNode = (GraphNode *) DynOS_Geo_GetGraphNode(geoLayout, false);
|
||||
actorGfx.mPackIndex = MOD_PACK_INDEX;
|
||||
|
|
|
@ -186,6 +186,10 @@ bool network_allow_unknown_local_index(enum PacketType packetType) {
|
|||
}
|
||||
|
||||
void network_send_to(u8 localIndex, struct Packet* p) {
|
||||
if (p == NULL) {
|
||||
LOG_ERROR("no data to send");
|
||||
return;
|
||||
}
|
||||
// sanity checks
|
||||
if (gNetworkType == NT_NONE) { LOG_ERROR("network type error none!"); return; }
|
||||
if (p->error) { LOG_ERROR("packet error!"); return; }
|
||||
|
@ -272,6 +276,10 @@ void network_send_to(u8 localIndex, struct Packet* p) {
|
|||
}
|
||||
|
||||
void network_send(struct Packet* p) {
|
||||
if (p == NULL) {
|
||||
LOG_ERROR("no data to send");
|
||||
return;
|
||||
}
|
||||
// prevent errors during writing from propagating
|
||||
if (p->writeError) {
|
||||
LOG_ERROR("packet has write error: %u", p->packetType);
|
||||
|
|
|
@ -52,7 +52,7 @@ void packet_process(struct Packet* p) {
|
|||
case PACKET_CHAT: network_receive_chat(p); break;
|
||||
case PACKET_KICK: network_receive_kick(p); break;
|
||||
case PACKET_COMMAND: network_recieve_chat_command(p); break;
|
||||
case PACKET_MODERATOR: network_recieve_moderator(); break;
|
||||
case PACKET_MODERATOR: network_recieve_moderator(p); break;
|
||||
case PACKET_KEEP_ALIVE: network_receive_keep_alive(p); break;
|
||||
case PACKET_LEAVING: network_receive_leaving(p); break;
|
||||
case PACKET_SAVE_FILE: network_receive_save_file(p); break;
|
||||
|
|
|
@ -247,7 +247,7 @@ void network_recieve_chat_command(struct Packet* p);
|
|||
|
||||
// packet_moderator.c
|
||||
void network_send_moderator(u8 localIndex);
|
||||
void network_recieve_moderator(void);
|
||||
void network_recieve_moderator(struct Packet* p);
|
||||
|
||||
// packet_keep_alive.c
|
||||
void network_send_keep_alive(u8 localIndex);
|
||||
|
|
|
@ -52,10 +52,15 @@ void network_send_moderator(u8 localIndex) {
|
|||
network_send_to(localIndex, &p);
|
||||
}
|
||||
|
||||
void network_recieve_moderator(void) {
|
||||
void network_recieve_moderator(struct Packet* p) {
|
||||
if (gIsModerator == 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (network_player_any_connected() && gNetworkPlayers[p->localIndex].type != NPT_SERVER) {
|
||||
return;
|
||||
}
|
||||
|
||||
gIsModerator = 1;
|
||||
djui_chat_message_create("\\#fff982\\You are now a Moderator.");
|
||||
}
|
Loading…
Reference in New Issue