diff options
author | shennetsind <ind@henn.et> | 2013-11-25 12:12:34 -0200 |
---|---|---|
committer | shennetsind <ind@henn.et> | 2013-11-25 12:12:34 -0200 |
commit | 659b0ebfe319d9f6697574f9eeff00808ec2d427 (patch) | |
tree | 3fc1da4b4497efd14564bc383285e8035d0dffa0 | |
parent | 58a985ed43473f4c8d58345dca158739f2ba7195 (diff) | |
download | hercules-659b0ebfe319d9f6697574f9eeff00808ec2d427.tar.gz hercules-659b0ebfe319d9f6697574f9eeff00808ec2d427.tar.bz2 hercules-659b0ebfe319d9f6697574f9eeff00808ec2d427.tar.xz hercules-659b0ebfe319d9f6697574f9eeff00808ec2d427.zip |
Fixed txt_time (used by @time)
number of screwed up scenarios e.g. when day, hour and second are 0 but minute is not.
Signed-off-by: shennetsind <ind@henn.et>
-rw-r--r-- | conf/messages.conf | 16 | ||||
-rw-r--r-- | src/map/atcommand.c | 21 |
2 files changed, 18 insertions, 19 deletions
diff --git a/conf/messages.conf b/conf/messages.conf index e1321241d..b6904328f 100644 --- a/conf/messages.conf +++ b/conf/messages.conf @@ -241,12 +241,12 @@ 218: This player's Peco Peco has been released. 219: %d day 220: %d days -221: %s %d hour -222: %s %d hours -223: %s %d minute -224: %s %d minutes -225: %s and %d second -226: %s and %d seconds +221: %d hour +222: %d hours +223: %d minute +224: %d minutes +225: and %d second +226: and %d seconds 227: Party modification is disabled on this map. 228: Guild modification is disabled on this map. 229: Your effect has changed. @@ -254,9 +254,9 @@ 231: Game time: The game is in permanent daylight. 232: Game time: The game is in permanent night. 233: Game time: The game is in night for %s. -234: Game time: After, the game will be in permanent daylight. +//234: 235: Game time: The game is in daylight for %s. -236: Game time: After, the game will be in permanent night. +//236: 237: Game time: After, the game will be in night for %s. 238: Game time: A day cycle has a normal duration of %s. 239: Game time: After, the game will be in daylight for %s. diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 9f3d2f694..b18868b0c 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -4237,10 +4237,9 @@ ACMD(unloadnpc) char* txt_time(unsigned int duration) { int days, hours, minutes, seconds; - char temp[CHAT_SIZE_MAX]; static char temp1[CHAT_SIZE_MAX]; + int tlen = 0; - memset(temp, '\0', sizeof(temp)); memset(temp1, '\0', sizeof(temp1)); days = duration / (60 * 60 * 24); @@ -4251,22 +4250,22 @@ char* txt_time(unsigned int duration) seconds = duration - (60 * minutes); if (days == 1) - sprintf(temp, msg_txt(219), days); // %d day + tlen += sprintf(tlen + temp1, msg_txt(219), days); // %d day else if (days > 1) - sprintf(temp, msg_txt(220), days); // %d days + tlen += sprintf(tlen + temp1, msg_txt(220), days); // %d days if (hours == 1) - sprintf(temp1, msg_txt(221), temp, hours); // %s %d hour + tlen += sprintf(tlen + temp1, msg_txt(221), hours); // %d hour else if (hours > 1) - sprintf(temp1, msg_txt(222), temp, hours); // %s %d hours + tlen += sprintf(tlen + temp1, msg_txt(222), hours); // %d hours if (minutes < 2) - sprintf(temp, msg_txt(223), temp1, minutes); // %s %d minute + tlen += sprintf(tlen + temp1, msg_txt(223), minutes); // %d minute else - sprintf(temp, msg_txt(224), temp1, minutes); // %s %d minutes + tlen += sprintf(tlen + temp1, msg_txt(224), minutes); // %d minutes if (seconds == 1) - sprintf(temp1, msg_txt(225), temp, seconds); // %s and %d second + tlen += sprintf(tlen + temp1, msg_txt(225), seconds); // and %d second else if (seconds > 1) - sprintf(temp1, msg_txt(226), temp, seconds); // %s and %d seconds - + tlen += sprintf(tlen + temp1, msg_txt(226), seconds); // and %d seconds + return temp1; } |