summaryrefslogtreecommitdiff
path: root/src/map/npc.c
diff options
context:
space:
mode:
author(no author) <(no author)@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-01-23 20:38:44 +0000
committer(no author) <(no author)@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-01-23 20:38:44 +0000
commit2c5fabbc0b492cb5456e670ce9eb2352a11d5e3b (patch)
tree89c47d81729687d5a69cadde99ee350306eb814f /src/map/npc.c
parentc4e6857d4774b25dcd9b9137f76c14c92015d691 (diff)
downloadhercules-2c5fabbc0b492cb5456e670ce9eb2352a11d5e3b.tar.gz
hercules-2c5fabbc0b492cb5456e670ce9eb2352a11d5e3b.tar.bz2
hercules-2c5fabbc0b492cb5456e670ce9eb2352a11d5e3b.tar.xz
hercules-2c5fabbc0b492cb5456e670ce9eb2352a11d5e3b.zip
update
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@968 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/npc.c')
-rw-r--r--src/map/npc.c226
1 files changed, 113 insertions, 113 deletions
diff --git a/src/map/npc.c b/src/map/npc.c
index 0186fe6de..6fd630fd5 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -68,7 +68,7 @@ int npc_enable_sub( struct block_list *bl, va_list ap )
{
struct map_session_data *sd;
struct npc_data *nd;
- char *name=(char *)aCalloc(50,sizeof(char));
+ char *name=(char *)aCallocA(50,sizeof(char));
nullpo_retr(0, bl);
nullpo_retr(0, ap);
@@ -84,7 +84,7 @@ int npc_enable_sub( struct block_list *bl, va_list ap )
sd->areanpc_id=nd->bl.id;
npc_event(sd,strcat(name,"::OnTouch"),0);
}
- free(name);
+ aFree(name);
return 0;
}
int npc_enable(const char *name,int flag)
@@ -92,7 +92,7 @@ int npc_enable(const char *name,int flag)
struct npc_data *nd=strdb_search(npcname_db,name);
if (nd==NULL)
return 0;
-
+
if (flag&1) { // 有効化
nd->flag&=~1;
clif_spawnnpc(nd);
@@ -132,7 +132,7 @@ int npc_event_dequeue(struct map_session_data *sd)
sd->npc_id=0;
if (sd->eventqueue[0][0]) { // キューのイベント処理
- char *name=(char *)aCalloc(50,sizeof(char));
+ char *name=(char *)aCallocA(50,sizeof(char));
int i;
memcpy(name,sd->eventqueue[0],50);
@@ -164,9 +164,9 @@ int npc_event_timer(int tid,unsigned int tick,int id,int data)
struct map_session_data *sd=map_id2sd(id);
if (sd==NULL)
return 0;
-
+
npc_event(sd,(const char *)data,0);
- free((void*)data);
+ aFree((void*)data);
return 0;
}
@@ -226,7 +226,7 @@ int npc_timer(int tid,unsigned int tick,int id,int data) // Added by RoVeRT
{
strdb_foreach(npcname_db,npc_timer_sub);
- free((void*)data);
+ aFree((void*)data);
return 0;
}*/
/*==========================================
@@ -239,14 +239,14 @@ int npc_event_export(void *key,void *data,va_list ap)
char *lname=(char *)key;
int pos=(int)data;
struct npc_data *nd=va_arg(ap,struct npc_data *);
-
+
if ((lname[0]=='O' || lname[0]=='o')&&(lname[1]=='N' || lname[1]=='n')) {
struct event_data *ev;
char *buf;
char *p=strchr(lname,':');
// エクスポートされる
ev=aCalloc(sizeof(struct event_data), 1);
- buf=aCalloc(50, 1);
+ buf=aCallocA(50, 1);
if (ev==NULL || buf==NULL) {
printf("npc_event_export: out of memory !\n");
exit(1);
@@ -344,17 +344,17 @@ int npc_event_doall_sub(void *key,void *data,va_list ap)
run_script(ev->nd->u.scr.script,ev->pos,0,ev->nd->bl.id);
(*c)++;
}
-
+
return 0;
}
int npc_event_doall(const char *name)
{
int c=0;
char buf[64]="::";
-
+
strncpy(buf+2,name,62);
strdb_foreach(ev_db,npc_event_doall_sub,&c,buf);
- return c;
+ return c;
}
int npc_event_do_sub(void *key,void *data,va_list ap)
@@ -380,7 +380,7 @@ int npc_event_do_sub(void *key,void *data,va_list ap)
int npc_event_do(const char *name)
{
int c=0;
-
+
if (*name==':' && name[1]==':') {
return npc_event_doall(name+2);
}
@@ -400,7 +400,7 @@ int npc_event_do_clock(int tid,unsigned int tick,int id,int data)
char buf[64];
char *day="";
int c=0;
-
+
time(&timer);
t=localtime(&timer);
@@ -413,7 +413,7 @@ int npc_event_do_clock(int tid,unsigned int tick,int id,int data)
case 5: day = "Fri"; break;
case 6: day = "Sat"; break;
}
-
+
if (t->tm_min != ev_tm_b.tm_min ) {
sprintf(buf,"OnMinute%02d",t->tm_min);
c+=npc_event_doall(buf);
@@ -460,7 +460,7 @@ int npc_addeventtimer(struct npc_data *nd,int tick,const char *name)
if( nd->eventtimer[i]==-1 )
break;
if(i<MAX_EVENTTIMER){
- char *evname=aMalloc(24);
+ char *evname=aMallocA(24);
if(evname==NULL){
printf("npc_addeventtimer: out of memory !\n");exit(1);
}
@@ -541,12 +541,12 @@ int npc_timerevent_import(void *key,void *data,va_list ap)
int pos=(int)data;
struct npc_data *nd=va_arg(ap,struct npc_data *);
int t=0,i=0;
-
+
if(sscanf(lname,"OnTimer%d%n",&t,&i)==1 && lname[i]==':') {
// タイマーイベント
struct npc_timerevent_list *te=nd->u.scr.timer_event;
int j,i=nd->u.scr.timeramount;
- if(te==NULL) te=aMalloc(sizeof(struct npc_timerevent_list));
+ if(te==NULL) te=aMallocA(sizeof(struct npc_timerevent_list));
else te=aRealloc( te, sizeof(struct npc_timerevent_list) * (i+1) );
if(te==NULL){
printf("npc_timerevent_import: out of memory !\n");
@@ -581,7 +581,7 @@ int npc_timerevent(int tid,unsigned int tick,int id,int data)
nd->u.scr.timertick=tick;
te=nd->u.scr.timer_event+ nd->u.scr.nexttimer;
nd->u.scr.timerid = -1;
-
+
t = nd->u.scr.timer+=data;
nd->u.scr.nexttimer++;
if( nd->u.scr.timeramount>nd->u.scr.nexttimer ){
@@ -605,7 +605,7 @@ int npc_timerevent_start(struct npc_data *nd, int rid)
n=nd->u.scr.timeramount;
if( nd->u.scr.nexttimer>=0 || n==0 )
return 0;
-
+
for(j=0;j<n;j++){
if( nd->u.scr.timer_event[j].timer > nd->u.scr.timer )
break;
@@ -617,7 +617,7 @@ int npc_timerevent_start(struct npc_data *nd, int rid)
nd->u.scr.timertick=gettick();
if (rid >= 0) nd->u.scr.rid=rid; // changed to: attaching to given rid by default [Shinomori]
// if rid is less than 0 leave it unchanged [celest]
-
+
next = nd->u.scr.timer_event[j].timer - nd->u.scr.timer;
nd->u.scr.timerid = add_timer(gettick()+next,npc_timerevent,nd->bl.id,next);
return 0;
@@ -743,7 +743,7 @@ int npc_event(struct map_session_data *sd,const char *eventname,int mob_kill)
npc_event_dequeue(sd);
return 0;
}
-
+
sd->npc_id=nd->bl.id;
sd->npc_pos=run_script(nd->u.scr.script,ev->pos,sd->bl.id,nd->bl.id);
return 0;
@@ -764,7 +764,7 @@ int npc_command_sub(void *key,void *data,va_list ap)
if (strcmp(command,temp)==0)
run_script(ev->nd->u.scr.script,ev->pos,0,ev->nd->bl.id);
}
-
+
return 0;
}
@@ -793,7 +793,7 @@ int npc_touch_areanpc(struct map_session_data *sd,int m,int x,int y)
f=0;
continue;
}
-
+
switch(map[m].npc[i]->bl.subtype) {
case WARP:
xs=map[m].npc[i]->u.warp.xs;
@@ -824,7 +824,7 @@ int npc_touch_areanpc(struct map_session_data *sd,int m,int x,int y)
break;
case SCRIPT:
{
- char *name=(char *)aCalloc(50,sizeof(char));
+ char *name=(char *)aCallocA(50,sizeof(char));
memcpy(name,map[m].npc[i]->name,50);
if(sd->areanpc_id==map[m].npc[i]->bl.id)
@@ -832,7 +832,7 @@ int npc_touch_areanpc(struct map_session_data *sd,int m,int x,int y)
sd->areanpc_id=map[m].npc[i]->bl.id;
if(npc_event(sd,strcat(name,"::OnTouch"),0)>0)
npc_click(sd,map[m].npc[i]->bl.id);
- free(name);
+ aFree(name);
break;
}
}
@@ -855,7 +855,7 @@ int npc_checknear(struct map_session_data *sd,int id)
printf("no such npc : %d\n",id);
return 1;
}
-
+
if (nd->class_<0) // イベント系は常にOK
return 0;
@@ -968,7 +968,7 @@ int npc_buylist(struct map_session_data *sd,int n,unsigned short *item_list)
{
struct npc_data *nd;
double z;
- int i,j,w,skill,itemamount=0,new=0;
+ int i,j,w,skill,itemamount=0,new_=0;
nullpo_retr(3, sd);
nullpo_retr(3, item_list);
@@ -998,7 +998,7 @@ int npc_buylist(struct map_session_data *sd,int n,unsigned short *item_list)
case ADDITEM_EXIST:
break;
case ADDITEM_NEW:
- new++;
+ new_++;
break;
case ADDITEM_OVERAMOUNT:
return 2;
@@ -1010,7 +1010,7 @@ int npc_buylist(struct map_session_data *sd,int n,unsigned short *item_list)
return 1; // zeny不足
if (w+sd->weight > sd->max_weight)
return 2; // 重量超過
- if (pc_inventoryblank(sd)<new)
+ if (pc_inventoryblank(sd)<new_)
return 3; // 種類数超過
pc_payzeny(sd,(int)z);
@@ -1192,7 +1192,7 @@ static int npc_walk(struct npc_data *nd,unsigned int tick,int data)
if(nd->walkpath.path_pos>=nd->walkpath.path_len)
clif_fixnpcpos(nd); // When npc stops, retransmission current of a position.
-
+
}
return 0;
}
@@ -1237,7 +1237,7 @@ static int npc_walktimer(int tid,unsigned int tick,int id,int data)
if(nd->walktimer != tid){
return 0;
}
-
+
nd->walktimer=-1;
if(nd->bl.prev == NULL)
@@ -1302,7 +1302,7 @@ int npc_stop_walking(struct npc_data *nd,int type)
if(nd->state.state == MS_WALK || nd->state.state == MS_IDLE) {
int dx=0,dy=0;
-
+
nd->walkpath.path_len=0;
if(type&4){
dx=nd->to_x-nd->bl.x;
@@ -1352,7 +1352,7 @@ void npc_clearsrcfile()
while( p ) {
struct npc_src_list *p2=p;
p=p->next;
- free(p2);
+ aFree(p2);
}
npc_src_first=NULL;
npc_src_last=NULL;
@@ -1363,7 +1363,7 @@ void npc_clearsrcfile()
*/
void npc_addsrcfile(char *name)
{
- struct npc_src_list *new;
+ struct npc_src_list *new_;
size_t len;
if ( strcmpi(name,"clear")==0 ) {
@@ -1382,16 +1382,16 @@ void npc_addsrcfile(char *name)
}
}
- len = sizeof(*new) + strlen(name);
- new=(struct npc_src_list *)aCalloc(1,len);
- new->next = NULL;
- strncpy(new->name,name,strlen(name)+1);
+ len = sizeof(*new_) + strlen(name);
+ new_=(struct npc_src_list *)aCalloc(1,len);
+ new_->next = NULL;
+ strncpy(new_->name,name,strlen(name)+1);
if (npc_src_first==NULL)
- npc_src_first = new;
+ npc_src_first = new_;
if (npc_src_last)
- npc_src_last->next = new;
+ npc_src_last->next = new_;
- npc_src_last=new;
+ npc_src_last=new_;
}
/*==========================================
* 読み込むnpcファイルの削除
@@ -1411,7 +1411,7 @@ void npc_delsrcfile(char *name)
*lp=p->next;
if ( npc_src_last==p )
npc_src_last=pp;
- free(p);
+ aFree(p);
break;
}
}
@@ -1525,7 +1525,7 @@ static int npc_parse_shop(char *w1,char *w2,char *w3,char *w4)
p=strchr(p,',');
}
if (pos == 0) {
- free(nd);
+ aFree(nd);
return 1;
}
nd->u.shop_item[pos++].nameid = 0;
@@ -1545,7 +1545,7 @@ static int npc_parse_shop(char *w1,char *w2,char *w3,char *w4)
nd->opt1 = 0;
nd->opt2 = 0;
nd->opt3 = 0;
-
+
nd = (struct npc_data *)aRealloc(nd,
sizeof(struct npc_data) + sizeof(nd->u.shop_item[0]) * pos);
@@ -1572,14 +1572,14 @@ int npc_convertlabel_db(void *key,void *data,va_list ap)
struct npc_label_list *lst;
int num;
char *p=strchr(lname,':');
-
+
nullpo_retr(0, ap);
nullpo_retr(0, nd=va_arg(ap,struct npc_data *));
lst=nd->u.scr.label_list;
num=nd->u.scr.label_list_num;
if(!lst){
- lst=(struct npc_label_list *)aCalloc(1,sizeof(struct npc_label_list));
+ lst=(struct npc_label_list *)aCallocA(1,sizeof(struct npc_label_list));
num=0;
}else
lst=(struct npc_label_list *)aRealloc(lst,sizeof(struct npc_label_list)*(num+1));
@@ -1598,7 +1598,7 @@ int npc_convertlabel_db(void *key,void *data,va_list ap)
*/
static int npc_parse_script(char *w1,char *w2,char *w3,char *w4,char *first_line,FILE *fp,int *lines)
{
- int x,y,dir=0,m,xs=0,ys=0,class=0; // [Valaris] thanks to fov
+ int x,y,dir=0,m,xs=0,ys=0,class_=0; // [Valaris] thanks to fov
char mapname[24];
unsigned char *srcbuf=NULL,*script;
int srcsize=65536;
@@ -1627,7 +1627,7 @@ static int npc_parse_script(char *w1,char *w2,char *w3,char *w4,char *first_line
if(strcmp(w2,"script")==0){
// スクリプトの解析
- srcbuf=(char *)aCalloc(srcsize,sizeof(char));
+ srcbuf=(char *)aCallocA(srcsize,sizeof(char));
if (strchr(first_line,'{')) {
strcpy(srcbuf,strchr(first_line,'{'));
startline=*lines;
@@ -1657,13 +1657,13 @@ static int npc_parse_script(char *w1,char *w2,char *w3,char *w4,char *first_line
script=parse_script(srcbuf,startline);
if (script==NULL) {
// script parse error?
- free(srcbuf);
+ aFree(srcbuf);
return 1;
}
}else{
// duplicateする
-
+
char srcname[128];
struct npc_data *nd2;
if( sscanf(w2,"duplicate(%[^)])",srcname)!=1 ){
@@ -1678,22 +1678,22 @@ static int npc_parse_script(char *w1,char *w2,char *w3,char *w4,char *first_line
label_dup=nd2->u.scr.label_list;
label_dupnum=nd2->u.scr.label_list_num;
src_id=nd2->bl.id;
-
+
}// end of スクリプト解析
nd=(struct npc_data *)aCalloc(1,sizeof(struct npc_data));
if(m==-1){
// スクリプトコピー用のダミーNPC
-
- }else if( sscanf(w4,"%d,%d,%d",&class,&xs,&ys)==3) {
+
+ }else if( sscanf(w4,"%d,%d,%d",&class_,&xs,&ys)==3) {
// 接触型NPC
int i,j;
-
+
if (xs>=0)xs=xs*2+1;
if (ys>=0)ys=ys*2+1;
-
- if (class>=0) {
+
+ if (class_>=0) {
for(i=0;i<ys;i++) {
for(j=0;j<xs;j++) {
@@ -1703,16 +1703,16 @@ static int npc_parse_script(char *w1,char *w2,char *w3,char *w4,char *first_line
}
}
}
-
+
nd->u.scr.xs=xs;
nd->u.scr.ys=ys;
} else { // クリック型NPC
- class=atoi(w4);
+ class_=atoi(w4);
nd->u.scr.xs=0;
nd->u.scr.ys=0;
}
-
- if (class<0 && m>=0) { // イベント型NPC
+
+ if (class_<0 && m>=0) { // イベント型NPC
evflag=1;
}
@@ -1735,7 +1735,7 @@ static int npc_parse_script(char *w1,char *w2,char *w3,char *w4,char *first_line
nd->bl.id=npc_get_new_npc_id();
nd->dir = dir;
nd->flag=0;
- nd->class_=class;
+ nd->class_=class_;
nd->speed=200;
nd->u.scr.script=script;
nd->u.scr.src_id=src_id;
@@ -1766,21 +1766,21 @@ static int npc_parse_script(char *w1,char *w2,char *w3,char *w4,char *first_line
//-----------------------------------------
- // ラベルデータの準備
+ // ラベルデータの準備
if(srcbuf){
// script本体がある場合の処理
-
+
// ラベルデータのコンバート
label_db=script_get_label_db();
strdb_foreach(label_db,npc_convertlabel_db,nd);
-
+
// もう使わないのでバッファ解放
- free(srcbuf);
+ aFree(srcbuf);
}else{
// duplicate
-// nd->u.scr.label_list=aMalloc(sizeof(struct npc_label_list)*label_dupnum);
+// nd->u.scr.label_list=aMallocA(sizeof(struct npc_label_list)*label_dupnum);
// memcpy(nd->u.scr.label_list,label_dup,sizeof(struct npc_label_list)*label_dupnum);
nd->u.scr.label_list=label_dup; // ラベルデータ共有
@@ -1792,13 +1792,13 @@ static int npc_parse_script(char *w1,char *w2,char *w3,char *w4,char *first_line
for(i=0;i<nd->u.scr.label_list_num;i++){
char *lname=nd->u.scr.label_list[i].name;
int pos=nd->u.scr.label_list[i].pos;
-
+
if ((lname[0]=='O' || lname[0]=='o')&&(lname[1]=='N' || lname[1]=='n')) {
struct event_data *ev;
char *buf;
// エクスポートされる
ev=(struct event_data *)aCalloc(1,sizeof(struct event_data));
- buf=(char *)aCalloc(50,sizeof(char));
+ buf=(char *)aCallocA(50,sizeof(char));
if (strlen(lname)>24) {
printf("npc_parse_script: label name error !\n");
exit(1);
@@ -1810,7 +1810,7 @@ static int npc_parse_script(char *w1,char *w2,char *w3,char *w4,char *first_line
}
}
}
-
+
//-----------------------------------------
// ラベルデータからタイマーイベント取り込み
for(i=0;i<nd->u.scr.label_list_num;i++){
@@ -1822,7 +1822,7 @@ static int npc_parse_script(char *w1,char *w2,char *w3,char *w4,char *first_line
struct npc_timerevent_list *te=nd->u.scr.timer_event;
int j,k=nd->u.scr.timeramount;
if(te==NULL)
- te=(struct npc_timerevent_list *)aCalloc(1,sizeof(struct npc_timerevent_list));
+ te=(struct npc_timerevent_list *)aCallocA(1,sizeof(struct npc_timerevent_list));
else
te=(struct npc_timerevent_list *)aRealloc( te, sizeof(struct npc_timerevent_list) * (k+1) );
for(j=0;j<k;j++){
@@ -1840,7 +1840,7 @@ static int npc_parse_script(char *w1,char *w2,char *w3,char *w4,char *first_line
nd->u.scr.nexttimer=-1;
nd->u.scr.timerid=-1;
-
+
return 0;
}
@@ -1859,7 +1859,7 @@ static int npc_parse_function(char *w1,char *w2,char *w3,char *w4,char *first_li
char *p;
// スクリプトの解析
- srcbuf=(char *)aCalloc(srcsize,sizeof(char));
+ srcbuf=(char *)aCallocA(srcsize,sizeof(char));
if (strchr(first_line,'{')) {
strcpy(srcbuf,strchr(first_line,'{'));
startline=*lines;
@@ -1889,11 +1889,11 @@ static int npc_parse_function(char *w1,char *w2,char *w3,char *w4,char *first_li
script=parse_script(srcbuf,startline);
if (script==NULL) {
// script parse error?
- free(srcbuf);
+ aFree(srcbuf);
return 1;
}
- p=(char *)aCalloc(50,sizeof(char));
+ p=(char *)aCallocA(50,sizeof(char));
strncpy(p,w3,50);
strdb_insert(script_get_userfunc_db(),p,script);
@@ -1901,10 +1901,10 @@ static int npc_parse_function(char *w1,char *w2,char *w3,char *w4,char *first_li
// label_db=script_get_label_db();
// もう使わないのでバッファ解放
- free(srcbuf);
-
+ aFree(srcbuf);
+
// printf("function %s => %p\n",p,script);
-
+
return 0;
}
@@ -1915,7 +1915,7 @@ static int npc_parse_function(char *w1,char *w2,char *w3,char *w4,char *first_li
*/
int npc_parse_mob(char *w1,char *w2,char *w3,char *w4)
{
- int m,x,y,xs,ys,class,num,delay1,delay2,level;
+ int m,x,y,xs,ys,class_,num,delay1,delay2,level;
int i;
char mapname[24];
char mobname[24];
@@ -1926,7 +1926,7 @@ int npc_parse_mob(char *w1,char *w2,char *w3,char *w4)
delay1=delay2=0;
// 引数の個数チェック
if (sscanf(w1,"%[^,],%d,%d,%d,%d",mapname,&x,&y,&xs,&ys) < 3 ||
- sscanf(w4,"%d,%d,%d,%d,%s",&class,&num,&delay1,&delay2,eventname) < 2 ) {
+ sscanf(w4,"%d,%d,%d,%d,%s",&class_,&num,&delay1,&delay2,eventname) < 2 ) {
printf("bad monster line : %s\n",w3);
return 1;
}
@@ -1941,13 +1941,13 @@ int npc_parse_mob(char *w1,char *w2,char *w3,char *w4)
for(i=0;i<num;i++) {
md=(struct mob_data *)aCalloc(1,sizeof(struct mob_data));
- if(class>4000) { // large/tiny mobs [Valaris]
+ if(class_>4000) { // large/tiny mobs [Valaris]
md->size=2;
- class-=4000;
+ class_-=4000;
}
- else if(class>2000) {
+ else if(class_>2000) {
md->size=1;
- class-=2000;
+ class_-=2000;
}
md->bl.prev=NULL;
@@ -1958,9 +1958,9 @@ int npc_parse_mob(char *w1,char *w2,char *w3,char *w4)
if(sscanf(w3,"%[^,],%d",mobname,&level) > 1) {
if(strcmp(mobname,"--en--")==0)
- memcpy(md->name,mob_db[class].name,24);
+ memcpy(md->name,mob_db[class_].name,24);
else if(strcmp(mobname,"--ja--")==0)
- memcpy(md->name,mob_db[class].jname,24);
+ memcpy(md->name,mob_db[class_].jname,24);
md->level=level;
}
@@ -1968,7 +1968,7 @@ int npc_parse_mob(char *w1,char *w2,char *w3,char *w4)
memcpy(md->name,w3,24);
md->n = i;
- md->base_class = md->class_ = class;
+ md->base_class = md->class_ = class_;
md->bl.id=npc_get_new_npc_id();
md->m =m;
md->x0=x;
@@ -1982,9 +1982,9 @@ int npc_parse_mob(char *w1,char *w2,char *w3,char *w4)
md->timer = -1;
md->target_id=0;
md->attacked_id=0;
- md->speed=mob_db[class].speed;
+ md->speed=mob_db[class_].speed;
- if (mob_db[class].mode&0x02)
+ if (mob_db[class_].mode&0x02)
md->lootitem=(struct item *)aCalloc(LOOTITEM_SIZE,sizeof(struct item));
else
md->lootitem=NULL;
@@ -2122,19 +2122,19 @@ static int npc_parse_mapflag(char *w1,char *w2,char *w3,char *w4)
}
else if (strcmpi(w3,"noicewall")==0) { // noicewall [Valaris]
map[m].flag.noicewall=1;
- }
+ }
else if (strcmpi(w3,"snow")==0) { // snow [Valaris]
map[m].flag.snow=1;
- }
+ }
else if (strcmpi(w3,"fog")==0) { // fog [Valaris]
map[m].flag.fog=1;
- }
+ }
else if (strcmpi(w3,"sakura")==0) { // sakura [Valaris]
map[m].flag.sakura=1;
- }
+ }
else if (strcmpi(w3,"leaves")==0) { // leaves [Valaris]
map[m].flag.leaves=1;
- }
+ }
else if (strcmpi(w3,"rain")==0) { // rain [Valaris]
map[m].flag.rain=1;
}
@@ -2144,7 +2144,7 @@ static int npc_parse_mapflag(char *w1,char *w2,char *w3,char *w4)
else if (strcmpi(w3,"nogo")==0) { // celest
map[m].flag.nogo=1;
}
-
+
return 0;
}
@@ -2169,12 +2169,12 @@ static int npc_read_indoors(void)
if ((m = map_mapname2mapid(map_name)) >= 0)
map[m].flag.indoors=1;
}
-
+
p=strchr(p,10);
if(!p) break;
p++;
}
- free(buf);
+ aFree(buf);
sprintf(tmp_output,"Done reading '"CL_WHITE"%s"CL_RESET"'.\n","data\\indoorrswtable.txt");
ShowStatus(tmp_output);
@@ -2183,9 +2183,9 @@ static int npc_read_indoors(void)
static int ev_db_final(void *key,void *data,va_list ap)
{
- free(data);
+ aFree(data);
if(strstr(key,"::")!=NULL)
- free(key);
+ aFree(key);
return 0;
}
static int npcname_db_final(void *key,void *data,va_list ap)
@@ -2214,49 +2214,49 @@ int do_final_npc(void)
if((bl=map_id2bl(i))){
if(bl->type == BL_NPC && (nd = (struct npc_data *)bl)){
if(nd->chat_id && (cd=(struct chat_data*)map_id2bl(nd->chat_id))){
- free(cd);
+ aFree(cd);
cd = NULL;
}
if(nd->bl.subtype == SCRIPT){
if(nd->u.scr.timer_event)
- free(nd->u.scr.timer_event);
+ aFree(nd->u.scr.timer_event);
if(nd->u.scr.src_id==0){
if(nd->u.scr.script){
- free(nd->u.scr.script);
+ aFree(nd->u.scr.script);
nd->u.scr.script=NULL;
}
if(nd->u.scr.label_list){
- free(nd->u.scr.label_list);
+ aFree(nd->u.scr.label_list);
nd->u.scr.label_list = NULL;
}
}
}
- free(nd);
+ aFree(nd);
nd = NULL;
}else if(bl->type == BL_MOB && (md = (struct mob_data *)bl)){
if(md->lootitem){
- free(md->lootitem);
+ aFree(md->lootitem);
md->lootitem = NULL;
}
- free(md);
+ aFree(md);
md = NULL;
}else if(bl->type == BL_PET && (pd = (struct pet_data *)bl)){
- free(pd);
+ aFree(pd);
pd = NULL;
}
}
}
-
+
return 0;
}
-void ev_release(struct dbn *db, int which)
+void ev_release(struct dbn *db, int which)
{
if (which & 0x1)
- free(db->key);
+ aFree(db->key);
if (which & 0x2)
- free(db->data);
+ aFree(db->data);
}
/*==========================================
@@ -2281,12 +2281,12 @@ int do_init_npc(void)
npcname_db=strdb_init(24);
ev_db->release = ev_release;
-
+
memset(&ev_tm_b,-1,sizeof(ev_tm_b));
for(nsl=npc_src_first;nsl;nsl=nsl->next) {
/*if(nsl->prev){ // [Shinomori]
- free(nsl->prev);
+ aFree(nsl->prev);
nsl->prev = NULL;
}*/
fp=fopen(nsl->name,"r");