summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-01-07 01:28:05 +0300
committerAndrei Karas <akaras@inbox.ru>2016-03-14 19:19:44 +0300
commitdf2e519d0fafe8166d8c7f2af8db30cc0d21779b (patch)
tree6131b6ee74905d8bca8df9196d6871cd7f3524f9
parent2ce1e241d7e6f66ffb622050c12654c493b71b26 (diff)
downloadhercules-df2e519d0fafe8166d8c7f2af8db30cc0d21779b.tar.gz
hercules-df2e519d0fafe8166d8c7f2af8db30cc0d21779b.tar.bz2
hercules-df2e519d0fafe8166d8c7f2af8db30cc0d21779b.tar.xz
hercules-df2e519d0fafe8166d8c7f2af8db30cc0d21779b.zip
mob.c incomplete
-rw-r--r--src/map/mob.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/map/mob.c b/src/map/mob.c
index 8d38fead7..e553131db 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -114,6 +114,8 @@ struct mob_chat *mob_chat(short id) {
int mobdb_searchname(const char *str)
{
int i;
+
+ nullpo_ret(str);
for(i=0;i<=MAX_MOB_DB;i++){
struct mob_db *monster = mob->db(i);
if(monster == mob->dummy) //Skip dummy mobs.
@@ -129,10 +131,13 @@ int mobdb_searchname(const char *str)
return 0;
}
int mobdb_searchname_array_sub(struct mob_db* monster, const char *str, int flag) {
+
+ nullpo_ret(monster);
if (monster == mob->dummy)
return 1;
if(!monster->base_exp && !monster->job_exp && monster->spawn[0].qty < 1)
return 1; // Monsters with no base/job exp and no spawn point are, by this criteria, considered "slave mobs" and excluded from search results
+ nullpo_ret(str);
if( !flag ) {
if(stristr(monster->jname,str))
return 0;
@@ -156,6 +161,7 @@ void mvptomb_create(struct mob_data *md, char *killer, time_t time)
{
struct npc_data *nd;
+ nullpo_retv(md);
if ( md->tomb_nid )
mob->mvptomb_destroy(md);
@@ -181,6 +187,7 @@ void mvptomb_create(struct mob_data *md, char *killer, time_t time)
void mvptomb_destroy(struct mob_data *md) {
struct npc_data *nd;
+ nullpo_retv(md);
if ( (nd = map->id2nd(md->tomb_nid)) ) {
int16 m, i;
@@ -212,6 +219,7 @@ int mobdb_searchname_array(struct mob_db** data, int size, const char *str, int
{
int count = 0, i;
struct mob_db* monster;
+ nullpo_ret(data);
for(i=0;i<=MAX_MOB_DB;i++){
monster = mob->db(i);
if (monster == mob->dummy || mob->is_clone(i) ) //keep clones out (or you leak player stats)
@@ -253,6 +261,7 @@ int mob_parse_dataset(struct spawn_data *data)
{
size_t len;
+ nullpo_ret(data);
if ((!mob->db_checkid(data->class_) && !mob->is_clone(data->class_)) || !data->num)
return 0;
@@ -276,6 +285,7 @@ int mob_parse_dataset(struct spawn_data *data)
*------------------------------------------*/
struct mob_data* mob_spawn_dataset(struct spawn_data *data) {
struct mob_data *md = NULL;
+ nullpo_retr(NULL, data);
CREATE(md, struct mob_data, 1);
md->bl.id= npc->get_new_npc_id();
md->bl.type = BL_MOB;
@@ -328,6 +338,7 @@ int mob_get_random_id(int type, int flag, int lv)
ShowError("mob_get_random_id: Invalid type (%d) of random monster.\n", type);
return 0;
}
+ Assert_ret(type >= 0 && type < MAX_RANDOMMONSTER);
do {
if (type)
class_ = summon[type].class_[rnd()%summon[type].qty];
@@ -624,6 +635,7 @@ int mob_spawn_guardian_sub(int tid, int64 tick, int id, intptr_t data) {
return 0;
}
+//++++++++
/*==========================================
* Summoning Guardians [Valaris]
*------------------------------------------*/