summaryrefslogtreecommitdiff
path: root/src/map/mob.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/mob.c')
-rw-r--r--src/map/mob.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/src/map/mob.c b/src/map/mob.c
index 070c0ea63..6bd7829ba 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2012-2016 Hercules Dev Team
+ * Copyright (C) 2012-2018 Hercules Dev Team
* Copyright (C) Athena Dev Teams
*
* Hercules is free software: you can redistribute it and/or modify
@@ -316,9 +316,9 @@ int mob_parse_dataset(struct spawn_data *data)
memmove(data->eventname, data->eventname+1, len-1);
}
- if(strcmp(data->name,"--en--")==0)
+ if (strcmp(data->name, DEFAULT_MOB_NAME) == 0)
safestrncpy(data->name, mob->db(data->class_)->name, sizeof(data->name));
- else if(strcmp(data->name,"--ja--")==0)
+ else if (strcmp(data->name, DEFAULT_MOB_JNAME) == 0)
safestrncpy(data->name, mob->db(data->class_)->jname, sizeof(data->name));
return 1;
@@ -498,13 +498,12 @@ struct mob_data *mob_once_spawn_sub(struct block_list *bl, int16 m, int16 x, int
data.state.size = size;
data.state.ai = ai;
- if (mobname)
+ if (mobname != NULL)
safestrncpy(data.name, mobname, sizeof(data.name));
+ else if (battle_config.override_mob_names == 1)
+ strcpy(data.name, DEFAULT_MOB_NAME);
else
- if (battle_config.override_mob_names == 1)
- strcpy(data.name, "--en--");
- else
- strcpy(data.name, "--ja--");
+ strcpy(data.name, DEFAULT_MOB_JNAME);
if (event)
safestrncpy(data.eventname, event, sizeof(data.eventname));
@@ -3034,10 +3033,10 @@ int mob_summonslave(struct mob_data *md2,int *value,int amount,uint16 skill_id)
}
//These two need to be loaded from the db for each slave.
- if(battle_config.override_mob_names==1)
- strcpy(data.name,"--en--");
+ if (battle_config.override_mob_names == 1)
+ strcpy(data.name, DEFAULT_MOB_NAME);
else
- strcpy(data.name,"--ja--");
+ strcpy(data.name, DEFAULT_MOB_JNAME);
if (!mob->parse_dataset(&data))
continue;
@@ -3649,7 +3648,7 @@ int mob_clone_spawn(struct map_session_data *sd, int16 m, int16 x, int16 y, cons
sd->fd = fd;
//Finally, spawn it.
- md = mob->once_spawn_sub(&sd->bl, m, x, y, "--en--", class_, event, SZ_SMALL, AI_NONE);
+ md = mob->once_spawn_sub(&sd->bl, m, x, y, DEFAULT_MOB_NAME, class_, event, SZ_SMALL, AI_NONE);
if (!md) return 0; //Failed?
md->special_state.clone = 1;
@@ -4313,7 +4312,7 @@ int mob_read_db_sub(struct config_setting_t *mobt, int n, const char *source)
if (mob->lookup_const(mobt, "AttackRange", &i32) && i32 >= 0) {
md.status.rhw.range = i32;
- } else {
+ } else if (!inherit) {
md.status.rhw.range = 1;
}
@@ -4880,7 +4879,7 @@ bool mob_skill_db_libconfig_sub(struct config_setting_t *it, int n)
bool mob_skill_db_libconfig_sub_skill(struct config_setting_t *it, int n, int mob_id)
{
- int i, j;
+ int i, j, idx = 0;
int i32;
int skill_id = 0;
int skill_idx = 0;
@@ -4911,8 +4910,8 @@ bool mob_skill_db_libconfig_sub_skill(struct config_setting_t *it, int n, int mo
memset(&gms, 0, sizeof (struct mob_skill));
ms = &gms;
} else {
- ARR_FIND(0, MAX_MOBSKILL, i, (ms = &mob->db_data[mob_id]->skill[i])->skill_id == 0);
- if (i == MAX_MOBSKILL) {
+ ARR_FIND(0, MAX_MOBSKILL, idx, (ms = &mob->db_data[mob_id]->skill[idx])->skill_id == 0);
+ if (idx == MAX_MOBSKILL) {
ShowError("mob_skill_db_libconfig_sub_skill: Too many skills for monster %d\n", mob_id);
return false;
}
@@ -5044,7 +5043,7 @@ bool mob_skill_db_libconfig_sub_skill(struct config_setting_t *it, int n, int mo
mob->db_data[i]->maxskill = j + 1;
}
} else { //Skill set on a single mob.
- mob->db_data[mob_id]->maxskill = i + 1;
+ mob->db_data[mob_id]->maxskill = idx + 1;
}
return true;