summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMadCamel <madcamel@gmail.com>2009-05-03 10:37:13 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2009-05-03 13:01:33 +0200
commit7642fdf488c5cd06363297ab88ef70b4f1caa4c6 (patch)
tree7a8ccc34829b16003af2847f93803a05916e9cd2 /src
parent1a284890a23188378db268500eb406f5505ff81b (diff)
downloadtmwa-7642fdf488c5cd06363297ab88ef70b4f1caa4c6.tar.gz
tmwa-7642fdf488c5cd06363297ab88ef70b4f1caa4c6.tar.bz2
tmwa-7642fdf488c5cd06363297ab88ef70b4f1caa4c6.tar.xz
tmwa-7642fdf488c5cd06363297ab88ef70b4f1caa4c6.zip
Fixed antispam to use a timer that doesn't wrap
Diffstat (limited to 'src')
-rw-r--r--src/map/battle.c2
-rw-r--r--src/map/map.h3
-rw-r--r--src/map/tmw.c6
3 files changed, 6 insertions, 5 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index d15c36d..f822c10 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -4513,7 +4513,7 @@ int battle_config_read(const char *cfgName)
battle_config.area_size = 14;
battle_config.chat_lame_penalty = 2;
- battle_config.chat_spam_threshold = 10000;
+ battle_config.chat_spam_threshold = 10;
battle_config.chat_spam_flood = 10;
battle_config.chat_spam_ban = 1;
battle_config.chat_spam_warn = 8;
diff --git a/src/map/map.h b/src/map/map.h
index fa97e0e..abd4988 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -3,6 +3,7 @@
#define _MAP_H_
#include <stdarg.h>
+#include <time.h>
#include "mmo.h"
#ifndef MAX
@@ -354,7 +355,7 @@ struct map_session_data {
int ignoreAll;
short sg_count;
- unsigned int chat_reset_due;
+ time_t chat_reset_due;
int chat_lines_in;
char chat_lastmsg[513];
};
diff --git a/src/map/tmw.c b/src/map/tmw.c
index 65c6a91..da43138 100644
--- a/src/map/tmw.c
+++ b/src/map/tmw.c
@@ -34,11 +34,12 @@
int tmw_CheckChatSpam(struct map_session_data *sd, char* message) {
nullpo_retr(1, sd);
+ time_t now = time(NULL);
if (pc_isGM(sd)) return 0;
- if (gettick() > sd->chat_reset_due) {
- sd->chat_reset_due = gettick() + battle_config.chat_spam_threshold;
+ if (now > sd->chat_reset_due) {
+ sd->chat_reset_due = now + battle_config.chat_spam_threshold;
sd->chat_lines_in = 0;
}
@@ -50,7 +51,6 @@ int tmw_CheckChatSpam(struct map_session_data *sd, char* message) {
sd->chat_lines_in += battle_config.chat_lame_penalty;
// Penalty for lame, it can stack on top of the repeat penalty.
- // Trade is automaticly lame.
if (tmw_CheckChatLameness(sd, message))
sd->chat_lines_in += battle_config.chat_lame_penalty;