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,2013,2014,2015,2016 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2002-2005 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2002-2005 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 | /* |
25 | /* |
26 | * The maptile is allocated each time a new map is opened. |
26 | * The maptile is allocated each time a new map is opened. |
… | |
… | |
204 | update (); |
204 | update (); |
205 | return items_; |
205 | return items_; |
206 | } |
206 | } |
207 | |
207 | |
208 | // return the item volume on this mapspace in cm³ |
208 | // return the item volume on this mapspace in cm³ |
209 | MTH uint64 volume () |
209 | MTH volume_t volume () |
210 | { |
210 | { |
211 | update (); |
211 | update (); |
212 | return volume_ * 1024; |
212 | return volume_ * 1024; |
213 | } |
213 | } |
214 | |
214 | |
… | |
… | |
320 | shstr ACC (RW, msg); /* Message map creator may have left */ |
320 | shstr ACC (RW, msg); /* Message map creator may have left */ |
321 | shstr ACC (RW, maplore); /* Map lore information */ |
321 | shstr ACC (RW, maplore); /* Map lore information */ |
322 | shstr ACC (RW, tile_path[TILE_NUM]); /* path to adjoining maps */ |
322 | shstr ACC (RW, tile_path[TILE_NUM]); /* path to adjoining maps */ |
323 | maptile *ACC (RW, tile_map[TILE_NUM]); /* Next map, linked list */ |
323 | maptile *ACC (RW, tile_map[TILE_NUM]); /* Next map, linked list */ |
324 | shstr ACC (RW, path); /* Filename of the map */ |
324 | shstr ACC (RW, path); /* Filename of the map */ |
325 | uint64 ACC (RW, max_volume); // maximum volume for all items on a mapspace |
325 | volume_t ACC (RW, max_volume); // maximum volume for all items on a mapspace |
326 | int ACC (RW, max_items); // maximum number of items on a mapspace |
326 | int ACC (RW, max_items); // maximum number of items on a mapspace |
327 | |
327 | |
328 | //-GPL |
328 | //-GPL |
329 | |
329 | |
330 | physics_queue pq[PHYSICS_QUEUES]; |
330 | physics_queue pq[PHYSICS_QUEUES]; |
… | |
… | |
600 | } \ |
600 | } \ |
601 | } |
601 | } |
602 | |
602 | |
603 | extern dynbuf mapwalk_buf; // can be used in simple non-recursive situations |
603 | extern dynbuf mapwalk_buf; // can be used in simple non-recursive situations |
604 | |
604 | |
|
|
605 | // special "grave" map used to store all removed objects |
|
|
606 | // till they can be destroyed - saves a lot of checks in the rest |
|
|
607 | // of the code |
|
|
608 | struct freed_map |
|
|
609 | : maptile |
|
|
610 | { |
|
|
611 | freed_map () |
|
|
612 | : maptile (3, 3) |
|
|
613 | { |
|
|
614 | path = "<freed objects map>"; |
|
|
615 | name = "/internal/freed_objects_map"; |
|
|
616 | no_drop = 1; |
|
|
617 | no_reset = 1; |
|
|
618 | |
|
|
619 | state = MAP_ACTIVE; |
|
|
620 | } |
|
|
621 | |
|
|
622 | ~freed_map () |
|
|
623 | { |
|
|
624 | destroy (); |
|
|
625 | } |
|
|
626 | }; |
|
|
627 | |
|
|
628 | // initialised in common/shstr.C, due to shstr usage we need defined |
|
|
629 | // initialisation order! |
|
|
630 | extern struct freed_map freed_map; // freed objects are moved here to avoid crashes |
|
|
631 | |
605 | // loop over every space in the given maprect, |
632 | // loop over every space in the given maprect, |
606 | // setting m, nx, ny to the map and -coordinate and dx, dy to the offset relative to dx0,dy0 |
633 | // setting m, nx, ny to the map and -coordinate and dx, dy to the offset relative to dx0,dy0 |
607 | // the iterator code must be a single statement following this macro call, similar to "if" |
634 | // the iterator code must be a single statement following this macro call, similar to "if" |
608 | // "continue" will skip to the next space |
635 | // "continue" will skip to the next space |
609 | #define rect_mapwalk(rect,dx0,dy0) \ |
636 | #define rect_mapwalk(rect,dx0,dy0) \ |