summaryrefslogtreecommitdiff
path: root/src/map/atcommand.c
diff options
context:
space:
mode:
authorFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-02-06 18:47:30 +0000
committerFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-02-06 18:47:30 +0000
commit4459a6244d44f3be68b01164ae52e3a2f212475e (patch)
tree763fbe0df7fd5b44ca681717fab719040605bbdb /src/map/atcommand.c
parentb8cec4ee2c23ca6984f31f21dfa3aa6632e564a0 (diff)
downloadhercules-4459a6244d44f3be68b01164ae52e3a2f212475e.tar.gz
hercules-4459a6244d44f3be68b01164ae52e3a2f212475e.tar.bz2
hercules-4459a6244d44f3be68b01164ae52e3a2f212475e.tar.xz
hercules-4459a6244d44f3be68b01164ae52e3a2f212475e.zip
* Follow up to r13485. (bugreport:2741)
- @spiritball creates spiritballs without timer (limited to the array size instead of 500) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13509 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r--src/map/atcommand.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index a4641b882..e5cd1c9e5 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -3713,20 +3713,19 @@ int atcommand_lostskill(const int fd, struct map_session_data* sd, const char* c
*------------------------------------------*/
int atcommand_spiritball(const int fd, struct map_session_data* sd, const char* command, const char* message)
{
+ int max_spiritballs = min(ARRAYLENGTH(sd->spirit_timer), 0x7FFF);
int number;
nullpo_retr(-1, sd);
- if (!message || !*message || (number = atoi(message)) < 0) {
- clif_displaymessage(fd, "Please, enter a spirit ball number (usage: @spiritball <number: 0-1000>).");
+ if (!message || !*message || (number = atoi(message)) < 0 || number >= max_spiritballs) {
+ char msg[256];
+ safesnprintf(msg, sizeof(msg), "Please, enter a spirit ball number (usage: @spiritball <number: 0-%d>).", max_spiritballs);
+ clif_displaymessage(fd, msg);
return -1;
}
- // set max number to avoid server/client crash (500 create big balls of several balls: no visial difference with more)
- if (number > 500)
- number = 500;
-
- if (number >= 0 && number <= 0x7FFF) {
- if (sd->spiritball != number || number > 499) {
+ if (number >= 0 && number <= max_spiritballs) {
+ if (sd->spiritball != number) {
if (sd->spiritball > 0)
pc_delspiritball(sd, sd->spiritball, 1);
sd->spiritball = number;