diff options
-rw-r--r-- | src/map/homunculus.c | 8 | ||||
-rw-r--r-- | src/map/instance.c | 15 | ||||
-rw-r--r-- | src/map/intif.c | 2 |
3 files changed, 16 insertions, 9 deletions
diff --git a/src/map/homunculus.c b/src/map/homunculus.c index 2490bc659..8d529ea01 100644 --- a/src/map/homunculus.c +++ b/src/map/homunculus.c @@ -49,10 +49,9 @@ struct homunculus_interface *homun; //Returns the viewdata for homunculus struct view_data* homunculus_get_viewdata(int class_) { - Assert_retr(NULL, class_ >= HM_CLASS_BASE && class_ - HM_CLASS_BASE < MAX_HOMUNCULUS_CLASS); - if (homdb_checkid(class_)) - return &homun->dbs->viewdb[class_-HM_CLASS_BASE]; - return NULL; + Assert_retr(NULL, homdb_checkid(class_)); + + return &homun->dbs->viewdb[class_-HM_CLASS_BASE]; } enum homun_type homunculus_class2type(int class_) { @@ -127,7 +126,6 @@ int homunculus_dead(struct homun_data *hd) { nullpo_retr(3, hd); sd = hd->master; - nullpo_retr(3, sd); clif->emotion(&hd->bl, E_WAH); //Delete timers when dead. diff --git a/src/map/instance.c b/src/map/instance.c index 0f6e475b2..1649c751e 100644 --- a/src/map/instance.c +++ b/src/map/instance.c @@ -151,16 +151,25 @@ int instance_create(int owner_id, const char *name, enum instance_owner_type typ return i; } -/*-------------------------------------- +/** * Add a map to the instance using src map "name" - *--------------------------------------*/ + * + * @param name Source map name. + * @param instance_id The destination instance ID. + * @param usebasename Whether to generate a standard instance map name (only used if map_name is not NULL). + * @param map_name The name for the instanced map (may be NULL to generate a new one). + * @return The generated map's index. + * @retval -1 Map or instance not found. + * @retval -2 Duplicate map name. + * @retval -3 No more map indices available. + * @retval -4 Source map is already an instance. + **/ int instance_add_map(const char *name, int instance_id, bool usebasename, const char *map_name) { int16 m = map->mapname2mapid(name); int i, im = -1; size_t num_cell, size, j; nullpo_retr(-1, name); - nullpo_retr(-1, map_name); if( m < 0 ) return -1; // source map not found diff --git a/src/map/intif.c b/src/map/intif.c index 6819ad26c..9fe82302f 100644 --- a/src/map/intif.c +++ b/src/map/intif.c @@ -1007,7 +1007,7 @@ void mapif_parse_WisToGM(int fd) char *message; mes_len = RFIFOW(fd,2) - 32; - Assert_retv(mes_len > 0 && mes_len > 32000); + Assert_retv(mes_len > 0 && mes_len < 32000); message = (char *) (mes_len >= 255 ? (char *) aMalloc(mes_len) : mbuf); permission = RFIFOL(fd,28); |