summaryrefslogtreecommitdiff
path: root/src/map/atcommand.c
diff options
context:
space:
mode:
authorSkotlex <Skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-08-10 15:52:59 +0000
committerSkotlex <Skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-08-10 15:52:59 +0000
commit09b2f259b86749e57b1179d795f19f495c5defab (patch)
treeb15138123690db0e7722e6a6141e825e1c8060ae /src/map/atcommand.c
parentc5fa6396f9cbb8e5e6e4deb0bb1cbf926d21c6e1 (diff)
downloadhercules-09b2f259b86749e57b1179d795f19f495c5defab.tar.gz
hercules-09b2f259b86749e57b1179d795f19f495c5defab.tar.bz2
hercules-09b2f259b86749e57b1179d795f19f495c5defab.tar.xz
hercules-09b2f259b86749e57b1179d795f19f495c5defab.zip
- Commiting a bunch of cleanups piled up from the past few weeks/months/years.
- Updated unitwarp so that an id of "0" causes the script's rid to be warped. - Updated the Brasilis ontouchNPC warp command to use unitwarp instead. - Signum Crucis's duration is now specified in the skill_cast_db file - Updated @warp/@jump commands so that when an invalid tile is specified, a nearby cell is chosen (rather than using a map-wide random value) - The if(req.weapon) code was broken, since req.weapon is never "0" for a skill. Updated the code so that the requirement of '99' (any weapon) is stored as 0, in order to make the checks effective. - Cleaned up the code for script command warpparty - Fixed the define itemdb_canrefine() - Cleaned up some the status_damage() function - Fixed map_random_dir(), which at times would pick cells that didn't preserve the required distance. - Some aesthetic code cleanups. - Fixed some possible crashes for skills where the code assumes the caster is a player. - Fixed a bunch of idiotic code-snippets that should have embarrassed whoever was responsible for them. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14929 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r--src/map/atcommand.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index d414d565d..c2599d68d 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -416,7 +416,7 @@ ACMD_FUNC(mapmove)
{
char map_name[MAP_NAME_LENGTH_EXT];
unsigned short mapindex;
- int x = 0, y = 0;
+ short x = 0, y = 0;
int m = -1;
nullpo_retr(-1, sd);
@@ -424,8 +424,8 @@ ACMD_FUNC(mapmove)
memset(map_name, '\0', sizeof(map_name));
if (!message || !*message ||
- (sscanf(message, "%15s %d %d", map_name, &x, &y) < 3 &&
- sscanf(message, "%15[^,],%d,%d", map_name, &x, &y) < 1)) {
+ (sscanf(message, "%15s %hd %hd", map_name, &x, &y) < 3 &&
+ sscanf(message, "%15[^,],%hd,%hd", map_name, &x, &y) < 1)) {
clif_displaymessage(fd, "Please, enter a map (usage: @warp/@rura/@mapmove <mapname> <x> <y>).");
return -1;
@@ -443,7 +443,8 @@ ACMD_FUNC(mapmove)
if ((x || y) && map_getcell(m, x, y, CELL_CHKNOPASS))
{ //This is to prevent the pc_setpos call from printing an error.
clif_displaymessage(fd, msg_txt(2));
- x = y = 0; //Invalid cell, use random spot.
+ if (!map_search_freecell(NULL, m, &x, &y, 10, 10, 1))
+ x = y = 0; //Invalid cell, use random spot.
}
if (map[m].flag.nowarpto && battle_config.any_warp_GM_min_level > pc_isGM(sd)) {
clif_displaymessage(fd, msg_txt(247));
@@ -548,13 +549,13 @@ ACMD_FUNC(jumpto)
*------------------------------------------*/
ACMD_FUNC(jump)
{
- int x = 0, y = 0;
+ short x = 0, y = 0;
nullpo_retr(-1, sd);
memset(atcmd_output, '\0', sizeof(atcmd_output));
- sscanf(message, "%d %d", &x, &y);
+ sscanf(message, "%hd %hd", &x, &y);
if (map[sd->bl.m].flag.noteleport && battle_config.any_warp_GM_min_level > pc_isGM(sd)) {
clif_displaymessage(fd, msg_txt(248)); // You are not authorized to warp from your current map.
@@ -570,7 +571,8 @@ ACMD_FUNC(jump)
if ((x || y) && map_getcell(sd->bl.m, x, y, CELL_CHKNOPASS))
{ //This is to prevent the pc_setpos call from printing an error.
clif_displaymessage(fd, msg_txt(2));
- x = y = 0; //Invalid cell, use random spot.
+ if (!map_search_freecell(NULL, sd->bl.m, &x, &y, 10, 10, 1))
+ x = y = 0; //Invalid cell, use random spot.
}
pc_setpos(sd, sd->mapindex, x, y, CLR_TELEPORT);