소스 검색

- Reverted declaration of run_script to normal since it appears there's no longer any memory leaks related to it.
- Returned the MAX_PC_BONUS value to 10.


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@8928 54d463be-8e91-2dee-dedb-b68131a5f0ec

skotlex 18 년 전
부모
커밋
7c8ec5366e
5개의 변경된 파일14개의 추가작업 그리고 20개의 파일을 삭제
  1. 2 2
      src/map/atcommand.c
  2. 5 4
      src/map/clif.c
  3. 1 1
      src/map/map.h
  4. 5 11
      src/map/script.c
  5. 1 2
      src/map/script.h

+ 2 - 2
src/map/atcommand.c

@@ -808,7 +808,7 @@ is_atcommand(const int fd, struct map_session_data* sd, const char* message, int
 		return AtCommand_None;
 
 	if (!gmlvl) gmlvl = pc_isGM(sd);
-	type = atcommand(sd,  gmlvl, str, &info);
+	type = atcommand(sd, gmlvl, str, &info);
 	if (type != AtCommand_None) {
 		char command[100];
 		const char* p = str;
@@ -7480,7 +7480,7 @@ atcommand_storeall(const int fd, struct map_session_data* sd,
 			return 0;
 		case 1: //Failure
 			clif_displaymessage(fd, "You can't open the storage currently.");
-			return 1;
+			return -1;
 		}
 	}
 	for (i = 0; i < MAX_INVENTORY; i++) {

+ 5 - 4
src/map/clif.c

@@ -8658,10 +8658,6 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data *sd) { // S 008c <
 		sd->cantalk_tick = gettick() + battle_config.min_chat_delay;
 	}
 
-	memcpy(WFIFOP(fd,0), RFIFOP(fd,0), RFIFOW(fd,2));
-	WFIFOW(fd,0) = 0x8e;
-	WFIFOSET(fd, WFIFOW(fd,2));
-
 	if (RFIFOW(fd,2)+4 < 128)
 		buf = buf2; //Use a static buffer.
 	else
@@ -8676,6 +8672,11 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data *sd) { // S 008c <
 
 	if(buf != buf2) aFree(buf);
 
+	// send back message to the speaker
+	memcpy(WFIFOP(fd,0), RFIFOP(fd,0), RFIFOW(fd,2));
+	WFIFOW(fd,0) = 0x8e;
+	WFIFOSET(fd, WFIFOW(fd,2));
+
 #ifdef PCRE_SUPPORT
 	map_foreachinrange(npc_chat_sub, &sd->bl, AREA_SIZE, BL_NPC, message, strlen(message), &sd->bl);
 	map_foreachinrange(mob_chat_sub, &sd->bl, AREA_SIZE, BL_MOB, message, strlen(message), &sd->bl);

+ 1 - 1
src/map/map.h

@@ -55,7 +55,7 @@
 #define MAX_VENDING 12
 #define MOBID_EMPERIUM 1288
 
-#define MAX_PC_BONUS 15
+#define MAX_PC_BONUS 10
 //Designed for search functions, species max number of matches to display.
 #define MAX_SEARCH 5
 #define MAX_DUEL 1024

+ 5 - 11
src/map/script.c

@@ -2511,9 +2511,7 @@ int run_func(struct script_state *st)
  */
 void run_script_main(struct script_state *st);
 
-//FIXME: Temporary replacement to locate the leak source.
-//void run_script(struct script_code *rootscript,int pos,int rid,int oid)
-void run_script_sub(struct script_code *rootscript,int pos,int rid,int oid, char* file, int lineno)
+void run_script(struct script_code *rootscript,int pos,int rid,int oid)
 {
 	struct script_state *st;
 	struct map_session_data *sd=NULL;
@@ -2526,18 +2524,14 @@ void run_script_sub(struct script_code *rootscript,int pos,int rid,int oid, char
 		//Resume script.
 		st = sd->st;
 	} else {
-//		st = aCalloc(sizeof(struct script_state), 1);
-		st = _mcalloc(sizeof(struct script_state), 1, file, lineno, __func__);
+		st = aCalloc(sizeof(struct script_state), 1);
 		// the script is different, make new script_state and stack
-//		st->stack = aMalloc (sizeof(struct script_stack));
-		st->stack = _mmalloc(sizeof(struct script_stack), file, lineno, __func__);
+		st->stack = aMalloc (sizeof(struct script_stack));
 		st->stack->sp=0;
 		st->stack->sp_max=64;
-//		st->stack->stack_data = (struct script_data *)aCalloc(st->stack->sp_max,sizeof(st->stack->stack_data[0]));
-		st->stack->stack_data = (struct script_data *)_mcalloc(st->stack->sp_max,sizeof(st->stack->stack_data[0]), file, lineno, __func__);
+		st->stack->stack_data = (struct script_data *)aCalloc(st->stack->sp_max,sizeof(st->stack->stack_data[0]));
 		st->stack->defsp = st->stack->sp;
-//		st->stack->var_function = aCalloc(1, sizeof(struct linkdb_node*));
-		st->stack->var_function = _mcalloc(1, sizeof(struct linkdb_node*), file, lineno, __func__);
+		st->stack->var_function = aCalloc(1, sizeof(struct linkdb_node*));
 		st->state  = RUN;
 		st->script = rootscript;
 	}

+ 1 - 2
src/map/script.h

@@ -63,8 +63,7 @@ struct script_state {
 
 struct script_code* parse_script(unsigned char *,const char*,int);
 void run_script_sub(struct script_code *rootscript,int pos,int rid,int oid, char* file, int lineno);
-//void run_script(struct script_code*,int,int,int);
-#define run_script(sc,pos,rid,oid) run_script_sub(sc,pos,rid,oid,__FILE__,__LINE__)
+void run_script(struct script_code*,int,int,int);
 
 int set_var(struct map_session_data *sd, char *name, void *val);
 int conv_num(struct script_state *st,struct script_data *data);