[refactor] Mark all internal functions static

All packet handlers and helper functions that are only used in the
source file they're declared in have been taken out of the namespaces in
the corresponding header files, have been marked static, and have been
reordered to avoid the need for declarations at the top of each source
file.

Each source file now contains a "using namespace" directive so that the
static functions don't need to prefix the source file's symbols with
their namespace. All redundant namespace prefixes found have been
removed.

An unused nano power resetting function in NanoManager has been removed.
This commit is contained in:
2021-03-16 22:06:10 +01:00
parent 04c56ce426
commit cee09f6344
36 changed files with 1808 additions and 1957 deletions

View File

@@ -1,7 +1,18 @@
#include "Email.hpp"
#include "CNProtocol.hpp"
#include "CNStructs.hpp"
#include "CNShardServer.hpp"
#include "db/Database.hpp"
#include "PlayerManager.hpp"
#include "ItemManager.hpp"
#include "ChatManager.hpp"
using namespace Email;
// New email notification
void Email::emailUpdateCheck(CNSocket* sock, CNPacketData* data) {
static void emailUpdateCheck(CNSocket* sock, CNPacketData* data) {
if (data->size != sizeof(sP_CL2FE_REQ_PC_EMAIL_UPDATE_CHECK))
return; // malformed packet
@@ -11,7 +22,7 @@ void Email::emailUpdateCheck(CNSocket* sock, CNPacketData* data) {
}
// Retrieve page of emails
void Email::emailReceivePageList(CNSocket* sock, CNPacketData* data) {
static void emailReceivePageList(CNSocket* sock, CNPacketData* data) {
if (data->size != sizeof(sP_CL2FE_REQ_PC_RECV_EMAIL_PAGE_LIST))
return; // malformed packet
@@ -41,7 +52,7 @@ void Email::emailReceivePageList(CNSocket* sock, CNPacketData* data) {
}
// Read individual email
void Email::emailRead(CNSocket* sock, CNPacketData* data) {
static void emailRead(CNSocket* sock, CNPacketData* data) {
if (data->size != sizeof(sP_CL2FE_REQ_PC_READ_EMAIL))
return; // malformed packet
@@ -66,7 +77,7 @@ void Email::emailRead(CNSocket* sock, CNPacketData* data) {
}
// Retrieve attached taros from email
void Email::emailReceiveTaros(CNSocket* sock, CNPacketData* data) {
static void emailReceiveTaros(CNSocket* sock, CNPacketData* data) {
if (data->size != sizeof(sP_CL2FE_REQ_PC_RECV_EMAIL_CANDY))
return; // malformed packet
@@ -89,7 +100,7 @@ void Email::emailReceiveTaros(CNSocket* sock, CNPacketData* data) {
}
// Retrieve individual attached item from email
void Email::emailReceiveItemSingle(CNSocket* sock, CNPacketData* data) {
static void emailReceiveItemSingle(CNSocket* sock, CNPacketData* data) {
if (data->size != sizeof(sP_CL2FE_REQ_PC_RECV_EMAIL_ITEM))
return; // malformed packet
@@ -128,7 +139,7 @@ void Email::emailReceiveItemSingle(CNSocket* sock, CNPacketData* data) {
}
// Retrieve all attached items from email
void Email::emailReceiveItemAll(CNSocket* sock, CNPacketData* data) {
static void emailReceiveItemAll(CNSocket* sock, CNPacketData* data) {
if (data->size != sizeof(sP_CL2FE_REQ_PC_RECV_EMAIL_ITEM_ALL))
return; // malformed packet
@@ -173,7 +184,7 @@ void Email::emailReceiveItemAll(CNSocket* sock, CNPacketData* data) {
}
// Delete an email
void Email::emailDelete(CNSocket* sock, CNPacketData* data) {
static void emailDelete(CNSocket* sock, CNPacketData* data) {
if (data->size != sizeof(sP_CL2FE_REQ_PC_DELETE_EMAIL))
return; // malformed packet
@@ -190,7 +201,7 @@ void Email::emailDelete(CNSocket* sock, CNPacketData* data) {
}
// Send an email
void Email::emailSend(CNSocket* sock, CNPacketData* data) {
static void emailSend(CNSocket* sock, CNPacketData* data) {
if (data->size != sizeof(sP_CL2FE_REQ_PC_SEND_EMAIL))
return; // malformed packet