--- deliantra/server/common/region.C 2006/09/13 23:39:27 1.5 +++ deliantra/server/common/region.C 2007/01/02 23:39:21 1.14 @@ -18,15 +18,12 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - The authors can be reached via e-mail at crossfire-devel@real-time.com + The authors can be reached via e-mail at */ #include - -#ifndef WIN32 /* ---win32 exclude header */ -# include -#endif /* win32 */ +#include /* * Pass a char array, returns a pointer to the region of the same name. @@ -62,7 +59,7 @@ /* This might need optimising at some point. */ region * -get_region_by_map (mapstruct *m) +get_region_by_map (maptile *m) { return get_region_by_name (get_name_of_region_for_map (m)); } @@ -74,18 +71,20 @@ */ const char * -get_name_of_region_for_map (const mapstruct *m) +get_name_of_region_for_map (const maptile *m) { region *reg; - if (m->region != NULL) + if (m->region) return m->region->name; + for (reg = first_region; reg != NULL; reg = reg->next) { if (reg->fallback) return reg->name; } - LOG (llevInfo, "map %s had no region and I couldn't find a fallback to use.\n", m->name); + + LOG (llevInfo, "map %s had no region and I couldn't find a fallback to use.\n", &m->name); return "unknown"; } @@ -239,7 +238,7 @@ { if (reg->jailmap) { - exit = get_object (); + exit = object::create (); EXIT_PATH (exit) = reg->jailmap; /* damned exits reset savebed and remove teleports, so the prisoner can't escape */ SET_FLAG (exit, FLAG_DAMNED); @@ -293,16 +292,7 @@ region * get_region_struct (void) { - - region *reg; - - reg = (region *) CALLOC (1, sizeof (region)); - if (reg == NULL) - fatal (OUT_OF_MEMORY); - - memset (reg, '\0', sizeof (region)); - - return reg; + return new region; } /* @@ -359,7 +349,7 @@ { *end = 0; newreg = get_region_struct (); - newreg->name = strdup_local (value); + newreg->name = strdup (value); } else if (!strcmp (key, "parent")) { @@ -369,12 +359,12 @@ * parsed. */ *end = 0; - newreg->parent_name = strdup_local (value); + newreg->parent_name = strdup (value); } else if (!strcmp (key, "longname")) { *end = 0; - newreg->longname = strdup_local (value); + newreg->longname = strdup (value); } else if (!strcmp (key, "jail")) { @@ -387,7 +377,7 @@ LOG (llevError, "region.c: malformated regions entry: jail %s\n", value); continue; } - newreg->jailmap = strdup_local (path); + newreg->jailmap = strdup (path); newreg->jailx = x; newreg->jaily = y; } @@ -409,7 +399,7 @@ * so better do it here too... */ if (msgpos != 0) - newreg->msg = strdup_local (msgbuf); + newreg->msg = strdup (msgbuf); /* we have to reset msgpos, or the next region will store both msg blocks. */ msgpos = 0; @@ -461,5 +451,5 @@ } region_count++; } - LOG (llevDebug, "Assigned %u regions with %u parents.", region_count, parent_count); + LOG (llevDebug, "Assigned %u regions with %u parents.\n", region_count, parent_count); }