summaryrefslogtreecommitdiff
path: root/src/map/npc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/npc.c')
-rw-r--r--src/map/npc.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/map/npc.c b/src/map/npc.c
index b57627495..84a2446ad 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -460,10 +460,10 @@ void npc_event_do_oninit(void)
*------------------------------------------*/
int npc_timerevent_export(struct npc_data *nd, int i)
{
- int t = 0, k = 0;
+ int t = 0, len = 0;
char *lname = nd->u.scr.label_list[i].name;
int pos = nd->u.scr.label_list[i].pos;
- if (sscanf(lname, "OnTimer%d%n", &t, &k) == 1 && lname[k] == '\0') {
+ if (sscanf(lname, "OnTimer%d%n", &t, &len) == 1 && lname[len] == '\0') {
// Timer event
struct npc_timerevent_list *te = nd->u.scr.timer_event;
int j, k = nd->u.scr.timeramount;
@@ -1616,7 +1616,7 @@ int npc_selllist_sub(struct map_session_data* sd, int n, unsigned short* item_li
/// @return result code for clif->parse_NpcSellListSend
int npc_selllist(struct map_session_data* sd, int n, unsigned short* item_list) {
double z;
- int i,skill_t, idx = skill->get_index(MC_OVERCHARGE);
+ int i,skill_t, skill_idx = skill->get_index(MC_OVERCHARGE);
struct npc_data *nd;
nullpo_retr(1, sd);
@@ -1680,9 +1680,9 @@ int npc_selllist(struct map_session_data* sd, int n, unsigned short* item_list)
pc->getzeny(sd, (int)z, LOG_TYPE_NPC, NULL);
// custom merchant shop exp bonus
- if( battle_config.shop_exp > 0 && z > 0 && ( skill_t = pc->checkskill2(sd,idx) ) > 0) {
- if( sd->status.skill[idx].flag >= SKILL_FLAG_REPLACED_LV_0 )
- skill_t = sd->status.skill[idx].flag - SKILL_FLAG_REPLACED_LV_0;
+ if( battle_config.shop_exp > 0 && z > 0 && ( skill_t = pc->checkskill2(sd,skill_idx) ) > 0) {
+ if( sd->status.skill[skill_idx].flag >= SKILL_FLAG_REPLACED_LV_0 )
+ skill_t = sd->status.skill[skill_idx].flag - SKILL_FLAG_REPLACED_LV_0;
if( skill_t > 0 ) {
z = z * (double)skill_t * (double)battle_config.shop_exp/10000.;
@@ -2311,7 +2311,7 @@ void npc_convertlabel_db(struct npc_label_list* label_list, const char *filepath
int lpos = script->labels[i].pos;
struct npc_label_list* label;
const char *p;
- int len;
+ size_t len;
// In case of labels not terminated with ':', for user defined function support
p = lname;
@@ -2859,7 +2859,6 @@ int npc_do_atcmd_event(struct map_session_data* sd, const char* command, const c
}
if( sd->npc_id != 0 ) { // Enqueue the event trigger.
- int i;
ARR_FIND( 0, MAX_EVENTQUEUE, i, sd->eventqueue[i][0] == '\0' );
if( i < MAX_EVENTQUEUE ) {
safestrncpy(sd->eventqueue[i],eventname,50); //Event enqueued.
@@ -3370,7 +3369,7 @@ const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, const char
else if (!strcmpi(w3,"adjust_unit_duration")) {
int skill_id, k;
char skill_name[MAP_ZONE_MAPFLAG_LENGTH], modifier[MAP_ZONE_MAPFLAG_LENGTH];
- int len = w4 ? strlen(w4) : 0;
+ size_t len = w4 ? strlen(w4) : 0;
modifier[0] = '\0';
if( w4 )
@@ -3425,7 +3424,7 @@ const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, const char
} else if (!strcmpi(w3,"adjust_skill_damage")) {
int skill_id, k;
char skill_name[MAP_ZONE_MAPFLAG_LENGTH], modifier[MAP_ZONE_MAPFLAG_LENGTH];
- int len = w4 ? strlen(w4) : 0;
+ size_t len = w4 ? strlen(w4) : 0;
modifier[0] = '\0';
@@ -3554,7 +3553,7 @@ int npc_parsesrcfile(const char* filepath, bool runOnInit) {
lines++;
// w1<TAB>w2<TAB>w3<TAB>w4
- count = sv->parse(p, len+buffer-p, 0, '\t', pos, ARRAYLENGTH(pos), (e_svopt)(SV_TERMINATE_LF|SV_TERMINATE_CRLF));
+ count = sv->parse(p, (int)(len+buffer-p), 0, '\t', pos, ARRAYLENGTH(pos), (e_svopt)(SV_TERMINATE_LF|SV_TERMINATE_CRLF));
if( count < 0 )
{
ShowError("npc_parsesrcfile: Parse error in file '%s', line '%d'. Stopping...\n", filepath, strline(buffer,p-buffer));