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

Comparing deliantra/server/common/object.C (file contents):
Revision 1.350 by root, Sun May 8 12:40:41 2011 UTC vs.
Revision 1.354 by root, Mon Oct 29 23:55:52 2012 UTC

1/* 1/*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2005,2006,2007,2008,2009,2010,2011 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2001 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2001 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992 Frank Tore Johansen 6 * Copyright (©) 1992 Frank Tore Johansen
7 * 7 *
8 * Deliantra is free software: you can redistribute it and/or modify it under 8 * Deliantra is free software: you can redistribute it and/or modify it under
9 * the terms of the Affero GNU General Public License as published by the 9 * the terms of the Affero GNU General Public License as published by the
10 * Free Software Foundation, either version 3 of the License, or (at your 10 * Free Software Foundation, either version 3 of the License, or (at your
11 * option) any later version. 11 * 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 Affero GNU General Public License 18 * You should have received a copy of the Affero GNU General Public License
19 * and the GNU General Public License along with this program. If not, see 19 * and the GNU General Public License along with this program. If not, see
20 * <http://www.gnu.org/licenses/>. 20 * <http://www.gnu.org/licenses/>.
21 * 21 *
22 * The authors can be reached via e-mail to <support@deliantra.net> 22 * The authors can be reached via e-mail to <support@deliantra.net>
23 */ 23 */
24 24
25#include <global.h> 25#include <global.h>
26#include <stdio.h> 26#include <stdio.h>
1005 1005
1006 freelist = li; 1006 freelist = li;
1007 ++free_count; 1007 ++free_count;
1008} 1008}
1009 1009
1010// special "grave" map used to store all removed objects
1011// till they can be destroyed - saves a lot of checks in the rest
1012// of the code
1013static struct freed_map
1014: maptile
1015{
1016 freed_map ()
1017 : maptile (3, 3)
1018 {
1019 path = "<freed objects map>";
1020 name = "/internal/freed_objects_map";
1021 no_drop = 1;
1022 no_reset = 1;
1023
1024 state = MAP_ACTIVE;
1025 }
1026
1027 ~freed_map ()
1028 {
1029 destroy ();
1030 }
1031} freed_map; // freed objects are moved here to avoid crashes
1032
1033void 1010void
1034object::do_destroy () 1011object::do_destroy ()
1035{ 1012{
1036 if (flag [FLAG_IS_LINKED]) 1013 if (flag [FLAG_IS_LINKED])
1037 remove_link (); 1014 remove_link ();
2031 */ 2008 */
2032int 2009int
2033find_free_spot (const object *ob, maptile *m, int x, int y, int start, int stop) 2010find_free_spot (const object *ob, maptile *m, int x, int y, int start, int stop)
2034{ 2011{
2035 int altern[SIZEOFFREE]; 2012 int altern[SIZEOFFREE];
2036 int index = 0, flag; 2013 int index = 0;
2037 2014
2038 for (int i = start; i < stop; i++) 2015 for (int i = start; i < stop; i++)
2039 { 2016 {
2040 mapxy pos (m, x, y); pos.move (i); 2017 mapxy pos (m, x, y); pos.move (i);
2041 2018
2153 * there is capable of. 2130 * there is capable of.
2154 */ 2131 */
2155int 2132int
2156find_dir (maptile *m, int x, int y, object *exclude) 2133find_dir (maptile *m, int x, int y, object *exclude)
2157{ 2134{
2158 int max = SIZEOFFREE, mflags; 2135 int max = SIZEOFFREE;
2159 MoveType move_type; 2136 MoveType move_type;
2160 2137
2161 if (exclude && exclude->head_ () != exclude) 2138 if (exclude && exclude->head_ () != exclude)
2162 { 2139 {
2163 exclude = exclude->head; 2140 exclude = exclude->head;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines