diff options
-rw-r--r-- | src/map/npc.c | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/src/map/npc.c b/src/map/npc.c index 41069c015..7389808c5 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -402,38 +402,43 @@ int npc_event_do_clock(int tid, unsigned int tick, int id, intptr_t data) time_t timer; struct tm* t; char buf[64]; - char* day; int c = 0; timer = time(NULL); 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; - default:day = ""; break; - } - if (t->tm_min != ev_tm_b.tm_min ) { + char* day; + + 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; + default:day = ""; break; + } + 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); - 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); + 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); - c+=npc_event_doall(buf); + c += npc_event_doall(buf); } - if (t->tm_mday!= ev_tm_b.tm_mday) { + + if (t->tm_mday != ev_tm_b.tm_mday) { sprintf(buf,"OnDay%02d%02d",t->tm_mon+1,t->tm_mday); - c+=npc_event_doall(buf); + c += npc_event_doall(buf); } memcpy(&ev_tm_b,t,sizeof(ev_tm_b)); |