From 25ca739c12a1e73b7095b81cac803eba32561428 Mon Sep 17 00:00:00 2001 From: ultramage Date: Sun, 25 Feb 2007 03:23:45 +0000 Subject: Corrected some typos and small details git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9912 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/script.c | 47 ++++++++++++++++++++++++----------------------- src/map/status.c | 2 +- 2 files changed, 25 insertions(+), 24 deletions(-) (limited to 'src/map') diff --git a/src/map/script.c b/src/map/script.c index bc2b175f8..3edea1b80 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -5075,41 +5075,42 @@ BUILDIN_FUNC(copyarray) } return 0; } + /*========================================== - * 配列変数のサイズ所得 - *------------------------------------------ - */ -static int getarraysize(struct script_state *st,int num,int postfix,struct linkdb_node** ref) + * Returns the size of the specified array + *------------------------------------------*/ +static int getarraysize(struct script_state* st, int num, int postfix, struct linkdb_node** ref) { - int i=(num>>24),c=(i==0? -1:i); // Moded to -1 because even if the first element is 0, it will still report as 1 [Lance] - if(postfix == '$'){ - for(;i<128;i++){ - void *v=get_val2(st,(num & 0x00FFFFFF)+(i<<24),ref); - if(*((char*)v)) c=i; + //TODO: unreadable; remove +-1 trick, remove weird for loop, remove typecast + int i = (num>>24), c = (i==0?-1:i); // Moded to -1 because even if the first element is 0, it will still report as 1 [Lance] + + if(postfix == '$') { + for(; i < 128; i++) { + void* v = get_val2(st, (num & 0x00FFFFFF) + (i<<24), ref); + if(*((char*)v)) c = i; } - }else{ - for(;i<128;i++){ - void *v=get_val2(st,(num & 0x00FFFFFF)+(i<<24),ref); - if((int)v) c=i; + } else { + for(; i < 128; i++) { + void* v = get_val2(st, (num & 0x00FFFFFF) + (i<<24), ref); + if((int)v) c = i; } } - return c+1; + return c + 1; } BUILDIN_FUNC(getarraysize) { - int num=st->stack->stack_data[st->start+2].u.num; - char *name=str_buf+str_data[num&0x00ffffff].str; - char prefix=*name; - char postfix=name[strlen(name)-1]; + int num = st->stack->stack_data[st->start+2].u.num; + char* name = str_buf + str_data[num&0x00ffffff].str; + char prefix = name[0], postfix = name[strlen(name)-1]; - if( prefix!='$' && prefix!='@' && prefix!='.' ){ - ShowWarning("buildin_copyarray: illegal scope !\n"); - push_val(st->stack,C_INT,0); + if( prefix != '$' && prefix != '@' && prefix != '.' ) { + ShowWarning("buildin_getarraysize: illegal scope !\n"); + push_val(st->stack, C_INT, 0); return 1; } - push_val(st->stack,C_INT,getarraysize(st,num,postfix,st->stack->stack_data[st->start+2].ref)); + push_val(st->stack, C_INT, getarraysize(st, num, postfix, st->stack->stack_data[st->start+2].ref)); return 0; } /*========================================== @@ -6146,7 +6147,7 @@ BUILDIN_FUNC(strcharinfo) num=conv_num(st,& (st->stack->stack_data[st->start+2])); switch(num){ case 0: - push_str(st->stack,C_CONSTSTR,sd->status.name); + push_str(st->stack,C_STR,aStrdup(sd->status.name)); break; case 1: buf=buildin_getpartyname_sub(sd->status.party_id); diff --git a/src/map/status.c b/src/map/status.c index 48afad54a..28cabc71c 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -3656,7 +3656,7 @@ static unsigned short status_calc_speed(struct block_list *bl, struct status_cha speed += 300; if(sc->data[SC_GATLINGFEVER].timer==-1) - { //% increases (they don't stack, with a few exception) + { //% increases (they don't stack, with a few exceptions) if(sc->data[SC_SPEEDUP1].timer!=-1) speed -= speed * 50/100; else if(sc->data[SC_AVOID].timer!=-1) -- cgit v1.2.3-70-g09d2