Moderator cleanup
This commit is contained in:
parent
2ecb0bd08b
commit
4b7b6926d1
|
@ -9,7 +9,7 @@
|
|||
#include "level_table.h"
|
||||
|
||||
|
||||
extern int gIsModerator;
|
||||
extern u8 gIsModerator;
|
||||
static enum ChatConfirmCommand sConfirming = CCC_NONE;
|
||||
static u8 sConfirmPlayerIndex = 0;
|
||||
|
||||
|
@ -65,7 +65,7 @@ bool exec_chat_command(char* command) {
|
|||
if (ccc == CCC_BAN) {
|
||||
struct NetworkPlayer* np = &gNetworkPlayers[sConfirmPlayerIndex];
|
||||
if (!np->connected) { return true; }
|
||||
char message[256] = { 0 };
|
||||
char message[256] = { 0 };
|
||||
snprintf(message, 256, "\\#fff982\\Banning '%s%s\\#fff982\\'!", network_get_player_text_color_string(np->localIndex), np->name);
|
||||
djui_chat_message_create(message);
|
||||
if (gNetworkType == NT_SERVER) {
|
||||
|
@ -256,7 +256,7 @@ bool exec_chat_command(char* command) {
|
|||
}
|
||||
*(paramArea - 1) = 0;
|
||||
*(paramAct - 1) = 0;
|
||||
|
||||
|
||||
// Level
|
||||
s32 level = -1;
|
||||
if (sscanf(paramLevel, "%d", &level) <= 0) {
|
||||
|
|
|
@ -8,6 +8,23 @@ char** gModeratorAddresses = NULL;
|
|||
bool* gModerator = NULL;
|
||||
u16 gModeratorCount = 0;
|
||||
|
||||
void moderator_list_clear(void) {
|
||||
for (u16 i = 0; i < gModeratorCount; i++) {
|
||||
if (gModeratorAddresses[i] == NULL) { continue; }
|
||||
free(gModeratorAddresses[i]);
|
||||
}
|
||||
gModeratorCount = 0;
|
||||
|
||||
if (gModeratorAddresses != NULL) {
|
||||
free(gModeratorAddresses);
|
||||
gModeratorAddresses = NULL;
|
||||
}
|
||||
if (gModerator != NULL) {
|
||||
free(gModerator);
|
||||
gModerator = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void moderator_list_add(char* address, bool perm) {
|
||||
u16 index = gModeratorCount++;
|
||||
if (gModeratorAddresses == NULL) {
|
||||
|
|
|
@ -7,6 +7,7 @@ extern char** gModeratorAddresses;
|
|||
extern bool* gModerator;
|
||||
extern u16 gModeratorCount;
|
||||
|
||||
void moderator_list_clear(void);
|
||||
void moderator_list_add(char* address, bool perm);
|
||||
bool moderator_list_contains(char* address);
|
||||
|
||||
|
|
|
@ -456,6 +456,9 @@ void network_shutdown(bool sendLeaving, bool exiting) {
|
|||
extern s16 gMenuMode;
|
||||
gMenuMode = -1;
|
||||
|
||||
extern u8 gIsModerator;
|
||||
gIsModerator = 0;
|
||||
|
||||
djui_panel_shutdown();
|
||||
extern bool gDjuiInMainMenu;
|
||||
if (!gDjuiInMainMenu) {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "pc/network/ban_list.h"
|
||||
#include "pc/network/moderator_list.h"
|
||||
|
||||
int gIsModerator;
|
||||
u8 gIsModerator = 0;
|
||||
|
||||
void network_send_chat_command(u8 globalIndex, enum ChatConfirmCommand ccc) {
|
||||
if (gIsModerator == 1) {
|
||||
|
|
Loading…
Reference in New Issue