… | |
… | |
16 | |
16 | |
17 | 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 |
18 | along with this program; if not, write to the Free Software |
18 | along with this program; if not, write to the Free Software |
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 | |
20 | |
21 | 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> |
22 | */ |
22 | */ |
23 | |
23 | |
24 | |
24 | |
25 | #include <global.h> |
25 | #include <global.h> |
26 | |
|
|
27 | #ifndef WIN32 /* ---win32 exclude header */ |
|
|
28 | # include <unistd.h> |
26 | #include <unistd.h> |
29 | #endif /* win32 */ |
|
|
30 | |
27 | |
31 | /* |
28 | /* |
32 | * 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. |
33 | * 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 |
34 | * with the 'fallback' property set. |
31 | * with the 'fallback' property set. |
… | |
… | |
60 | return NULL; |
57 | return NULL; |
61 | } |
58 | } |
62 | |
59 | |
63 | /* This might need optimising at some point. */ |
60 | /* This might need optimising at some point. */ |
64 | region * |
61 | region * |
65 | get_region_by_map (mapstruct *m) |
62 | get_region_by_map (maptile *m) |
66 | { |
63 | { |
67 | 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)); |
68 | } |
65 | } |
69 | |
66 | |
70 | /* |
67 | /* |
… | |
… | |
72 | * 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 |
73 | * the map code. |
70 | * the map code. |
74 | */ |
71 | */ |
75 | |
72 | |
76 | const char * |
73 | const char * |
77 | get_name_of_region_for_map (const mapstruct *m) |
74 | get_name_of_region_for_map (const maptile *m) |
78 | { |
75 | { |
79 | region *reg; |
76 | region *reg; |
80 | |
77 | |
81 | if (m->region != NULL) |
78 | if (m->region != NULL) |
82 | return m->region->name; |
79 | return m->region->name; |