summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoramber <amber@54d463be-8e91-2dee-dedb-b68131a5f0ec>2004-11-17 04:48:11 +0000
committeramber <amber@54d463be-8e91-2dee-dedb-b68131a5f0ec>2004-11-17 04:48:11 +0000
commit9e7f07a4a5ccfb7e1862fbb58c32e928ab9c35e8 (patch)
tree079392aca9c0a6c79a0b6405c80ecc3aef353634
parent4db5fdac1ee37f1dd2d2d28fbcaca577e112b953 (diff)
downloadhercules-9e7f07a4a5ccfb7e1862fbb58c32e928ab9c35e8.tar.gz
hercules-9e7f07a4a5ccfb7e1862fbb58c32e928ab9c35e8.tar.bz2
hercules-9e7f07a4a5ccfb7e1862fbb58c32e928ab9c35e8.tar.xz
hercules-9e7f07a4a5ccfb7e1862fbb58c32e928ab9c35e8.zip
Compiler fixes and scripting timer event fixes
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/athena@228 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog.txt2
-rw-r--r--src/map/log.c59
-rw-r--r--src/map/npc.c13
-rw-r--r--src/map/pc.c6
-rw-r--r--src/map/skill.c27
5 files changed, 66 insertions, 41 deletions
diff --git a/Changelog.txt b/Changelog.txt
index c6a20d0b8..379112174 100644
--- a/Changelog.txt
+++ b/Changelog.txt
@@ -1,5 +1,7 @@
Date Added
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]
* Fixed a typo in ../db/Changelog.txt [Nana]
* Added -funroll-loops argument to makefile to further increase performance [Shinigami]
diff --git a/src/map/log.c b/src/map/log.c
index 1f6968eab..86c5a41a2 100644
--- a/src/map/log.c
+++ b/src/map/log.c
@@ -11,10 +11,11 @@ struct Log_Config log_config;
int log_branch(struct map_session_data *sd)
{
+ FILE *logfp;
+
if(log_config.enable_logs <= 0)
return 0;
nullpo_retr(0, sd);
- FILE *logfp;
#ifndef TXT_ONLY
if(log_config.sql_logs > 0)
{
@@ -24,9 +25,9 @@ int log_branch(struct map_session_data *sd)
} else {
#endif
if((logfp=fopen(log_config.log_drop,"a+")) != NULL) {
+ char timestring[255];
time_t curtime;
time(&curtime);
- char timestring[255];
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);
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)
{
+ FILE *logfp;
+
if(log_config.enable_logs <= 0)
return 0;
nullpo_retr(0, sd);
- FILE *logfp;
#ifndef TXT_ONLY
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 {
#endif
if((logfp=fopen(log_config.log_drop,"a+")) != NULL) {
+ char timestring[255];
+
time_t curtime;
time(&curtime);
- char timestring[255];
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);
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)
{
+ FILE *logfp;
+
if(log_config.enable_logs <= 0)
return 0;
nullpo_retr(0, sd);
- FILE *logfp;
#ifndef TXT_ONLY
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 {
#endif
if((logfp=fopen(log_config.log_mvpdrop,"a+")) != NULL) {
+ char timestring[255];
time_t curtime;
time(&curtime);
- char timestring[255];
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);
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)
{
+ FILE *logfp;
if(log_config.enable_logs <= 0)
return 0;
nullpo_retr(0, sd);
- FILE *logfp;
#ifndef TXT_ONLY
if(log_config.sql_logs > 0)
{
@@ -108,9 +112,9 @@ int log_present(struct map_session_data *sd, int source_type, int nameid)
} else {
#endif
if((logfp=fopen(log_config.log_present,"a+")) != NULL) {
+ char timestring[255];
time_t curtime;
time(&curtime);
- char timestring[255];
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);
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)
{
+ FILE *logfp;
if(log_config.enable_logs <= 0)
return 0;
nullpo_retr(0, sd);
- FILE *logfp;
#ifndef TXT_ONLY
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 {
#endif
if((logfp=fopen(log_config.log_produce,"a+")) != NULL) {
+ char timestring[255];
time_t curtime;
time(&curtime);
- char timestring[255];
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);
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)
{
- if(log_config.enable_logs <= 0)
- return 0;
- nullpo_retr(0, sd);
FILE *logfp;
int log_card[4];
int item_level;
int i;
+ if(log_config.enable_logs <= 0)
+ return 0;
+
+ nullpo_retr(0, sd);
if(success == 0)
item_level = 0;
@@ -177,9 +182,9 @@ int log_refine(struct map_session_data *sd, int n, int success)
} else {
#endif
if((logfp=fopen(log_config.log_refine,"a+")) != NULL) {
+ char timestring[255];
time_t curtime;
time(&curtime);
- char timestring[255];
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);
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)
{
+ FILE *logfp;
+ int log_nameid, log_amount, log_refine, log_card[4];
+ int i;
+
if(log_config.enable_logs <= 0)
return 0;
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)
return 1;
@@ -222,9 +228,9 @@ int log_trade(struct map_session_data *sd, struct map_session_data *target_sd, i
} else {
#endif
if((logfp=fopen(log_config.log_trade,"a+")) != NULL) {
+ char timestring[255];
time_t curtime;
time(&curtime);
- char timestring[255];
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);
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)
{
- if(log_config.enable_logs <= 0)
- return 0;
FILE *logfp;
- nullpo_retr(0, sd);
int log_nameid, log_amount, log_refine, log_card[4];
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)
return 1;
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 {
#endif
if((logfp=fopen(log_config.log_vend,"a+")) != NULL) {
+ char timestring[255];
time_t curtime;
time(&curtime);
- char timestring[255];
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);
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)
{
+ FILE *logfp;
if(log_config.enable_logs <= 0)
return 0;
nullpo_retr(0, sd);
- FILE *logfp;
#ifndef TXT_ONLY
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 {
#endif
if((logfp=fopen(log_config.log_trade,"a+")) != NULL) {
+ char timestring[255];
time_t curtime;
time(&curtime);
- char timestring[255];
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);
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)
{
+ FILE *logfp;
if(log_config.enable_logs <= 0)
return 0;
nullpo_retr(0, sd);
- FILE *logfp;
#ifndef TXT_ONLY
if(log_config.sql_logs > 0)
{
@@ -320,9 +327,9 @@ int log_atcommand(struct map_session_data *sd, const char *message)
} else {
#endif
if((logfp=fopen(log_config.log_gm,"a+")) != NULL) {
+ char timestring[255];
time_t curtime;
time(&curtime);
- char timestring[255];
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);
fclose(logfp);
diff --git a/src/map/npc.c b/src/map/npc.c
index 283b28e66..72daea571 100644
--- a/src/map/npc.c
+++ b/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;
struct tm *t;
char buf[64];
+ char *day;
int c=0;
time(&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 ) {
sprintf(buf,"OnMinute%02d",t->tm_min);
c+=npc_event_doall(buf);
sprintf(buf,"OnClock%02d%02d",t->tm_hour,t->tm_min);
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) {
sprintf(buf,"OnHour%02d",t->tm_hour);
diff --git a/src/map/pc.c b/src/map/pc.c
index 64d10c1ce..54207c853 100644
--- a/src/map/pc.c
+++ b/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) // ラウドボイス
sd->paramb[0]+= 4;
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 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[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 need,val = 0;
+ int max, need,val = 0;
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);
if(type<SP_STR || type>SP_LUK || need<0 || need>sd->status.status_point){
diff --git a/src/map/skill.c b/src/map/skill.c
index e858d49df..5d89b7f84 100644
--- a/src/map/skill.c
+++ b/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,
struct block_list *bl,int skillid,int skilllv,unsigned int tick,int flag )
{
-
- if(skilllv <= 0) return 0;
-
struct Damage dmg;
struct status_change *sc_data;
int type,lv,damage;
+ if(skilllv <= 0) return 0;
+
rdamage = 0;
nullpo_retr(0, src);
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 )
{
- if(skilllv <= 0) return 0;
-
struct map_session_data *sd=NULL;
struct status_change *sc_data = battle_get_sc_data(src);
int i;
+ if(skilllv <= 0) return 0;
+
nullpo_retr(1, src);
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 )
{
- if(skilllv <= 0) return 0;
-
struct map_session_data *sd=NULL;
struct map_session_data *dstsd=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};
int poringclass[]={1002};
+ if(skilllv <= 0) return 0;
+
nullpo_retr(1, src);
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)
{
- if(skilllv <= 0) return 0;
-
struct map_session_data *sd=NULL;
int i,tmpx = 0,tmpy = 0, x1 = 0, y1 = 0;
+ if(skilllv <= 0) return 0;
+
nullpo_retr(0, src);
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)
{
- if(skilllv <= 0) return 0;
int skill = rand()%331;
+
+ if(skilllv <= 0) return 0;
+
//dbに基づくレベル?確率判定
if(skill_abra_db[skill].req_lv > skilllv || rand()%10000 >= skill_abra_db[skill].per) return 0;
//NPCスキルはダメ
@@ -9244,10 +9245,11 @@ int skill_check_cloaking(struct block_list *bl)
static int dy[]={-1,-1,-1, 0, 0, 1, 1, 1};
int end=1,i;
- nullpo_retr(0, bl);
//missing sd [Found by Celest, commited by Aria]
struct map_session_data *sd=(struct map_session_data *)bl;
+ nullpo_retr(0, bl);
+
if(bl->type == BL_PC &&
(battle_config.pc_cloak_check_type&1 || pc_checkskill(sd,AS_CLOAKING)>2))
return 0;
@@ -9455,11 +9457,12 @@ static int skill_unit_group_newid=10;
struct skill_unit_group *skill_initunitgroup(struct block_list *src,
int count,int skillid,int skilllv,int unit_id)
{
- if(skilllv <= 0) return 0;
int i;
struct skill_unit_group *group=NULL, *list=NULL;
int maxsug=0;
+ if(skilllv <= 0) return 0;
+
nullpo_retr(NULL, src);
if(src->type==BL_PC){