--- deliantra/server/socket/request.C 2011/05/03 11:23:48 1.180
+++ deliantra/server/socket/request.C 2012/11/04 01:01:13 1.190
@@ -1,24 +1,24 @@
/*
* This file is part of Deliantra, the Roguelike Realtime MMORPG.
- *
- * Copyright (©) 2005,2006,2007,2008,2009,2010,2011 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
+ *
+ * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
* Copyright (©) 2001 Mark Wedel
* Copyright (©) 1992 Frank Tore Johansen
- *
+ *
* Deliantra is free software: you can redistribute it and/or modify it under
* the terms of the Affero GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the Affero GNU General Public License
* and the GNU General Public License along with this program. If not, see
* .
- *
+ *
* The authors can be reached via e-mail to
*/
@@ -160,17 +160,18 @@
if (socket.mapinfocmd)
{
- if (ob->map && ob->map->path[0])
+ if (ob->map && ob->map->path)
{
int flags = 0;
- if (ob->map->tile_path[0]) flags |= 0x01;
- if (ob->map->tile_path[1]) flags |= 0x02;
- if (ob->map->tile_path[2]) flags |= 0x04;
- if (ob->map->tile_path[3]) flags |= 0x08;
+ // due to historical glitches, the bit ordering and map index ordering differs
+ if (ob->map->tile_path [TILE_NORTH]) flags |= 0x01;
+ if (ob->map->tile_path [TILE_EAST ]) flags |= 0x02;
+ if (ob->map->tile_path [TILE_SOUTH]) flags |= 0x04;
+ if (ob->map->tile_path [TILE_WEST ]) flags |= 0x08;
// these two are debatable
- if (ob->map->tile_path[4]) flags |= 0x10;
- if (ob->map->tile_path[5]) flags |= 0x20;
+ if (ob->map->tile_path [TILE_UP ]) flags |= 0x10;
+ if (ob->map->tile_path [TILE_DOWN ]) flags |= 0x20;
socket.send_packet_printf ("mapinfo - spatial %d %d %d %d %d %s",
flags, socket.mapx / 2 - ob->x, socket.mapy / 2 - ob->y,
@@ -195,7 +196,7 @@
socket.current_region = reg;
}
- // first try to aovid a full newmap on tiled map scrolls
+ // first try to avoid a full newmap on tiled map scrolls
if (socket.current_map != ob->map && !socket.force_newmap)
{
rv_vector rv;
@@ -277,6 +278,8 @@
* RequestInfo is sort of a meta command. There is some specific
* request of information, but we call other functions to provide
* that information.
+ * requestinfo is completely deprecated, use resource exti request
+ * and the fxix or http protocols.
*/
void
RequestInfo (char *buf, int len, client *ns)
@@ -346,9 +349,14 @@
{
int dir = *buf++ - '1';
+ // due to historical glitches, the mapinfo index and tile index differs
+ static unsigned char dirmap [] = { TILE_NORTH, TILE_EAST, TILE_SOUTH, TILE_WEST, TILE_UP, TILE_DOWN };
+
// maybe we should only allow the four flat directions
- if (dir >= 0 && dir < TILE_NUM)
+ if (IN_RANGE_EXC (dir, 0, array_length (dirmap)))
{
+ dir = dirmap [dir];
+
if (!map->tile_path [dir])
map = 0;
else if (map->tile_available (dir, false))
@@ -381,13 +389,14 @@
{
int flags = 0;
- if (map->tile_path[0]) flags |= 0x01;
- if (map->tile_path[1]) flags |= 0x02;
- if (map->tile_path[2]) flags |= 0x04;
- if (map->tile_path[3]) flags |= 0x08;
+ // due to historical glitches, the bit ordering and map index ordering differs
+ if (map->tile_path [TILE_NORTH]) flags |= 0x01;
+ if (map->tile_path [TILE_EAST ]) flags |= 0x02;
+ if (map->tile_path [TILE_SOUTH]) flags |= 0x04;
+ if (map->tile_path [TILE_WEST ]) flags |= 0x08;
// these two are debatable
- if (map->tile_path[4]) flags |= 0x10;
- if (map->tile_path[5]) flags |= 0x20;
+ if (map->tile_path [TILE_UP ]) flags |= 0x10;
+ if (map->tile_path [TILE_DOWN ]) flags |= 0x20;
send_packet_printf ("mapinfo %s spatial %d %d %d %d %d %s", token, flags, mapx, mapy, map->width, map->height, &map->path);
}
@@ -882,38 +891,6 @@
return 0;
}
-//-GPL
-
-// prefetch some flat area around the player
-static void
-prefetch_surrounding_area (object *op, maptile *map, int range)
-{
- for (maprect *rect = map->split_to_tiles (mapwalk_buf,
- op->x - range , op->y - range ,
- op->x + range + 1, op->y + range + 1);
- rect->m;
- ++rect)
- {
- rect->m->touch ();
- rect->m->activate ();
- }
-}
-
-// prefetch a generous area around the player, also up and down
-void
-object::prefetch_surrounding_maps ()
-{
- prefetch_surrounding_area (this, map, 40);
-
- if (maptile *m = map->tile_available (TILE_DOWN))
- prefetch_surrounding_area (this, m, 20);
-
- if (maptile *m = map->tile_available (TILE_UP))
- prefetch_surrounding_area (this, m, 20);
-}
-
-//+GPL
-
/**
* Draws client map.
*/
@@ -928,7 +905,7 @@
* can get swapped out. If so, don't try to send them a map. All will
* be OK once they really log in.
*/
- if (!ob->map || ob->map->in_memory != MAP_ACTIVE)
+ if (!ob->map || ob->map->state != MAP_ACTIVE)
return;
int startlen, oldlen;
@@ -1262,7 +1239,7 @@
static void
append_spell (player *pl, packet &sl, object *spell)
{
- int i, skill = 0;
+ int skill = 0;
if (!(spell->name))
{