1 | |
|
|
2 | /* |
|
|
3 | * static char *rcsid_map_c = |
|
|
4 | * "$Id: region.C,v 1.4 2006/09/10 16:00:23 root Exp $"; |
|
|
5 | */ |
|
|
6 | |
|
|
7 | /* |
1 | /* |
8 | CrossFire, A Multiplayer game for X-windows |
2 | CrossFire, A Multiplayer game for X-windows |
9 | |
3 | |
10 | Copyright (C) 2001-2003 Mark Wedel & Crossfire Development Team |
4 | Copyright (C) 2001-2003 Mark Wedel & Crossfire Development Team |
11 | Copyright (C) 1992 Frank Tore Johansen |
5 | Copyright (C) 1992 Frank Tore Johansen |
… | |
… | |
22 | |
16 | |
23 | You should have received a copy of the GNU General Public License |
17 | You should have received a copy of the GNU General Public License |
24 | along with this program; if not, write to the Free Software |
18 | along with this program; if not, write to the Free Software |
25 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
26 | |
20 | |
27 | The authors can be reached via e-mail at crossfire-devel@real-time.com |
21 | The authors can be reached via e-mail at <crossfire@schmorp.de> |
28 | */ |
22 | */ |
29 | |
23 | |
30 | |
24 | |
31 | #include <global.h> |
25 | #include <global.h> |
32 | |
|
|
33 | #ifndef WIN32 /* ---win32 exclude header */ |
|
|
34 | # include <unistd.h> |
26 | #include <unistd.h> |
35 | #endif /* win32 */ |
|
|
36 | |
27 | |
37 | /* |
28 | /* |
38 | * Pass a char array, returns a pointer to the region of the same name. |
29 | * Pass a char array, returns a pointer to the region of the same name. |
39 | * if it can't find a region of the same name it returns the first region |
30 | * if it can't find a region of the same name it returns the first region |
40 | * with the 'fallback' property set. |
31 | * with the 'fallback' property set. |
… | |
… | |
66 | return NULL; |
57 | return NULL; |
67 | } |
58 | } |
68 | |
59 | |
69 | /* This might need optimising at some point. */ |
60 | /* This might need optimising at some point. */ |
70 | region * |
61 | region * |
71 | get_region_by_map (mapstruct *m) |
62 | get_region_by_map (maptile *m) |
72 | { |
63 | { |
73 | return get_region_by_name (get_name_of_region_for_map (m)); |
64 | return get_region_by_name (get_name_of_region_for_map (m)); |
74 | } |
65 | } |
75 | |
66 | |
76 | /* |
67 | /* |
… | |
… | |
78 | * explicit check that it is, this is much nicer here than scattered throughout |
69 | * explicit check that it is, this is much nicer here than scattered throughout |
79 | * the map code. |
70 | * the map code. |
80 | */ |
71 | */ |
81 | |
72 | |
82 | const char * |
73 | const char * |
83 | get_name_of_region_for_map (const mapstruct *m) |
74 | get_name_of_region_for_map (const maptile *m) |
84 | { |
75 | { |
85 | region *reg; |
76 | region *reg; |
86 | |
77 | |
87 | if (m->region != NULL) |
78 | if (m->region != NULL) |
88 | return m->region->name; |
79 | return m->region->name; |
… | |
… | |
243 | reg = get_region_by_map (op->map); |
234 | reg = get_region_by_map (op->map); |
244 | while (reg != NULL) |
235 | while (reg != NULL) |
245 | { |
236 | { |
246 | if (reg->jailmap) |
237 | if (reg->jailmap) |
247 | { |
238 | { |
248 | exit = get_object (); |
239 | exit = object::create (); |
249 | EXIT_PATH (exit) = reg->jailmap; |
240 | EXIT_PATH (exit) = reg->jailmap; |
250 | /* damned exits reset savebed and remove teleports, so the prisoner can't escape */ |
241 | /* damned exits reset savebed and remove teleports, so the prisoner can't escape */ |
251 | SET_FLAG (exit, FLAG_DAMNED); |
242 | SET_FLAG (exit, FLAG_DAMNED); |
252 | EXIT_X (exit) = reg->jailx; |
243 | EXIT_X (exit) = reg->jailx; |
253 | EXIT_Y (exit) = reg->jaily; |
244 | EXIT_Y (exit) = reg->jaily; |