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

Comparing deliantra/server/common/region.C (file contents):
Revision 1.10 by root, Wed Dec 13 02:55:50 2006 UTC vs.
Revision 1.12 by root, Sat Dec 30 10:16:10 2006 UTC

75{ 75{
76 region *reg; 76 region *reg;
77 77
78 if (m->region != NULL) 78 if (m->region != NULL)
79 return m->region->name; 79 return m->region->name;
80
80 for (reg = first_region; reg != NULL; reg = reg->next) 81 for (reg = first_region; reg != NULL; reg = reg->next)
81 { 82 {
82 if (reg->fallback) 83 if (reg->fallback)
83 return reg->name; 84 return reg->name;
84 } 85 }
86
85 LOG (llevInfo, "map %s had no region and I couldn't find a fallback to use.\n", m->name); 87 LOG (llevInfo, "map %s had no region and I couldn't find a fallback to use.\n", &m->name);
86 return "unknown"; 88 return "unknown";
87} 89}
88 90
89/* 91/*
90 * Tries to find a region that 'name' corresponds to. 92 * Tries to find a region that 'name' corresponds to.
345 */ 347 */
346 if (!strcmp (key, "region")) 348 if (!strcmp (key, "region"))
347 { 349 {
348 *end = 0; 350 *end = 0;
349 newreg = get_region_struct (); 351 newreg = get_region_struct ();
350 newreg->name = strdup_local (value); 352 newreg->name = strdup (value);
351 } 353 }
352 else if (!strcmp (key, "parent")) 354 else if (!strcmp (key, "parent"))
353 { 355 {
354 /* 356 /*
355 * Note that this is in the initialisation code, so we don't actually 357 * Note that this is in the initialisation code, so we don't actually
356 * assign the pointer to the parent yet, because it might not have been 358 * assign the pointer to the parent yet, because it might not have been
357 * parsed. 359 * parsed.
358 */ 360 */
359 *end = 0; 361 *end = 0;
360 newreg->parent_name = strdup_local (value); 362 newreg->parent_name = strdup (value);
361 } 363 }
362 else if (!strcmp (key, "longname")) 364 else if (!strcmp (key, "longname"))
363 { 365 {
364 *end = 0; 366 *end = 0;
365 newreg->longname = strdup_local (value); 367 newreg->longname = strdup (value);
366 } 368 }
367 else if (!strcmp (key, "jail")) 369 else if (!strcmp (key, "jail"))
368 { 370 {
369 /* jail entries are of the form: /path/to/map x y */ 371 /* jail entries are of the form: /path/to/map x y */
370 char path[MAX_BUF]; 372 char path[MAX_BUF];
373 if (sscanf (value, "%[^ ] %d %d\n", path, &x, &y) != 3) 375 if (sscanf (value, "%[^ ] %d %d\n", path, &x, &y) != 3)
374 { 376 {
375 LOG (llevError, "region.c: malformated regions entry: jail %s\n", value); 377 LOG (llevError, "region.c: malformated regions entry: jail %s\n", value);
376 continue; 378 continue;
377 } 379 }
378 newreg->jailmap = strdup_local (path); 380 newreg->jailmap = strdup (path);
379 newreg->jailx = x; 381 newreg->jailx = x;
380 newreg->jaily = y; 382 newreg->jaily = y;
381 } 383 }
382 else if (!strcmp (key, "msg")) 384 else if (!strcmp (key, "msg"))
383 { 385 {
395 * There may be regions with empty messages (eg, msg/endmsg 397 * There may be regions with empty messages (eg, msg/endmsg
396 * with nothing between). When maps are loaded, this is done 398 * with nothing between). When maps are loaded, this is done
397 * so better do it here too... 399 * so better do it here too...
398 */ 400 */
399 if (msgpos != 0) 401 if (msgpos != 0)
400 newreg->msg = strdup_local (msgbuf); 402 newreg->msg = strdup (msgbuf);
401 403
402 /* we have to reset msgpos, or the next region will store both msg blocks. */ 404 /* we have to reset msgpos, or the next region will store both msg blocks. */
403 msgpos = 0; 405 msgpos = 0;
404 } 406 }
405 else if (!strcmp (key, "fallback")) 407 else if (!strcmp (key, "fallback"))

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines