summaryrefslogtreecommitdiff
path: root/src/map/charcommand.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-16 15:33:59 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-16 15:33:59 +0000
commitd042f7cfd71139195cf43534e93df18b009b1070 (patch)
tree32b141651c85b8989808804deb3f087aa51676bc /src/map/charcommand.c
parente997d4f135355b1334f31242e9f76fae46a2deec (diff)
downloadhercules-d042f7cfd71139195cf43534e93df18b009b1070.tar.gz
hercules-d042f7cfd71139195cf43534e93df18b009b1070.tar.bz2
hercules-d042f7cfd71139195cf43534e93df18b009b1070.tar.xz
hercules-d042f7cfd71139195cf43534e93df18b009b1070.zip
- Fixed mysql ping setting being in minutes rather than hours.
- Removed npc_event_sub from npc.h and moved it to npc.c - Cleaned up #warp to prevent spitting non-walkable tile warnings. - Changed the meaning of msg_athena 2, it is now "invalid target cell, randomizing". git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6114 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/charcommand.c')
-rw-r--r--src/map/charcommand.c63
1 files changed, 29 insertions, 34 deletions
diff --git a/src/map/charcommand.c b/src/map/charcommand.c
index 6c589473e..4f7d8eb01 100644
--- a/src/map/charcommand.c
+++ b/src/map/charcommand.c
@@ -1143,46 +1143,41 @@ int charcommand_warp(
return -1;
}
- if (x <= 0)
- x = rand() % 399 + 1;
- if (y <= 0)
- y = rand() % 399 + 1;
if (strstr(map_name, ".gat") == NULL && strstr(map_name, ".afm") == NULL && strlen(map_name) < MAP_NAME_LENGTH-4) // 16 - 4 (.gat)
strcat(map_name, ".gat");
- if ((pl_sd = map_nick2sd(character)) != NULL) {
- if (pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can rura+ only lower or same GM level
- if (x > 0 && x < 400 && y > 0 && y < 400) {
- m = map_mapname2mapid(map_name);
- if (m >= 0 && map[m].flag.nowarpto && battle_config.any_warp_GM_min_level > pc_isGM(sd)) {
- clif_displaymessage(fd, "You are not authorised to warp someone to this map.");
- return -1;
- }
- if (pl_sd->bl.m >= 0 && map[pl_sd->bl.m].flag.nowarp && battle_config.any_warp_GM_min_level > pc_isGM(sd)) {
- clif_displaymessage(fd, "You are not authorised to warp this player from its actual map.");
- return -1;
- }
- if (pc_setpos(pl_sd, map[m].index, x, y, 3) == 0) {
- clif_displaymessage(pl_sd->fd, msg_table[0]); // Warped.
- clif_displaymessage(fd, msg_table[15]); // Player warped (message sends to player too).
- } else {
- clif_displaymessage(fd, msg_table[1]); // Map not found.
- return -1;
- }
- } else {
- clif_displaymessage(fd, msg_table[2]); // Coordinates out of range.
- return -1;
- }
- } else {
- clif_displaymessage(fd, msg_table[81]); // Your GM level don't authorise you to do this action on this player.
- return -1;
- }
- } else {
+ if ((pl_sd = map_nick2sd(character)) == NULL) {
clif_displaymessage(fd, msg_table[3]); // Character not found.
return -1;
}
-
- return 0;
+ if (pc_isGM(sd) < pc_isGM(pl_sd)) { // you can rura+ only lower or same GM level
+ clif_displaymessage(fd, msg_table[81]); // Your GM level don't authorise you to do this action on this player.
+ return -1;
+ }
+ m = map_mapname2mapid(map_name);
+ if (m < 0) {
+ clif_displaymessage(fd, msg_table[1]); // Map not found.
+ return -1;
+ }
+ if ((x || y) && map_getcell(m, x, y, CELL_CHKNOREACH)) {
+ clif_displaymessage(fd, msg_table[2]); // Coordinates out of range.
+ x = y = 0;
+ }
+ if (map[m].flag.nowarpto && battle_config.any_warp_GM_min_level > pc_isGM(sd)) {
+ clif_displaymessage(fd, "You are not authorised to warp someone to this map.");
+ return -1;
+ }
+ if (pl_sd->bl.m >= 0 && map[pl_sd->bl.m].flag.nowarp && battle_config.any_warp_GM_min_level > pc_isGM(sd)) {
+ clif_displaymessage(fd, "You are not authorised to warp this player from its actual map.");
+ return -1;
+ }
+ if (pc_setpos(pl_sd, map[m].index, x, y, 3) == 0) {
+ clif_displaymessage(pl_sd->fd, msg_table[0]); // Warped.
+ clif_displaymessage(fd, msg_table[15]); // Player warped (message sends to player too).
+ return 0;
+ }
+ //No error message specified...?
+ return -1;
}
/*==========================================