ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/socket/request.C
(Generate patch)

Comparing deliantra/server/socket/request.C (file contents):
Revision 1.61 by root, Mon Jan 8 18:18:36 2007 UTC vs.
Revision 1.64 by pippijn, Sat Jan 20 13:47:17 2007 UTC

1/* 1/*
2 CrossFire, A Multiplayer game for X-windows 2 * CrossFire, A Multiplayer game for X-windows
3 3 *
4 Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team 4 * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team
5 Copyright (C) 2001 Mark Wedel 5 * Copyright (C) 2001 Mark Wedel
6 Copyright (C) 1992 Frank Tore Johansen 6 * Copyright (C) 1992 Frank Tore Johansen
7 7 *
8 This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or 10 * the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version. 11 * (at your option) any later version.
12 12 *
13 This program is distributed in the hope that it will be useful, 13 * This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details. 16 * GNU General Public License for more details.
17 17 *
18 You should have received a copy of the GNU General Public License 18 * You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software 19 * along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 21 *
22 The author can be reached via e-mail to <crossfire@schmorp.de> 22 * The author can be reached via e-mail to <crossfire@schmorp.de>
23*/ 23 */
24 24
25/** 25/**
26 * \file 26 * \file
27 * Client handling. 27 * Client handling.
28 * 28 *
1552 } 1552 }
1553 1553
1554 return result; 1554 return result;
1555} 1555}
1556 1556
1557// prefetch (and touch) all maps within a specific distancd
1558static void
1559prefetch_surrounding_maps (maptile *map, int distance)
1560{
1561 map->last_access = runtime;
1562
1563 if (--distance)
1564 for (int dir = 4; --dir; )
1565 if (const shstr &path = map->tile_path [dir])
1566 if (maptile *&neigh = map->tile_map [dir])
1567 prefetch_surrounding_maps (neigh, distance);
1568 else
1569 neigh = maptile::find_async (path, map);
1570}
1571
1572// prefetch a generous area around the player
1573static void
1574prefetch_surrounding_maps (object *op)
1575{
1576 prefetch_surrounding_maps (op->map, 3);
1577}
1578
1557/** 1579/**
1558 * This function uses the new map1 protocol command to send the map 1580 * This function uses the new map1 protocol command to send the map
1559 * to the client. It is necessary because the old map command supports 1581 * to the client. It is necessary because the old map command supports
1560 * a maximum map size of 15x15. 1582 * a maximum map size of 15x15.
1561 * This function is much simpler than the old one. This is because 1583 * This function is much simpler than the old one. This is because
1592 1614
1593 if (!pl->active) 1615 if (!pl->active)
1594 return; 1616 return;
1595 1617
1596 check_map_change (pl->contr); 1618 check_map_change (pl->contr);
1619 prefetch_surrounding_maps (pl);
1597 1620
1598 packet sl (socket.mapmode == Map1Cmd ? "map1" : "map1a"); 1621 packet sl (socket.mapmode == Map1Cmd ? "map1" : "map1a");
1599 packet esl; 1622 packet esl;
1600 1623
1601 startlen = sl.length (); 1624 startlen = sl.length ();
1969void 1992void
1970draw_client_map (object *pl) 1993draw_client_map (object *pl)
1971{ 1994{
1972 int i, j; 1995 int i, j;
1973 sint16 ax, ay, nx, ny; /* ax and ay goes from 0 to max-size of arrays */ 1996 sint16 ax, ay, nx, ny; /* ax and ay goes from 0 to max-size of arrays */
1974 New_Face *face, *floor; 1997 facetile *face, *floor;
1975 New_Face *floor2; 1998 facetile *floor2;
1976 int d, mflags; 1999 int d, mflags;
1977 struct Map newmap; 2000 struct Map newmap;
1978 maptile *m, *pm; 2001 maptile *m, *pm;
1979 2002
1980 if (pl->type != PLAYER) 2003 if (pl->type != PLAYER)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines