diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/map/atcommand.c | 2 | ||||
-rw-r--r-- | src/map/battle.c | 2 | ||||
-rw-r--r-- | src/map/charcommand.c | 2 | ||||
-rw-r--r-- | src/map/map.c | 24 | ||||
-rw-r--r-- | src/map/map.h | 3 | ||||
-rw-r--r-- | src/map/mob.c | 2 | ||||
-rw-r--r-- | src/map/npc.c | 13 | ||||
-rw-r--r-- | src/map/pc.c | 2 |
8 files changed, 23 insertions, 27 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index f13306fed..689780909 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -5178,7 +5178,7 @@ int atcommand_disguise(const int fd, struct map_session_data* sd, const char* co { struct npc_data* nd = npc_name2id(message); if (nd != NULL) - id = nd->n; + id = nd->class_; } } diff --git a/src/map/battle.c b/src/map/battle.c index 9e5d05623..cd54a2e39 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -3020,7 +3020,7 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f return -1; } - if (flag&BCT_ENEMY && map_getcell(m,src->x,src->y,CELL_CHKNODAMAGE) || map_getcell(m,target->x,target->y,CELL_CHKNODAMAGE)) + if (flag&BCT_ENEMY && (map_getcell(m,src->x,src->y,CELL_CHKNODAMAGE) || map_getcell(m,target->x,target->y,CELL_CHKNODAMAGE))) return -1; // [NoDamage] //t_bl/s_bl hold the 'master' of the attack, while src/target are the actual diff --git a/src/map/charcommand.c b/src/map/charcommand.c index a097dcbad..2e8c90b89 100644 --- a/src/map/charcommand.c +++ b/src/map/charcommand.c @@ -2896,7 +2896,7 @@ int charcommand_disguise(const int fd, struct map_session_data* sd, const char* { struct npc_data* nd = npc_name2id(mob_name); if (nd != NULL) - mob_id = nd->n; + mob_id = nd->class_; } } diff --git a/src/map/map.c b/src/map/map.c index 153206101..cc8de1a3a 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -1980,29 +1980,23 @@ bool mapit_exists(struct s_mapiterator* mapit) /*========================================== * map.npcへ追加 (warp等の領域持ちのみ) *------------------------------------------*/ -int map_addnpc(int m,struct npc_data *nd) +bool map_addnpc(int m,struct npc_data *nd) { - int i; + nullpo_retr(0, nd); + if( m < 0 || m >= map_num ) - return -1; + return false; - ARR_FIND( 0, map[m].npc_num, i, map[m].npc[i] == NULL ); - if( i == MAX_NPC_PER_MAP ) + if( map[m].npc_num == MAX_NPC_PER_MAP ) { ShowWarning("too many NPCs in one map %s\n",map[m].name); - return -1; + return false; } - nullpo_retr(0, nd); - - if( i == map[m].npc_num ) - map[m].npc_num++; - - map[m].npc[i]=nd; - nd->n = i; + map[m].npc[map[m].npc_num]=nd; + map[m].npc_num++; idb_put(id_db,nd->bl.id,nd); - - return i; + return true; } /*========================================= diff --git a/src/map/map.h b/src/map/map.h index 457494dab..84d041569 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -807,7 +807,6 @@ struct npc_data { struct view_data *vd; struct status_change sc; //They can't have status changes, but.. they want the visual opt values. struct npc_data *master_nd; - short n; short class_; short speed; char name[NAME_LENGTH+1];// display name @@ -1295,7 +1294,7 @@ bool map_knowsaccount(int account_id); int map_quit(struct map_session_data *); void map_quit_ack(int account_id, int char_id); // npc -int map_addnpc(int,struct npc_data *); +bool map_addnpc(int,struct npc_data *); // 床アイテム関連 int map_clearflooritem_timer(int,unsigned int,int,int); diff --git a/src/map/mob.c b/src/map/mob.c index f319fc144..1f78ec8d5 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -3427,7 +3427,7 @@ static bool mob_parse_dbrow(char** str) id->maxchance = db->dropitem[i].p; //item has bigger drop chance or sold in shops } for (k = 0; k< MAX_SEARCH; k++) { - if (id->mob[k].chance < db->dropitem[i].p && id->mob[k].id != class_) + if (id->mob[k].chance <= db->dropitem[i].p) break; } if (k == MAX_SEARCH) diff --git a/src/map/npc.c b/src/map/npc.c index 27110a996..dbb190ebb 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -1211,10 +1211,11 @@ int npc_remove_map(struct npc_data* nd) map_delblock(&nd->bl); //Remove npc from map[].npc list. [Skotlex] ARR_FIND( 0, map[m].npc_num, i, map[m].npc[i] == nd ); - if( i >= map[m].npc_num ) return 2; //failed to find it? + if( i == map[m].npc_num ) return 2; //failed to find it? map[m].npc_num--; - memmove(&map[m].npc[i], &map[m].npc[i+1], (map[m].npc_num-i)*sizeof(map[m].npc[0])); + map[m].npc[i] = map[m].npc[map[m].npc_num]; + map[m].npc[map[m].npc_num] = NULL; return 0; } @@ -1452,7 +1453,7 @@ struct npc_data* npc_add_warp(short from_mapid, short from_x, short from_y, shor CREATE(nd, struct npc_data, 1); nd->bl.id = npc_get_new_npc_id(); - nd->n = map_addnpc(from_mapid, nd); + map_addnpc(from_mapid, nd); nd->bl.prev = nd->bl.next = NULL; nd->bl.m = from_mapid; nd->bl.x = from_x; @@ -1514,7 +1515,7 @@ static const char* npc_parse_warp(char* w1, char* w2, char* w3, char* w4, const CREATE(nd, struct npc_data, 1); nd->bl.id = npc_get_new_npc_id(); - nd->n = map_addnpc(m, nd); + map_addnpc(m, nd); nd->bl.prev = nd->bl.next = NULL; nd->bl.m = m; nd->bl.x = x; @@ -1622,7 +1623,7 @@ static const char* npc_parse_shop(char* w1, char* w2, char* w3, char* w4, const nd->subtype = SHOP; if( m >= 0 ) {// normal shop npc - nd->n = map_addnpc(m,nd); + map_addnpc(m,nd); map_addblock(&nd->bl); status_set_viewdata(&nd->bl, nd->class_); status_change_init(&nd->bl); @@ -1858,7 +1859,7 @@ static const char* npc_parse_script(char* w1, char* w2, char* w3, char* w4, cons if( m >= 0 ) { - nd->n = map_addnpc(m, nd); + map_addnpc(m, nd); status_change_init(&nd->bl); unit_dataset(&nd->bl); nd->ud.dir = dir; diff --git a/src/map/pc.c b/src/map/pc.c index 3d0d0fc95..082a61aa3 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -6867,6 +6867,8 @@ void pc_bleeding (struct map_session_data *sd, unsigned int diff_tick) hp += sd->hp_loss.value; sd->hp_loss.tick -= sd->hp_loss.rate; } + if(hp >= sd->battle_status.hp) + hp = sd->battle_status.hp-1; //Script drains cannot kill you. } if (sd->sp_loss.value) { |