浏览代码

Compiler fixes and scripting timer event fixes

git-svn-id: https://svn.code.sf.net/p/rathena/svn/athena@228 54d463be-8e91-2dee-dedb-b68131a5f0ec
amber 20 年之前
父节点
当前提交
13484f75cb
共有 5 个文件被更改,包括 66 次插入41 次删除
  1. 2 0
      Changelog.txt
  2. 33 26
      src/map/log.c
  3. 13 0
      src/map/npc.c
  4. 3 3
      src/map/pc.c
  5. 15 12
      src/map/skill.c

+ 2 - 0
Changelog.txt

@@ -1,5 +1,7 @@
 Date	Added
 Date	Added
 11/16
 11/16
+	* Fix for compiling against gcc 2.95 [MouseJstr]
+	* Added day of week events (OnSat2000) into scripting engine [MouseJstr]
 	* Temporarily Disabled GM Command Logs; Weren't working Properly >_<! [Codemaster]
 	* Temporarily Disabled GM Command Logs; Weren't working Properly >_<! [Codemaster]
 	* Fixed a typo in ../db/Changelog.txt [Nana]
 	* Fixed a typo in ../db/Changelog.txt [Nana]
 	* Added -funroll-loops argument to makefile to further increase performance [Shinigami]
 	* Added -funroll-loops argument to makefile to further increase performance [Shinigami]

+ 33 - 26
src/map/log.c

@@ -11,10 +11,11 @@ struct Log_Config log_config;
 
 
 int log_branch(struct map_session_data *sd)
 int log_branch(struct map_session_data *sd)
 {
 {
+	FILE *logfp;
+
 	if(log_config.enable_logs <= 0)
 	if(log_config.enable_logs <= 0)
 		return 0;
 		return 0;
 	nullpo_retr(0, sd);
 	nullpo_retr(0, sd);
-	FILE *logfp;
 	#ifndef TXT_ONLY
 	#ifndef TXT_ONLY
 	if(log_config.sql_logs > 0)
 	if(log_config.sql_logs > 0)
 	{
 	{
@@ -24,9 +25,9 @@ int log_branch(struct map_session_data *sd)
 	} else {
 	} else {
 	#endif
 	#endif
 		if((logfp=fopen(log_config.log_drop,"a+")) != NULL) {
 		if((logfp=fopen(log_config.log_drop,"a+")) != NULL) {
+			char timestring[255];
 			time_t curtime;
 			time_t curtime;
 			time(&curtime);
 			time(&curtime);
-			char timestring[255];
 			strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
 			strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
 			fprintf(logfp,"%s - %s[%d:%d]\t%s%s", timestring, sd->status.name, sd->status.account_id, sd->status.char_id, sd->mapname, RETCODE);
 			fprintf(logfp,"%s - %s[%d:%d]\t%s%s", timestring, sd->status.name, sd->status.account_id, sd->status.char_id, sd->mapname, RETCODE);
 			fclose(logfp);
 			fclose(logfp);
@@ -39,10 +40,11 @@ int log_branch(struct map_session_data *sd)
 
 
 int log_drop(struct map_session_data *sd, int monster_id, int *log_drop)
 int log_drop(struct map_session_data *sd, int monster_id, int *log_drop)
 {
 {
+	FILE *logfp;
+
 	if(log_config.enable_logs <= 0)
 	if(log_config.enable_logs <= 0)
 		return 0;
 		return 0;
 	nullpo_retr(0, sd);
 	nullpo_retr(0, sd);
-	FILE *logfp;
 	#ifndef TXT_ONLY
 	#ifndef TXT_ONLY
 	if(log_config.sql_logs > 0)
 	if(log_config.sql_logs > 0)
 	{
 	{
@@ -52,9 +54,10 @@ int log_drop(struct map_session_data *sd, int monster_id, int *log_drop)
 	} else {
 	} else {
 	#endif
 	#endif
 		if((logfp=fopen(log_config.log_drop,"a+")) != NULL) {
 		if((logfp=fopen(log_config.log_drop,"a+")) != NULL) {
+			char timestring[255];
+
 			time_t curtime;
 			time_t curtime;
 			time(&curtime);
 			time(&curtime);
-			char timestring[255];
 			strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
 			strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
 			fprintf(logfp,"%s - %s[%d:%d]\t%d\t%d,%d,%d,%d,%d,%d,%d,%d%s", timestring, sd->status.name, sd->status.account_id, sd->status.char_id, monster_id, log_drop[0], log_drop[1], log_drop[2], log_drop[3], log_drop[4], log_drop[5], log_drop[6], log_drop[7], RETCODE);
 			fprintf(logfp,"%s - %s[%d:%d]\t%d\t%d,%d,%d,%d,%d,%d,%d,%d%s", timestring, sd->status.name, sd->status.account_id, sd->status.char_id, monster_id, log_drop[0], log_drop[1], log_drop[2], log_drop[3], log_drop[4], log_drop[5], log_drop[6], log_drop[7], RETCODE);
 			fclose(logfp);
 			fclose(logfp);
@@ -67,10 +70,11 @@ int log_drop(struct map_session_data *sd, int monster_id, int *log_drop)
 
 
 int log_mvpdrop(struct map_session_data *sd, int monster_id, int *log_mvp)
 int log_mvpdrop(struct map_session_data *sd, int monster_id, int *log_mvp)
 {
 {
+	FILE *logfp;
+
 	if(log_config.enable_logs <= 0)
 	if(log_config.enable_logs <= 0)
 		return 0;
 		return 0;
 	nullpo_retr(0, sd);
 	nullpo_retr(0, sd);
-	FILE *logfp;
 	#ifndef TXT_ONLY
 	#ifndef TXT_ONLY
 	if(log_config.sql_logs > 0)
 	if(log_config.sql_logs > 0)
 	{
 	{
@@ -80,9 +84,9 @@ int log_mvpdrop(struct map_session_data *sd, int monster_id, int *log_mvp)
 	} else {
 	} else {
 	#endif
 	#endif
 		if((logfp=fopen(log_config.log_mvpdrop,"a+")) != NULL) {
 		if((logfp=fopen(log_config.log_mvpdrop,"a+")) != NULL) {
+			char timestring[255];
 			time_t curtime;
 			time_t curtime;
 			time(&curtime);
 			time(&curtime);
-			char timestring[255];
 			strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
 			strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
 			fprintf(logfp,"%s - %s[%d:%d]\t%d\t%d,%d%s", timestring, sd->status.name, sd->status.account_id, sd->status.char_id, monster_id, log_mvp[0], log_mvp[1], RETCODE);
 			fprintf(logfp,"%s - %s[%d:%d]\t%d\t%d,%d%s", timestring, sd->status.name, sd->status.account_id, sd->status.char_id, monster_id, log_mvp[0], log_mvp[1], RETCODE);
 			fclose(logfp);
 			fclose(logfp);
@@ -95,10 +99,10 @@ int log_mvpdrop(struct map_session_data *sd, int monster_id, int *log_mvp)
 
 
 int log_present(struct map_session_data *sd, int source_type, int nameid)
 int log_present(struct map_session_data *sd, int source_type, int nameid)
 {
 {
+	FILE *logfp;
 	if(log_config.enable_logs <= 0)
 	if(log_config.enable_logs <= 0)
 		return 0;
 		return 0;
 	nullpo_retr(0, sd);
 	nullpo_retr(0, sd);
-	FILE *logfp;
 	#ifndef TXT_ONLY
 	#ifndef TXT_ONLY
 	if(log_config.sql_logs > 0)
 	if(log_config.sql_logs > 0)
 	{
 	{
@@ -108,9 +112,9 @@ int log_present(struct map_session_data *sd, int source_type, int nameid)
 	} else {
 	} else {
 	#endif
 	#endif
 		if((logfp=fopen(log_config.log_present,"a+")) != NULL) {
 		if((logfp=fopen(log_config.log_present,"a+")) != NULL) {
+			char timestring[255];
 			time_t curtime;
 			time_t curtime;
 			time(&curtime);
 			time(&curtime);
-			char timestring[255];
 			strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
 			strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
 			fprintf(logfp,"%s - %s[%d:%d]\t%d\t%d%s", timestring, sd->status.name, sd->status.account_id, sd->status.char_id, source_type, nameid, RETCODE);
 			fprintf(logfp,"%s - %s[%d:%d]\t%d\t%d%s", timestring, sd->status.name, sd->status.account_id, sd->status.char_id, source_type, nameid, RETCODE);
 			fclose(logfp);
 			fclose(logfp);
@@ -123,10 +127,10 @@ int log_present(struct map_session_data *sd, int source_type, int nameid)
 
 
 int log_produce(struct map_session_data *sd, int nameid, int slot1, int slot2, int slot3, int success)
 int log_produce(struct map_session_data *sd, int nameid, int slot1, int slot2, int slot3, int success)
 {
 {
+	FILE *logfp;
 	if(log_config.enable_logs <= 0)
 	if(log_config.enable_logs <= 0)
 		return 0;
 		return 0;
 	nullpo_retr(0, sd);
 	nullpo_retr(0, sd);
-	FILE *logfp;
 	#ifndef TXT_ONLY
 	#ifndef TXT_ONLY
 	if(log_config.sql_logs > 0)
 	if(log_config.sql_logs > 0)
 	{
 	{
@@ -136,9 +140,9 @@ int log_produce(struct map_session_data *sd, int nameid, int slot1, int slot2, i
 	} else {
 	} else {
 	#endif
 	#endif
 		if((logfp=fopen(log_config.log_produce,"a+")) != NULL) {
 		if((logfp=fopen(log_config.log_produce,"a+")) != NULL) {
+			char timestring[255];
 			time_t curtime;
 			time_t curtime;
 			time(&curtime);
 			time(&curtime);
-			char timestring[255];
 			strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
 			strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
 			fprintf(logfp,"%s - %s[%d:%d]\t%d\t%d,%d,%d\t%d%s", timestring, sd->status.name, sd->status.account_id, sd->status.char_id, nameid, slot1, slot2, slot3, success, RETCODE);
 			fprintf(logfp,"%s - %s[%d:%d]\t%d\t%d,%d,%d\t%d%s", timestring, sd->status.name, sd->status.account_id, sd->status.char_id, nameid, slot1, slot2, slot3, success, RETCODE);
 			fclose(logfp);
 			fclose(logfp);
@@ -151,14 +155,15 @@ int log_produce(struct map_session_data *sd, int nameid, int slot1, int slot2, i
 
 
 int log_refine(struct map_session_data *sd, int n, int success)
 int log_refine(struct map_session_data *sd, int n, int success)
 {
 {
-	if(log_config.enable_logs <= 0)
-		return 0;
-	nullpo_retr(0, sd);
 	FILE *logfp;
 	FILE *logfp;
 	int log_card[4];
 	int log_card[4];
 	int item_level;
 	int item_level;
 	int i;
 	int i;
 
 
+	if(log_config.enable_logs <= 0)
+		return 0;
+
+	nullpo_retr(0, sd);
 
 
 	if(success == 0)
 	if(success == 0)
 		item_level = 0;
 		item_level = 0;
@@ -177,9 +182,9 @@ int log_refine(struct map_session_data *sd, int n, int success)
 	} else {
 	} else {
 	#endif
 	#endif
 		if((logfp=fopen(log_config.log_refine,"a+")) != NULL) {
 		if((logfp=fopen(log_config.log_refine,"a+")) != NULL) {
+			char timestring[255];
 			time_t curtime;
 			time_t curtime;
 			time(&curtime);
 			time(&curtime);
-			char timestring[255];
 			strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
 			strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
 			fprintf(logfp,"%s - %s[%d:%d]\t%d,%d\t%d%d%d%d\t%d,%d%s", timestring, sd->status.name, sd->status.account_id, sd->status.char_id, sd->status.inventory[n].nameid, sd->status.inventory[n].refine, log_card[0], log_card[1], log_card[2], log_card[3], success, item_level, RETCODE);
 			fprintf(logfp,"%s - %s[%d:%d]\t%d,%d\t%d%d%d%d\t%d,%d%s", timestring, sd->status.name, sd->status.account_id, sd->status.char_id, sd->status.inventory[n].nameid, sd->status.inventory[n].refine, log_card[0], log_card[1], log_card[2], log_card[3], success, item_level, RETCODE);
 			fclose(logfp);
 			fclose(logfp);
@@ -192,13 +197,14 @@ int log_refine(struct map_session_data *sd, int n, int success)
 
 
 int log_trade(struct map_session_data *sd, struct map_session_data *target_sd, int n,int amount)
 int log_trade(struct map_session_data *sd, struct map_session_data *target_sd, int n,int amount)
 {
 {
+	FILE *logfp;
+	int log_nameid, log_amount, log_refine, log_card[4];
+	int i;
+
 	if(log_config.enable_logs <= 0)
 	if(log_config.enable_logs <= 0)
 		return 0;
 		return 0;
 
 
 	nullpo_retr(0, sd);
 	nullpo_retr(0, sd);
-	FILE *logfp;
-	int log_nameid, log_amount, log_refine, log_card[4];
-	int i;
 
 
 	if(sd->status.inventory[n].nameid==0 || amount <= 0 || sd->status.inventory[n].amount<amount || sd->inventory_data[n] == NULL)
 	if(sd->status.inventory[n].nameid==0 || amount <= 0 || sd->status.inventory[n].amount<amount || sd->inventory_data[n] == NULL)
 		return 1;
 		return 1;
@@ -222,9 +228,9 @@ int log_trade(struct map_session_data *sd, struct map_session_data *target_sd, i
 	} else {
 	} else {
 	#endif
 	#endif
 		if((logfp=fopen(log_config.log_trade,"a+")) != NULL) {
 		if((logfp=fopen(log_config.log_trade,"a+")) != NULL) {
+			char timestring[255];
 			time_t curtime;
 			time_t curtime;
 			time(&curtime);
 			time(&curtime);
-			char timestring[255];
 			strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
 			strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
 			fprintf(logfp,"%s - %s[%d:%d]\t%s[%d:%d]\t%d\t%d\t%d\t%d,%d,%d,%d%s", timestring, sd->status.name, sd->status.account_id, sd->status.char_id, target_sd->status.name, target_sd->status.account_id, target_sd->status.char_id, log_nameid, log_amount, log_refine, log_card[0], log_card[1], log_card[2], log_card[3], RETCODE);
 			fprintf(logfp,"%s - %s[%d:%d]\t%s[%d:%d]\t%d\t%d\t%d\t%d,%d,%d,%d%s", timestring, sd->status.name, sd->status.account_id, sd->status.char_id, target_sd->status.name, target_sd->status.account_id, target_sd->status.char_id, log_nameid, log_amount, log_refine, log_card[0], log_card[1], log_card[2], log_card[3], RETCODE);
 			fclose(logfp);
 			fclose(logfp);
@@ -237,13 +243,14 @@ int log_trade(struct map_session_data *sd, struct map_session_data *target_sd, i
 
 
 int log_vend(struct map_session_data *sd,struct map_session_data *vsd,int n,int amount, int zeny)
 int log_vend(struct map_session_data *sd,struct map_session_data *vsd,int n,int amount, int zeny)
 {
 {
-	if(log_config.enable_logs <= 0)
-		return 0;
 	FILE *logfp;
 	FILE *logfp;
-	nullpo_retr(0, sd);
 	int log_nameid, log_amount, log_refine, log_card[4];
 	int log_nameid, log_amount, log_refine, log_card[4];
 	int i;
 	int i;
 
 
+	if(log_config.enable_logs <= 0)
+		return 0;
+	nullpo_retr(0, sd);
+
 	if(sd->status.inventory[n].nameid==0 || amount <= 0 || sd->status.inventory[n].amount<amount || sd->inventory_data[n] == NULL)
 	if(sd->status.inventory[n].nameid==0 || amount <= 0 || sd->status.inventory[n].amount<amount || sd->inventory_data[n] == NULL)
 		return 1;
 		return 1;
 	if(sd->status.inventory[n].amount< 0)
 	if(sd->status.inventory[n].amount< 0)
@@ -264,9 +271,9 @@ int log_vend(struct map_session_data *sd,struct map_session_data *vsd,int n,int
 	} else {
 	} else {
 	#endif
 	#endif
 		if((logfp=fopen(log_config.log_vend,"a+")) != NULL) {
 		if((logfp=fopen(log_config.log_vend,"a+")) != NULL) {
+			char timestring[255];
 			time_t curtime;
 			time_t curtime;
 			time(&curtime);
 			time(&curtime);
-			char timestring[255];
 			strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
 			strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
 			fprintf(logfp,"%s - %s[%d:%d]\t%s[%d:%d]\t%d\t%d\t%d\t%d,%d,%d,%d\t%d%s", timestring, sd->status.name, sd->status.account_id, sd->status.char_id, vsd->status.name, vsd->status.account_id, vsd->status.char_id, log_nameid, log_amount, log_refine, log_card[0], log_card[1], log_card[2], log_card[3], zeny, RETCODE);
 			fprintf(logfp,"%s - %s[%d:%d]\t%s[%d:%d]\t%d\t%d\t%d\t%d,%d,%d,%d\t%d%s", timestring, sd->status.name, sd->status.account_id, sd->status.char_id, vsd->status.name, vsd->status.account_id, vsd->status.char_id, log_nameid, log_amount, log_refine, log_card[0], log_card[1], log_card[2], log_card[3], zeny, RETCODE);
 			fclose(logfp);
 			fclose(logfp);
@@ -279,10 +286,10 @@ int log_vend(struct map_session_data *sd,struct map_session_data *vsd,int n,int
 
 
 int log_zeny(struct map_session_data *sd, struct map_session_data *target_sd,int amount)
 int log_zeny(struct map_session_data *sd, struct map_session_data *target_sd,int amount)
 {
 {
+	FILE *logfp;
 	if(log_config.enable_logs <= 0)
 	if(log_config.enable_logs <= 0)
 		return 0;
 		return 0;
 	nullpo_retr(0, sd);
 	nullpo_retr(0, sd);
-	FILE *logfp;
 	#ifndef TXT_ONLY
 	#ifndef TXT_ONLY
 	if(log_config.sql_logs > 0)
 	if(log_config.sql_logs > 0)
 	{
 	{
@@ -292,9 +299,9 @@ int log_zeny(struct map_session_data *sd, struct map_session_data *target_sd,int
 	} else {
 	} else {
 	#endif
 	#endif
 		if((logfp=fopen(log_config.log_trade,"a+")) != NULL) {
 		if((logfp=fopen(log_config.log_trade,"a+")) != NULL) {
+			char timestring[255];
 			time_t curtime;
 			time_t curtime;
 			time(&curtime);
 			time(&curtime);
-			char timestring[255];
 			strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
 			strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
 			fprintf(logfp,"%s - %s[%d]\t%s[%d]\t%d\t%s", timestring, sd->status.name, sd->status.account_id, target_sd->status.name, target_sd->status.account_id, sd->deal_zeny, RETCODE);
 			fprintf(logfp,"%s - %s[%d]\t%s[%d]\t%d\t%s", timestring, sd->status.name, sd->status.account_id, target_sd->status.name, target_sd->status.account_id, sd->deal_zeny, RETCODE);
 			fclose(logfp);
 			fclose(logfp);
@@ -307,10 +314,10 @@ int log_zeny(struct map_session_data *sd, struct map_session_data *target_sd,int
 
 
 int log_atcommand(struct map_session_data *sd, const char *message)
 int log_atcommand(struct map_session_data *sd, const char *message)
 {
 {
+	FILE *logfp;
 	if(log_config.enable_logs <= 0)
 	if(log_config.enable_logs <= 0)
 		return 0;
 		return 0;
 	nullpo_retr(0, sd);
 	nullpo_retr(0, sd);
-	FILE *logfp;
 	#ifndef TXT_ONLY
 	#ifndef TXT_ONLY
 	if(log_config.sql_logs > 0)
 	if(log_config.sql_logs > 0)
 	{
 	{
@@ -320,9 +327,9 @@ int log_atcommand(struct map_session_data *sd, const char *message)
 	} else {
 	} else {
 	#endif
 	#endif
 		if((logfp=fopen(log_config.log_gm,"a+")) != NULL) {
 		if((logfp=fopen(log_config.log_gm,"a+")) != NULL) {
+			char timestring[255];
 			time_t curtime;
 			time_t curtime;
 			time(&curtime);
 			time(&curtime);
-			char timestring[255];
 			strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
 			strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
 			fprintf(logfp,"%s - %s[%d]: %s%s",timestring,sd->status.name,sd->status.account_id,message,RETCODE);
 			fprintf(logfp,"%s - %s[%d]: %s%s",timestring,sd->status.name,sd->status.account_id,message,RETCODE);
 			fclose(logfp);
 			fclose(logfp);

+ 13 - 0
src/map/npc.c

@@ -392,16 +392,29 @@ int npc_event_do_clock(int tid,unsigned int tick,int id,int data)
 	time_t timer;
 	time_t timer;
 	struct tm *t;
 	struct tm *t;
 	char buf[64];
 	char buf[64];
+        char *day;
 	int c=0;
 	int c=0;
 	
 	
 	time(&timer);
 	time(&timer);
 	t=localtime(&timer);
 	t=localtime(&timer);
+
+        switch (t->tm_wday) {
+	case 0: day = "Sun"; break;
+	case 1: day = "Mon"; break;
+	case 2: day = "Tue"; break;
+	case 3: day = "Wed"; break;
+	case 4: day = "Thu"; break;
+	case 5: day = "Fri"; break;
+	case 6: day = "Sat"; break;
+	}
 	
 	
 	if (t->tm_min != ev_tm_b.tm_min ) {
 	if (t->tm_min != ev_tm_b.tm_min ) {
 		sprintf(buf,"OnMinute%02d",t->tm_min);
 		sprintf(buf,"OnMinute%02d",t->tm_min);
 		c+=npc_event_doall(buf);
 		c+=npc_event_doall(buf);
 		sprintf(buf,"OnClock%02d%02d",t->tm_hour,t->tm_min);
 		sprintf(buf,"OnClock%02d%02d",t->tm_hour,t->tm_min);
 		c+=npc_event_doall(buf);
 		c+=npc_event_doall(buf);
+		sprintf(buf,"On%s%02d%02d",day,t->tm_hour,t->tm_min);
+		c+=npc_event_doall(buf);
 	}
 	}
 	if (t->tm_hour!= ev_tm_b.tm_hour) {
 	if (t->tm_hour!= ev_tm_b.tm_hour) {
 		sprintf(buf,"OnHour%02d",t->tm_hour);
 		sprintf(buf,"OnHour%02d",t->tm_hour);

+ 3 - 3
src/map/pc.c

@@ -1457,9 +1457,9 @@ int pc_calcstatus(struct map_session_data* sd,int first)
 		if(sd->sc_data[SC_LOUD].timer!=-1 && sd->sc_data[SC_QUAGMIRE].timer == -1)	// ラウドボイス
 		if(sd->sc_data[SC_LOUD].timer!=-1 && sd->sc_data[SC_QUAGMIRE].timer == -1)	// ラウドボイス
 			sd->paramb[0]+= 4;
 			sd->paramb[0]+= 4;
 		if(sd->sc_data[SC_QUAGMIRE].timer!=-1){	// クァグマイア
 		if(sd->sc_data[SC_QUAGMIRE].timer!=-1){	// クァグマイア
-			sd->speed = sd->speed*3/2;
 			int agib = (sd->status.agi+sd->paramb[1]+sd->parame[1])*(sd->sc_data[SC_QUAGMIRE].val1*10)/100;
 			int agib = (sd->status.agi+sd->paramb[1]+sd->parame[1])*(sd->sc_data[SC_QUAGMIRE].val1*10)/100;
 			int dexb = (sd->status.dex+sd->paramb[4]+sd->parame[4])*(sd->sc_data[SC_QUAGMIRE].val1*10)/100;
 			int dexb = (sd->status.dex+sd->paramb[4]+sd->parame[4])*(sd->sc_data[SC_QUAGMIRE].val1*10)/100;
+			sd->speed = sd->speed*3/2;
 			sd->paramb[1]-= agib > 50 ? 50 : agib;
 			sd->paramb[1]-= agib > 50 ? 50 : agib;
 			sd->paramb[4]-= dexb > 50 ? 50 : dexb;
 			sd->paramb[4]-= dexb > 50 ? 50 : dexb;
 		}
 		}
@@ -4562,11 +4562,11 @@ int pc_need_status_point(struct map_session_data *sd,int type)
  */
  */
 int pc_statusup(struct map_session_data *sd,int type)
 int pc_statusup(struct map_session_data *sd,int type)
 {
 {
-	int need,val = 0;
+	int max, need,val = 0;
 		
 		
 	nullpo_retr(0, sd);
 	nullpo_retr(0, sd);
 
 
-	int max = (pc_calc_upper(sd->status.class)==2) ? 80 : battle_config.max_parameter;
+	max = (pc_calc_upper(sd->status.class)==2) ? 80 : battle_config.max_parameter;
 
 
 	need=pc_need_status_point(sd,type);
 	need=pc_need_status_point(sd,type);
 	if(type<SP_STR || type>SP_LUK || need<0 || need>sd->status.status_point){
 	if(type<SP_STR || type>SP_LUK || need<0 || need>sd->status.status_point){

+ 15 - 12
src/map/skill.c

@@ -1378,13 +1378,12 @@ int skill_blown( struct block_list *src, struct block_list *target,int count)
 int skill_attack( int attack_type, struct block_list* src, struct block_list *dsrc,
 int skill_attack( int attack_type, struct block_list* src, struct block_list *dsrc,
 	 struct block_list *bl,int skillid,int skilllv,unsigned int tick,int flag )
 	 struct block_list *bl,int skillid,int skilllv,unsigned int tick,int flag )
 {
 {
-
-	if(skilllv <= 0) return 0;
-
 	struct Damage dmg;
 	struct Damage dmg;
 	struct status_change *sc_data;
 	struct status_change *sc_data;
 	int type,lv,damage;
 	int type,lv,damage;
 
 
+	if(skilllv <= 0) return 0;
+
 	rdamage = 0;
 	rdamage = 0;
 	nullpo_retr(0, src);
 	nullpo_retr(0, src);
 	nullpo_retr(0, dsrc);
 	nullpo_retr(0, dsrc);
@@ -2111,12 +2110,12 @@ int skill_cleartimerskill(struct block_list *src)
  */
  */
 int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int skillid,int skilllv,unsigned int tick,int flag )
 int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int skillid,int skilllv,unsigned int tick,int flag )
 {
 {
-	if(skilllv <= 0) return 0;
-
 	struct map_session_data *sd=NULL;
 	struct map_session_data *sd=NULL;
 	struct status_change *sc_data = battle_get_sc_data(src);
 	struct status_change *sc_data = battle_get_sc_data(src);
 	int i;
 	int i;
 
 
+	if(skilllv <= 0) return 0;
+
 	nullpo_retr(1, src);
 	nullpo_retr(1, src);
 	nullpo_retr(1, bl);
 	nullpo_retr(1, bl);
 
 
@@ -2650,8 +2649,6 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s
  */
  */
 int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int skillid,int skilllv,unsigned int tick,int flag )
 int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int skillid,int skilllv,unsigned int tick,int flag )
 {
 {
-	if(skilllv <= 0) return 0;
-
 	struct map_session_data *sd=NULL;
 	struct map_session_data *sd=NULL;
 	struct map_session_data *dstsd=NULL;
 	struct map_session_data *dstsd=NULL;
 	struct mob_data *md=NULL;
 	struct mob_data *md=NULL;
@@ -2664,6 +2661,8 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int
 				,1157,1159,1190,1272,1312,1373,1492};
 				,1157,1159,1190,1272,1312,1373,1492};
 	int poringclass[]={1002};
 	int poringclass[]={1002};
 
 
+	if(skilllv <= 0) return 0;
+
 	nullpo_retr(1, src);
 	nullpo_retr(1, src);
 	nullpo_retr(1, bl);
 	nullpo_retr(1, bl);
 
 
@@ -4406,11 +4405,11 @@ int skill_castend_id( int tid, unsigned int tick, int id,int data )
  */
  */
 int skill_castend_pos2( struct block_list *src, int x,int y,int skillid,int skilllv,unsigned int tick,int flag)
 int skill_castend_pos2( struct block_list *src, int x,int y,int skillid,int skilllv,unsigned int tick,int flag)
 {
 {
-	if(skilllv <= 0) return 0;
-
 	struct map_session_data *sd=NULL;
 	struct map_session_data *sd=NULL;
 	int i,tmpx = 0,tmpy = 0, x1 = 0, y1 = 0;
 	int i,tmpx = 0,tmpy = 0, x1 = 0, y1 = 0;
 
 
+	if(skilllv <= 0) return 0;
+
 	nullpo_retr(0, src);
 	nullpo_retr(0, src);
 
 
 	if(src->type==BL_PC){
 	if(src->type==BL_PC){
@@ -7515,8 +7514,10 @@ int skill_frostjoke_scream(struct block_list *bl,va_list ap)
  */
  */
 int skill_abra_dataset(int skilllv)
 int skill_abra_dataset(int skilllv)
 {
 {
-	if(skilllv <= 0) return 0;
 	int skill = rand()%331;
 	int skill = rand()%331;
+
+	if(skilllv <= 0) return 0;
+
 	//dbに基づくレベル?確率判定
 	//dbに基づくレベル?確率判定
 	if(skill_abra_db[skill].req_lv > skilllv || rand()%10000 >= skill_abra_db[skill].per) return 0;
 	if(skill_abra_db[skill].req_lv > skilllv || rand()%10000 >= skill_abra_db[skill].per) return 0;
 	//NPCスキルはダメ
 	//NPCスキルはダメ
@@ -9244,10 +9245,11 @@ int skill_check_cloaking(struct block_list *bl)
 	static int dy[]={-1,-1,-1, 0, 0, 1, 1, 1};
 	static int dy[]={-1,-1,-1, 0, 0, 1, 1, 1};
 	int end=1,i;
 	int end=1,i;
 
 
-	nullpo_retr(0, bl);
 	//missing sd [Found by Celest, commited by Aria]
 	//missing sd [Found by Celest, commited by Aria]
 	struct map_session_data *sd=(struct map_session_data *)bl;
 	struct map_session_data *sd=(struct map_session_data *)bl;
 
 
+	nullpo_retr(0, bl);
+
 	if(bl->type == BL_PC && 
 	if(bl->type == BL_PC && 
 		(battle_config.pc_cloak_check_type&1 || pc_checkskill(sd,AS_CLOAKING)>2))
 		(battle_config.pc_cloak_check_type&1 || pc_checkskill(sd,AS_CLOAKING)>2))
 		return 0;
 		return 0;
@@ -9455,11 +9457,12 @@ static int skill_unit_group_newid=10;
 struct skill_unit_group *skill_initunitgroup(struct block_list *src,
 struct skill_unit_group *skill_initunitgroup(struct block_list *src,
 	int count,int skillid,int skilllv,int unit_id)
 	int count,int skillid,int skilllv,int unit_id)
 {
 {
-	if(skilllv <= 0) return 0;
 	int i;
 	int i;
 	struct skill_unit_group *group=NULL, *list=NULL;
 	struct skill_unit_group *group=NULL, *list=NULL;
 	int maxsug=0;
 	int maxsug=0;
 
 
+	if(skilllv <= 0) return 0;
+
 	nullpo_retr(NULL, src);
 	nullpo_retr(NULL, src);
 
 
 	if(src->type==BL_PC){
 	if(src->type==BL_PC){