Fixed all warnings in MSVS (#8391)

Fixes #2859
Fixes #3570
Fixes #8389
This commit is contained in:
Lemongrass3110
2024-06-04 03:07:16 +02:00
committed by GitHub
parent 660b194ade
commit 48b4623f3e
37 changed files with 205 additions and 186 deletions

View File

@@ -1651,7 +1651,7 @@ ACMD_FUNC(baselevelup)
party_send_levelup(sd);
if( level > 0 && battle_config.atcommand_levelup_events )
npc_script_event(sd,NPCE_BASELVUP);
npc_script_event( *sd, NPCE_BASELVUP );
return 0;
}
@@ -1709,7 +1709,7 @@ ACMD_FUNC(joblevelup)
status_calc_pc(sd, SCO_FORCE);
if( level > 0 && battle_config.atcommand_levelup_events )
npc_script_event(sd,NPCE_JOBLVUP);
npc_script_event( *sd, NPCE_JOBLVUP );
return 0;
}
@@ -3758,16 +3758,12 @@ ACMD_FUNC(lostskill)
*------------------------------------------*/
ACMD_FUNC(spiritball)
{
uint32 max_spiritballs;
int number;
nullpo_retr(-1, sd);
max_spiritballs = zmin(ARRAYLENGTH(sd->spirit_timer), 0x7FFF);
if( !message || !*message || (number = atoi(message)) < 0 || number > max_spiritballs )
{
if( !message || !*message || ( number = atoi( message ) ) < 0 || number > MAX_SPIRITBALL ){
char msg[CHAT_SIZE_MAX];
safesnprintf(msg, sizeof(msg), msg_txt(sd,1028), max_spiritballs); // Please enter a party name (usage: @party <party_name>).
safesnprintf( msg, sizeof( msg ), msg_txt( sd, 1028 ), MAX_SPIRITBALL ); // Please enter an amount (usage: @spiritball <number: 0-%d>).
clif_displaymessage(fd, msg);
return -1;
}
@@ -6154,7 +6150,7 @@ ACMD_FUNC(clearcart)
#define MAX_SKILLID_PARTIAL_RESULTS 5
#define MAX_SKILLID_PARTIAL_RESULTS_LEN 74 // "skill " (6) + "%d:" (up to 5) + "%s" (up to 30) + " (%s)" (up to 33)
ACMD_FUNC(skillid) {
int skillen, i, found = 0;
int i, found = 0;
char partials[MAX_SKILLID_PARTIAL_RESULTS][MAX_SKILLID_PARTIAL_RESULTS_LEN];
nullpo_retr(-1, sd);
@@ -6164,7 +6160,7 @@ ACMD_FUNC(skillid) {
return -1;
}
skillen = strlen(message);
size_t skillen = strlen( message );
for(const auto & skill : skill_db) {
uint16 skill_id = skill.second->nameid;
@@ -6521,7 +6517,7 @@ ACMD_FUNC(autotrade) {
}
if (battle_config.at_logout_event)
npc_script_event(sd, NPCE_LOGOUT); //Logout Event
npc_script_event( *sd, NPCE_LOGOUT );
channel_pcquit(sd,0xF); //leave all chan
clif_authfail_fd(sd->fd, 15);
@@ -8872,7 +8868,7 @@ ACMD_FUNC(showdelay)
*------------------------------------------*/
ACMD_FUNC(invite)
{
unsigned int did = sd->duel_group;
size_t did = sd->duel_group;
map_session_data *target_sd = nullptr;
memset(atcmd_player_name, '\0', sizeof(atcmd_player_name));
@@ -8959,7 +8955,7 @@ ACMD_FUNC(duel)
target_sd = map_nick2sd(atcmd_player_name,true);
if(target_sd != nullptr) {
unsigned int newduel;
size_t newduel;
if((newduel = duel_create(sd, 2)) != -1) {
if(target_sd->duel_group > 0 || target_sd->duel_invite > 0) {
clif_displaymessage(fd, msg_txt(sd,353)); // "Duel: Player already in duel."
@@ -9691,8 +9687,6 @@ static void atcommand_commands_sub(map_session_data* sd, const int fd, AtCommand
clif_displaymessage(fd, msg_txt(sd,273)); // "Commands available:"
for (cmd = (AtCommandInfo*)dbi_first(iter); dbi_exists(iter); cmd = (AtCommandInfo*)dbi_next(iter)) {
unsigned int slen = 0;
switch( type ) {
case COMMAND_CHARCOMMAND:
if( cmd->char_groups[sd->group->index] == 0 )
@@ -9707,7 +9701,7 @@ static void atcommand_commands_sub(map_session_data* sd, const int fd, AtCommand
}
slen = strlen(cmd->command);
size_t slen = strlen( cmd->command );
// flush the text buffer if this command won't fit into it
if (slen + cur - line_buff >= CHATBOX_SIZE) {
@@ -9729,7 +9723,8 @@ static void atcommand_commands_sub(map_session_data* sd, const int fd, AtCommand
int i, count_bind, gm_lvl = pc_get_group_level(sd);
for( i = count_bind = 0; i < atcmd_binding_count; i++ ) {
if ( gm_lvl >= ( (type - 1) ? atcmd_binding[i]->level2 : atcmd_binding[i]->level ) ) {
unsigned int slen = strlen(atcmd_binding[i]->command);
size_t slen = strlen( atcmd_binding[i]->command );
if ( count_bind == 0 ) {
cur = line_buff;
memset(line_buff,' ',CHATBOX_SIZE);
@@ -9823,7 +9818,8 @@ ACMD_FUNC(accinfo) {
*/
ACMD_FUNC(set) {
char reg[46], val[128], name[32];
int toset = 0, len;
int toset = 0;
size_t len;
uint32 index;
bool is_str = false;
int64 uid;
@@ -11587,7 +11583,7 @@ bool is_atcommand(const int fd, map_session_data* sd, const char* message, int t
void atcommand_db_load_groups(){
DBIterator *iter = db_iterator(atcommand_db);
AtCommandInfo* cmd;
int pc_group_max = player_group_db.size();
size_t pc_group_max = player_group_db.size();
for (cmd = (AtCommandInfo*)dbi_first(iter); dbi_exists(iter); cmd = (AtCommandInfo*)dbi_next(iter)) {
cmd->at_groups = (char*)aMalloc( pc_group_max * sizeof(char) );