summaryrefslogtreecommitdiff
path: root/src/map/atcommand.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r--src/map/atcommand.c285
1 files changed, 131 insertions, 154 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 9d03dd057..e422a5de4 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -223,8 +223,8 @@ ACMD(send)
// read message type as hex number (without the 0x)
if (!*message
- || !((sscanf(message, "len %x", &type)==1 && (len=1, true))
- || sscanf(message, "%x", &type)==1)
+ || !((sscanf(message, "len %x", (unsigned int*)&type)==1 && (len=1, true))
+ || sscanf(message, "%x", (unsigned int*)&type)==1)
) {
clif->message(fd, msg_fd(fd,900)); // Usage:
clif->message(fd, msg_fd(fd,901)); // @send len <packet hex number>
@@ -252,7 +252,7 @@ ACMD(send)
} while(0) //define SKIP_VALUE
#define GET_VALUE(p,num) do { \
- if(sscanf((p), "x%lx", &(num)) < 1 && sscanf((p), "%ld ", &(num)) < 1){\
+ if(sscanf((p), "x%lx", (long unsigned int*)&(num)) < 1 && sscanf((p), "%ld ", &(num)) < 1){\
PARSE_ERROR("Invalid number in:",(p));\
return false;\
}\
@@ -260,24 +260,28 @@ ACMD(send)
if (type >= MIN_PACKET_DB && type <= MAX_PACKET_DB) {
int off = 2;
+ if (clif->packet(type) == NULL) {
+ // unknown packet - ERROR
+ safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,905), type); // Unknown packet: 0x%x
+ clif->message(fd, atcmd_output);
+ return false;
+ }
+
if (len) {
// show packet length
safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,904), type, clif->packet(type)->len); // Packet 0x%x length: %d
clif->message(fd, atcmd_output);
return true;
}
-
+
len = clif->packet(type)->len;
- if (len == 0) {
- // unknown packet - ERROR
- safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,905), type); // Unknown packet: 0x%x
- clif->message(fd, atcmd_output);
- return false;
- } else if (len == -1) {
+
+ if (len == -1) {
// dynamic packet
len = SHRT_MAX-4; // maximum length
off = 4;
}
+
WFIFOHEAD(sd->fd, len);
WFIFOW(sd->fd,0)=TOW(type);
@@ -543,7 +547,7 @@ ACMD(jumpto) {
return false;
}
- if((pl_sd=map->nick2sd((char *)message)) == NULL && (pl_sd=map->charid2sd(atoi(message))) == NULL) {
+ if((pl_sd=map->nick2sd((const char *)message)) == NULL && (pl_sd=map->charid2sd(atoi(message))) == NULL) {
clif->message(fd, msg_fd(fd,3)); // Character not found.
return false;
}
@@ -2268,11 +2272,11 @@ ACMD(gat) {
for (y = 2; y >= -2; y--) {
safesnprintf(atcmd_output, sizeof(atcmd_output), "%s (x= %d, y= %d) %02X %02X %02X %02X %02X",
map->list[sd->bl.m].name, sd->bl.x - 2, sd->bl.y + y,
- map->getcell(sd->bl.m, &sd->bl, sd->bl.x - 2, sd->bl.y + y, CELL_GETTYPE),
- map->getcell(sd->bl.m, &sd->bl, sd->bl.x - 1, sd->bl.y + y, CELL_GETTYPE),
- map->getcell(sd->bl.m, &sd->bl, sd->bl.x, sd->bl.y + y, CELL_GETTYPE),
- map->getcell(sd->bl.m, &sd->bl, sd->bl.x + 1, sd->bl.y + y, CELL_GETTYPE),
- map->getcell(sd->bl.m, &sd->bl, sd->bl.x + 2, sd->bl.y + y, CELL_GETTYPE));
+ (unsigned int)map->getcell(sd->bl.m, &sd->bl, sd->bl.x - 2, sd->bl.y + y, CELL_GETTYPE),
+ (unsigned int)map->getcell(sd->bl.m, &sd->bl, sd->bl.x - 1, sd->bl.y + y, CELL_GETTYPE),
+ (unsigned int)map->getcell(sd->bl.m, &sd->bl, sd->bl.x, sd->bl.y + y, CELL_GETTYPE),
+ (unsigned int)map->getcell(sd->bl.m, &sd->bl, sd->bl.x + 1, sd->bl.y + y, CELL_GETTYPE),
+ (unsigned int)map->getcell(sd->bl.m, &sd->bl, sd->bl.x + 2, sd->bl.y + y, CELL_GETTYPE));
clif->message(fd, atcmd_output);
}
@@ -2743,7 +2747,7 @@ ACMD(recall) {
return false;
}
- if((pl_sd=map->nick2sd((char *)message)) == NULL && (pl_sd=map->charid2sd(atoi(message))) == NULL) {
+ if((pl_sd=map->nick2sd((const char *)message)) == NULL && (pl_sd=map->charid2sd(atoi(message))) == NULL) {
clif->message(fd, msg_fd(fd,3)); // Character not found.
return false;
}
@@ -3068,7 +3072,7 @@ ACMD(kick)
return false;
}
- if((pl_sd=map->nick2sd((char *)message)) == NULL && (pl_sd=map->charid2sd(atoi(message))) == NULL) {
+ if((pl_sd=map->nick2sd((const char *)message)) == NULL && (pl_sd=map->charid2sd(atoi(message))) == NULL) {
clif->message(fd, msg_fd(fd,3)); // Character not found.
return false;
}
@@ -3609,16 +3613,16 @@ ACMD(reloadskilldb)
* @reloadatcommand - reloads conf/atcommand.conf conf/groups.conf
*------------------------------------------*/
ACMD(reloadatcommand) {
- config_t run_test;
+ struct config_t run_test;
- if (libconfig->read_file(&run_test, "conf/groups.conf")) {
+ if (!libconfig->load_file(&run_test, "conf/groups.conf")) {
clif->message(fd, msg_fd(fd,1036)); // Error reading groups.conf, reload failed.
return false;
}
libconfig->destroy(&run_test);
- if (libconfig->read_file(&run_test, map->ATCOMMAND_CONF_FILENAME)) {
+ if (!libconfig->load_file(&run_test, map->ATCOMMAND_CONF_FILENAME)) {
clif->message(fd, msg_fd(fd,1037)); // Error reading atcommand.conf, reload failed.
return false;
}
@@ -3639,6 +3643,8 @@ ACMD(reloadbattleconf)
memcpy(&prev_config, &battle_config, sizeof(prev_config));
battle->config_read(map->BATTLE_CONF_FILENAME);
+ if (prev_config.feature_roulette == 0 && battle_config.feature_roulette == 1 && !clif->parse_roulette_db())
+ battle_config.feature_roulette = 0;
if( prev_config.item_rate_mvp != battle_config.item_rate_mvp
|| prev_config.item_rate_common != battle_config.item_rate_common
@@ -3917,7 +3923,7 @@ ACMD(mapinfo)
strcat(atcmd_output, msg_fd(fd,1096)); // PartyLock |
if (map->list[m_id].flag.guildlock)
strcat(atcmd_output, msg_fd(fd,1097)); // GuildLock |
- if (map->list[m_id].flag.noviewid)
+ if (map->list[m_id].flag.noviewid != EQP_NONE)
strcat(atcmd_output, msg_fd(fd,1079)); // NoViewID |
clif->message(fd, atcmd_output);
@@ -5119,7 +5125,7 @@ ACMD(follow) {
return true;
}
- if ((pl_sd = map->nick2sd((char *)message)) == NULL)
+ if ((pl_sd = map->nick2sd((const char *)message)) == NULL)
{
clif->message(fd, msg_fd(fd,3)); // Character not found.
return false;
@@ -5258,7 +5264,7 @@ ACMD(clearcart)
for( i = 0; i < MAX_CART; i++ )
if(sd->status.cart[i].nameid > 0)
- pc->cart_delitem(sd, i, sd->status.cart[i].amount, 1, LOG_TYPE_OTHER);
+ pc->cart_delitem(sd, i, sd->status.cart[i].amount, 1, LOG_TYPE_COMMAND);
clif->clearcart(fd);
clif->updatestatus(sd,SP_CARTINFO);
@@ -5597,7 +5603,7 @@ ACMD(changegm) {
return false;
}
- if ((pl_sd=map->nick2sd((char *) message)) == NULL || pl_sd->status.guild_id != sd->status.guild_id) {
+ if ((pl_sd=map->nick2sd((const char *) message)) == NULL || pl_sd->status.guild_id != sd->status.guild_id) {
clif->message(fd, msg_fd(fd,1184)); // Target character must be online and be a guild member.
return false;
}
@@ -5617,7 +5623,7 @@ ACMD(changeleader) {
return false;
}
- if (party->changeleader(sd, map->nick2sd((char *) message)))
+ if (party->changeleader(sd, map->nick2sd((const char *) message)))
return true;
return false;
}
@@ -6376,7 +6382,7 @@ ACMD(trade) {
return false;
}
- if ( (pl_sd = map->nick2sd((char *)message)) == NULL ) {
+ if ( (pl_sd = map->nick2sd((const char *)message)) == NULL ) {
clif->message(fd, msg_fd(fd,3)); // Character not found.
return false;
}
@@ -6419,7 +6425,7 @@ ACMD(unmute) {
return false;
}
- if ((pl_sd = map->nick2sd((char *)message)) == NULL)
+ if ((pl_sd = map->nick2sd((const char *)message)) == NULL)
{
clif->message(fd, msg_fd(fd,3)); // Character not found.
return false;
@@ -7663,7 +7669,7 @@ ACMD(showdelay)
*------------------------------------------*/
ACMD(invite) {
unsigned int did = sd->duel_group;
- struct map_session_data *target_sd = map->nick2sd((char *)message);
+ struct map_session_data *target_sd = map->nick2sd((const char *)message);
if (did == 0)
{
@@ -7736,7 +7742,7 @@ ACMD(duel) {
duel->create(sd, maxpl);
} else {
struct map_session_data *target_sd;
- target_sd = map->nick2sd((char *)message);
+ target_sd = map->nick2sd((const char *)message);
if (target_sd != NULL) {
unsigned int newduel;
if ((newduel = duel->create(sd, 2)) != -1) {
@@ -7878,7 +7884,7 @@ ACMD(clone) {
return false;
}
- if ((pl_sd=map->nick2sd((char *)message)) == NULL && (pl_sd=map->charid2sd(atoi(message))) == NULL) {
+ if ((pl_sd=map->nick2sd((const char *)message)) == NULL && (pl_sd=map->charid2sd(atoi(message))) == NULL) {
clif->message(fd, msg_fd(fd,3)); // Character not found.
return false;
}
@@ -7915,7 +7921,7 @@ ACMD(clone) {
y = sd->bl.y;
}
- if ((x = mob->clone_spawn(pl_sd, sd->bl.m, x, y, "", master, 0, flag?1:0, 0)) > 0) {
+ if ((x = mob->clone_spawn(pl_sd, sd->bl.m, x, y, "", master, MD_NONE, flag?1:0, 0)) > 0) {
clif->message(fd, msg_fd(fd,128+flag*2)); // Evil Clone spawned. Clone spawned. Slave clone spawned.
return true;
}
@@ -8414,6 +8420,7 @@ ACMD(charcommands)
atcommand->commands_sub(sd, fd, COMMAND_CHARCOMMAND);
return true;
}
+
/* for new mounts */
ACMD(cashmount)
{
@@ -8425,7 +8432,7 @@ ACMD(cashmount)
clif->message(sd->fd,msg_fd(fd,1362)); // NOTICE: If you crash with mount your LUA is outdated.
if (!sd->sc.data[SC_ALL_RIDING]) {
clif->message(sd->fd,msg_fd(fd,1363)); // You have mounted.
- sc_start(NULL,&sd->bl,SC_ALL_RIDING,100,0,-1);
+ sc_start(NULL, &sd->bl, SC_ALL_RIDING, 100, 25, INFINITE_DURATION);
} else {
clif->message(sd->fd,msg_fd(fd,1364)); // You have released your mount.
status_change_end(&sd->bl, SC_ALL_RIDING, INVALID_TIMER);
@@ -9294,7 +9301,7 @@ ACMD(costume){
return false;
}
- sc_start(NULL,&sd->bl, name2id[k], 100, 0, -1);
+ sc_start(NULL, &sd->bl, name2id[k], 100, 0, INFINITE_DURATION);
return true;
}
@@ -9795,143 +9802,124 @@ void atcommand_get_suggestions(struct map_session_data* sd, const char *name, bo
}
/**
- * Executes an at-command
+ * Executes an at-command.
+ *
* @param fd fd associated to the invoking character
* @param sd sd associated to the invoking character
* @param message atcommand arguments
* @param player_invoked true if the command was invoked by a player, false if invoked by the server (bypassing any restrictions)
+ *
+ * @retval true if the message was recognized as atcommand.
+ * @retval false if the message should be considered a non-command message.
*/
-bool atcommand_exec(const int fd, struct map_session_data *sd, const char *message, bool player_invoked) {
- char charname[NAME_LENGTH], params[100];
- char charname2[NAME_LENGTH];
- char command[100];
+bool atcommand_exec(const int fd, struct map_session_data *sd, const char *message, bool player_invoked)
+{
+ char params[100], command[100];
char output[CHAT_SIZE_MAX];
- //Reconstructed message
+ // Reconstructed message
char atcmd_msg[CHAT_SIZE_MAX];
struct map_session_data *ssd = NULL; //sd for target
- AtCommandInfo * info;
+ AtCommandInfo *info;
+
+ bool is_atcommand = true; // false if it's a charcommand
nullpo_retr(false, sd);
- //Shouldn't happen
- if ( !message || !*message )
+ // Shouldn't happen
+ if (message == NULL || *message == '\0')
return false;
- //Block NOCHAT but do not display it as a normal message
+ // Block NOCHAT but do not display it as a normal message
if (pc_ismuted(&sd->sc, MANNER_NOCOMMAND))
return true;
// skip 10/11-langtype's codepage indicator, if detected
- if ( message[0] == '|' && strlen(message) >= 4 && (message[3] == atcommand->at_symbol || message[3] == atcommand->char_symbol) )
+ if (message[0] == '|' && strlen(message) >= 4 && (message[3] == atcommand->at_symbol || message[3] == atcommand->char_symbol))
message += 3;
- //Should display as a normal message
- if ( *message != atcommand->at_symbol && *message != atcommand->char_symbol )
+ // Should display as a normal message
+ if (*message != atcommand->at_symbol && *message != atcommand->char_symbol)
return false;
if (player_invoked) {
- //Commands are disabled on maps flagged as 'nocommand'
- if ( map->list[sd->bl.m].nocommand && pc_get_group_level(sd) < map->list[sd->bl.m].nocommand ) {
+ // Commands are disabled on maps flagged as 'nocommand'
+ if (map->list[sd->bl.m].nocommand && pc_get_group_level(sd) < map->list[sd->bl.m].nocommand) {
clif->message(fd, msg_fd(fd,143));
return false;
}
}
- if (*message == atcommand->char_symbol) {
- do {
- char params2[100];
- int x, y, z;
-
- //Checks to see if #command has a name or a name + parameters.
- x = sscanf(message, "%99s \"%23[^\"]\" %99[^\n]", command, charname, params);
- y = sscanf(message, "%99s %23s %99[^\n]", command, charname2, params2);
+ if (*message == atcommand->char_symbol)
+ is_atcommand = false;
- //z always has the value of the scan that was successful
- z = ( x > 1 ) ? x : y;
-
- //#command + name means the sufficient target was used and anything else after
- //can be looked at by the actual command function since most scan to see if the
- //right parameters are used.
- if ( x > 2 ) {
- sprintf(atcmd_msg, "%s %s", command, params);
- break;
- }
- else if ( y > 2 ) {
- sprintf(atcmd_msg, "%s %s", command, params2);
- break;
- }
- //Regardless of what style the #command is used, if it's correct, it will always have
- //this value if there is no parameter. Send it as just the #command
- else if ( z == 2 ) {
- sprintf(atcmd_msg, "%s", command);
- break;
- }
+ if (is_atcommand) { // #command
+ sprintf(atcmd_msg, "%s", message);
+ ssd = sd;
+ } else { // @command
+ char charname[NAME_LENGTH];
+ int n;
+
+ // Checks to see if #command has a name or a name + parameters.
+ if ((n = sscanf(message, "%99s \"%23[^\"]\" %99[^\n]", command, charname, params)) < 2
+ && (n = sscanf(message, "%99s %23s %99[^\n]", command, charname, params)) < 2
+ ) {
+ if (pc_get_group_level(sd) == 0) {
+ if (n < 1)
+ return false; // no command found. Display as normal message
- if( !pc_get_group_level(sd) ) {
- if( x >= 1 || y >= 1 ) { /* we have command */
- info = atcommand->get_info_byname(atcommand->check_alias(command + 1));
- if( !info || info->char_groups[pcg->get_idx(sd->group)] == 0 ) /* if we can't use or doesn't exist: don't even display the command failed message */
- return false;
- } else
- return false;/* display as normal message */
+ info = atcommand->get_info_byname(atcommand->check_alias(command + 1));
+ if (info == NULL || info->char_groups[pcg->get_idx(sd->group)] == 0) {
+ /* if we can't use or doesn't exist: don't even display the command failed message */
+ return false;
+ }
}
sprintf(output, msg_fd(fd,1388), atcommand->char_symbol); // Charcommand failed (usage: %c<command> <char name> <parameters>).
clif->message(fd, output);
return true;
- } while(0);
- }
- else /*if (*message == atcommand->at_symbol)*/ {
- //atcmd_msg is constructed above differently for charcommands
- //it's copied from message if not a charcommand so it can
- //pass through the rest of the code compatible with both symbols
- sprintf(atcmd_msg, "%s", message);
+ }
+
+ ssd = map->nick2sd(charname);
+ if (ssd == NULL) {
+ sprintf(output, msg_fd(fd,1389), command); // %s failed. Player not found.
+ clif->message(fd, output);
+ return true;
+ }
+
+ if (n > 2)
+ sprintf(atcmd_msg, "%s %s", command, params);
+ else
+ sprintf(atcmd_msg, "%s", command);
}
pc->update_idle_time(sd, BCIDLE_ATCOMMAND);
//Clearing these to be used once more.
- memset(command, '\0', sizeof(command));
- memset(params, '\0', sizeof(params));
+ memset(command, '\0', sizeof command);
+ memset(params, '\0', sizeof params);
//check to see if any params exist within this command
- if( sscanf(atcmd_msg, "%99s %99[^\n]", command, params) < 2 )
+ if (sscanf(atcmd_msg, "%99s %99[^\n]", command, params) < 2)
params[0] = '\0';
// @commands (script based)
- if(player_invoked && atcommand->binding_count > 0) {
- struct atcmd_binding_data * binding;
-
+ if (player_invoked && atcommand->binding_count > 0) {
// Get atcommand binding
- binding = atcommand->get_bind_byname(command);
+ struct atcmd_binding_data *binding = atcommand->get_bind_byname(command);
// Check if the binding isn't NULL and there is a NPC event, level of usage met, et cetera
- if( binding != NULL
- && binding->npc_event[0]
+ if (binding != NULL && binding->npc_event[0] != '\0'
&& (
- (*atcmd_msg == atcommand->at_symbol && pc_get_group_level(sd) >= binding->group_lv)
- || (*atcmd_msg == atcommand->char_symbol && pc_get_group_level(sd) >= binding->group_lv_char)
+ (is_atcommand && pc_get_group_level(sd) >= binding->group_lv)
+ || (!is_atcommand && pc_get_group_level(sd) >= binding->group_lv_char)
)
) {
- // Check if self or character invoking; if self == character invoked, then self invoke.
- bool invokeFlag = ((*atcmd_msg == atcommand->at_symbol) ? 1 : 0);
-
- // Check if the command initiated is a character command
- if (*message == atcommand->char_symbol
- && (ssd = map->nick2sd(charname)) == NULL
- && (ssd = map->nick2sd(charname2)) == NULL
- ) {
- sprintf(output, msg_fd(fd,1389), command); // %s failed. Player not found.
- clif->message(fd, output);
- return true;
- }
-
- if( binding->log ) /* log only if this command should be logged [Ind/Hercules] */
+ if (binding->log) /* log only if this command should be logged [Ind/Hercules] */
logs->atcommand(sd, atcmd_msg);
- npc->do_atcmd_event((invokeFlag ? sd : ssd), command, params, binding->npc_event);
+ npc->do_atcmd_event(ssd, command, params, binding->npc_event);
return true;
}
}
@@ -9939,51 +9927,40 @@ bool atcommand_exec(const int fd, struct map_session_data *sd, const char *messa
//Grab the command information and check for the proper GM level required to use it or if the command exists
info = atcommand->get_info_byname(atcommand->check_alias(command + 1));
if (info == NULL) {
- if( pc_get_group_level(sd) ) { // TODO: remove or replace with proper permission
- sprintf(output, msg_fd(fd,153), command); // "%s is Unknown Command."
- clif->message(fd, output);
- atcommand->get_suggestions(sd, command + 1, *message == atcommand->at_symbol);
- return true;
- } else
+ if (pc_get_group_level(sd) == 0) // TODO: remove or replace with proper permission
return false;
+
+ sprintf(output, msg_fd(fd,153), command); // "%s is Unknown Command."
+ clif->message(fd, output);
+ atcommand->get_suggestions(sd, command + 1, is_atcommand);
+ return true;
}
if (player_invoked) {
int i;
- if ((*command == atcommand->at_symbol && info->at_groups[pcg->get_idx(sd->group)] == 0) ||
- (*command == atcommand->char_symbol && info->char_groups[pcg->get_idx(sd->group)] == 0) ) {
+ if ((is_atcommand && info->at_groups[pcg->get_idx(sd->group)] == 0)
+ || (!is_atcommand && info->char_groups[pcg->get_idx(sd->group)] == 0))
return false;
- }
- if( pc_isdead(sd) && pc_has_permission(sd,PC_PERM_DISABLE_CMD_DEAD) ) {
+
+ if (pc_isdead(sd) && pc_has_permission(sd,PC_PERM_DISABLE_CMD_DEAD)) {
clif->message(fd, msg_fd(fd,1393)); // You can't use commands while dead
return true;
}
- for(i = 0; i < map->list[sd->bl.m].zone->disabled_commands_count; i++) {
- if( info->func == map->list[sd->bl.m].zone->disabled_commands[i]->cmd ) {
+ for (i = 0; i < map->list[sd->bl.m].zone->disabled_commands_count; i++) {
+ if (info->func == map->list[sd->bl.m].zone->disabled_commands[i]->cmd) {
if (pc_get_group_level(sd) < map->list[sd->bl.m].zone->disabled_commands[i]->group_lv) {
clif->messagecolor_self(sd->fd, COLOR_RED, "This command is disabled in this area");
return true;
- } else {
- break;/* already found the matching command, no need to keep checking -- just go on */
}
+ break; /* already found the matching command, no need to keep checking -- just go on */
}
}
}
- // Check if target is valid only if confirmed that player can use command.
- if (*message == atcommand->char_symbol
- && (ssd = map->nick2sd(charname)) == NULL
- && (ssd = map->nick2sd(charname2)) == NULL
- ) {
- sprintf(output, msg_fd(fd,1389), command); // %s failed. Player not found.
- clif->message(fd, output);
- return true;
- }
-
//Attempt to use the command
- if ( (info->func(fd, (*atcmd_msg == atcommand->at_symbol) ? sd : ssd, command, params,info) != true) ) {
+ if ((info->func(fd, ssd, command, params,info) != true)) {
#ifdef AUTOTRADE_PERSISTENCY
- if( info->func == atcommand_autotrade ) /** autotrade deletes caster, so we got nothing more to do here **/
+ if (info->func == atcommand_autotrade) /* autotrade deletes caster, so we got nothing more to do here */
return true;
#endif
sprintf(output,msg_fd(fd,154), command); // %s failed.
@@ -9991,8 +9968,8 @@ bool atcommand_exec(const int fd, struct map_session_data *sd, const char *messa
return true;
}
- if( info->log ) /* log only if this command should be logged [Ind/Hercules] */
- logs->atcommand(sd, *atcmd_msg == atcommand->at_symbol ? atcmd_msg : message);
+ if (info->log) /* log only if this command should be logged [Ind/Hercules] */
+ logs->atcommand(sd, is_atcommand ? atcmd_msg : message);
return true;
}
@@ -10001,13 +9978,13 @@ bool atcommand_exec(const int fd, struct map_session_data *sd, const char *messa
*
*------------------------------------------*/
void atcommand_config_read(const char* config_filename) {
- config_t atcommand_config;
- config_setting_t *aliases = NULL, *help = NULL, *nolog = NULL;
+ struct config_t atcommand_config;
+ struct config_setting_t *aliases = NULL, *help = NULL, *nolog = NULL;
const char *symbol = NULL;
int num_aliases = 0;
nullpo_retv(config_filename);
- if (libconfig->read_file(&atcommand_config, config_filename))
+ if (!libconfig->load_file(&atcommand_config, config_filename))
return;
// Command symbols
@@ -10036,7 +10013,7 @@ void atcommand_config_read(const char* config_filename) {
int count = libconfig->setting_length(aliases);
for (i = 0; i < count; ++i) {
- config_setting_t *command;
+ struct config_setting_t *command;
const char *commandname = NULL;
int j = 0, alias_count = 0;
AtCommandInfo *commandinfo = NULL;
@@ -10074,7 +10051,7 @@ void atcommand_config_read(const char* config_filename) {
int count = libconfig->setting_length(nolog);
for (i = 0; i < count; ++i) {
- config_setting_t *command;
+ struct config_setting_t *command;
const char *commandname = NULL;
AtCommandInfo *commandinfo = NULL;
@@ -10096,7 +10073,7 @@ void atcommand_config_read(const char* config_filename) {
int i;
for (i = 0; i < count; ++i) {
- config_setting_t *command;
+ struct config_setting_t *command;
const char *commandname;
AtCommandInfo *commandinfo = NULL;
@@ -10139,7 +10116,7 @@ static inline int atcommand_command_type2idx(AtCommandType type)
* Loads permissions for groups to use commands.
*
*/
-void atcommand_db_load_groups(GroupSettings **groups, config_setting_t **commands_, size_t sz)
+void atcommand_db_load_groups(GroupSettings **groups, struct config_setting_t **commands_, size_t sz)
{
DBIterator *iter = db_iterator(atcommand->db);
AtCommandInfo *atcmd;
@@ -10152,7 +10129,7 @@ void atcommand_db_load_groups(GroupSettings **groups, config_setting_t **command
CREATE(atcmd->char_groups, char, sz);
for (i = 0; i < sz; i++) {
GroupSettings *group = groups[i];
- config_setting_t *commands = commands_[i];
+ struct config_setting_t *commands = commands_[i];
int result = 0;
int idx = -1;
@@ -10173,7 +10150,7 @@ void atcommand_db_load_groups(GroupSettings **groups, config_setting_t **command
}
if (commands != NULL) {
- config_setting_t *cmd = NULL;
+ struct config_setting_t *cmd = NULL;
// <commandname> : <bool> (only atcommand)
if (config_setting_lookup_bool(commands, atcmd->command, &result) && result) {