diff options
author | shennetsind <ind@henn.et> | 2013-11-19 02:20:07 -0200 |
---|---|---|
committer | shennetsind <ind@henn.et> | 2013-11-19 02:20:07 -0200 |
commit | 242bc9fc39c90364dcf5f1a73a6d759efeef0ffd (patch) | |
tree | 0ac9e1e42c5db47d46f5a2d9e9d665b20fb46f63 /src/map/atcommand.c | |
parent | d076f129c90ac9e3a96659488f702f81def1863a (diff) | |
parent | cb85f27f1ee334982fc3f9dfc1ffe824a1f8905c (diff) | |
download | hercules-242bc9fc39c90364dcf5f1a73a6d759efeef0ffd.tar.gz hercules-242bc9fc39c90364dcf5f1a73a6d759efeef0ffd.tar.bz2 hercules-242bc9fc39c90364dcf5f1a73a6d759efeef0ffd.tar.xz hercules-242bc9fc39c90364dcf5f1a73a6d759efeef0ffd.zip |
Merge branch 'master' of https://github.com/HerculesWS/Hercules
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r-- | src/map/atcommand.c | 91 |
1 files changed, 44 insertions, 47 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index a2bea32a8..3b06140d4 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -164,38 +164,32 @@ ACMD(send) clif->message(fd, msg_txt(i)); return false; } - -#define PARSE_ERROR(error,p) \ -{\ -clif->message(fd, (error));\ -sprintf(atcmd_output, ">%s", (p));\ -clif->message(fd, atcmd_output);\ -} - //define PARSE_ERROR - -#define CHECK_EOS(p) \ -if(*(p) == 0){\ -clif->message(fd, "Unexpected end of string");\ -return false;\ -} - //define CHECK_EOS - -#define SKIP_VALUE(p) \ -{\ -while(*(p) && !ISSPACE(*(p))) ++(p); /* non-space */\ -while(*(p) && ISSPACE(*(p))) ++(p); /* space */\ -} - //define SKIP_VALUE - -#define GET_VALUE(p,num) \ -{\ -if(sscanf((p), "x%lx", &(num)) < 1 && sscanf((p), "%ld ", &(num)) < 1){\ -PARSE_ERROR("Invalid number in:",(p));\ -return false;\ -}\ -} - //define GET_VALUE - + +#define PARSE_ERROR(error,p) do {\ + clif->message(fd, (error));\ + sprintf(atcmd_output, ">%s", (p));\ + clif->message(fd, atcmd_output);\ +} while(0) //define PARSE_ERROR + +#define CHECK_EOS(p) do { \ + if(*(p) == 0){ \ + clif->message(fd, "Unexpected end of string");\ + return false;\ + } \ +} while(0) //define CHECK_EOS + +#define SKIP_VALUE(p) do { \ + while(*(p) && !ISSPACE(*(p))) ++(p); /* non-space */\ + while(*(p) && ISSPACE(*(p))) ++(p); /* space */\ +} while(0) //define SKIP_VALUE + +#define GET_VALUE(p,num) do { \ + if(sscanf((p), "x%lx", &(num)) < 1 && sscanf((p), "%ld ", &(num)) < 1){\ + PARSE_ERROR("Invalid number in:",(p));\ + return false;\ + }\ +} while(0) //define GET_VALUE + if (type > 0 && type < MAX_PACKET_DB) { if(len) @@ -1931,11 +1925,11 @@ ACMD(monster) number = battle_config.atc_spawn_quantity_limit; if (strcmpi(info->command, "monstersmall") == 0) - size = SZ_MEDIUM; // This is just gorgeous [mkbu95] + size = SZ_SMALL; else if (strcmpi(info->command, "monsterbig") == 0) size = SZ_BIG; else - size = SZ_SMALL; + size = SZ_MEDIUM; if (battle_config.etc_log) ShowInfo("%s monster='%s' name='%s' id=%d count=%d (%d,%d)\n", command, monster, name, mob_id, number, sd->bl.x, sd->bl.y); @@ -6255,7 +6249,7 @@ ACMD(summon) return false; } - md = mob->once_spawn_sub(&sd->bl, sd->bl.m, -1, -1, "--ja--", mob_id, "", SZ_SMALL, AI_NONE); + md = mob->once_spawn_sub(&sd->bl, sd->bl.m, -1, -1, "--ja--", mob_id, "", SZ_MEDIUM, AI_NONE); if(!md) return false; @@ -7311,15 +7305,15 @@ ACMD(size) { int size = 0; - size = cap_value(atoi(message),SZ_SMALL,SZ_BIG); + size = cap_value(atoi(message),SZ_MEDIUM,SZ_BIG); if(sd->state.size) { - sd->state.size = SZ_SMALL; + sd->state.size = SZ_MEDIUM; pc->setpos(sd, sd->mapindex, sd->bl.x, sd->bl.y, CLR_TELEPORT); } sd->state.size = size; - if( size == SZ_MEDIUM ) + if( size == SZ_SMALL ) clif->specialeffect(&sd->bl,420,AREA); else if( size == SZ_BIG ) clif->specialeffect(&sd->bl,422,AREA); @@ -7341,12 +7335,12 @@ ACMD(sizeall) for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) ) { if( pl_sd->state.size != size ) { if( pl_sd->state.size ) { - pl_sd->state.size = SZ_SMALL; + pl_sd->state.size = SZ_MEDIUM; pc->setpos(pl_sd, pl_sd->mapindex, pl_sd->bl.x, pl_sd->bl.y, CLR_TELEPORT); } pl_sd->state.size = size; - if( size == SZ_MEDIUM ) + if( size == SZ_SMALL ) clif->specialeffect(&pl_sd->bl,420,AREA); else if( size == SZ_BIG ) clif->specialeffect(&pl_sd->bl,422,AREA); @@ -7377,17 +7371,17 @@ ACMD(sizeguild) return false; } - size = cap_value(size,SZ_SMALL,SZ_BIG); + size = cap_value(size,SZ_MEDIUM,SZ_BIG); for( i = 0; i < g->max_member; i++ ) { if( (pl_sd = g->member[i].sd) && pl_sd->state.size != size ) { if( pl_sd->state.size ) { - pl_sd->state.size = SZ_SMALL; + pl_sd->state.size = SZ_MEDIUM; pc->setpos(pl_sd, pl_sd->mapindex, pl_sd->bl.x, pl_sd->bl.y, CLR_TELEPORT); } pl_sd->state.size = size; - if( size == SZ_MEDIUM ) + if( size == SZ_SMALL ) clif->specialeffect(&pl_sd->bl,420,AREA); else if( size == SZ_BIG ) clif->specialeffect(&pl_sd->bl,422,AREA); @@ -8585,10 +8579,11 @@ ACMD(unloadnpcfile) { return true; } ACMD(cart) { -#define MC_CART_MDFY(x,idx) \ -sd->status.skill[idx].id = x?MC_PUSHCART:0; \ -sd->status.skill[idx].lv = x?1:0; \ -sd->status.skill[idx].flag = x?1:0; +#define MC_CART_MDFY(x,idx) do { \ + sd->status.skill[idx].id = (x)?MC_PUSHCART:0; \ + sd->status.skill[idx].lv = (x)?1:0; \ + sd->status.skill[idx].flag = (x)?1:0; \ +} while(0) int val = atoi(message); bool need_skill = pc->checkskill(sd, MC_PUSHCART) ? false : true; @@ -9616,6 +9611,8 @@ void atcommand_basecommands(void) { return; } +#undef ACMD_DEF +#undef ACMD_DEF2 bool atcommand_add(char *name,AtCommandFunc func, bool replace) { AtCommandInfo* cmd; |