--- deliantra/server/common/map.C 2010/04/18 05:54:18 1.189 +++ deliantra/server/common/map.C 2010/04/29 12:24:04 1.198 @@ -79,7 +79,7 @@ */ if (OUT_OF_REAL_MAP (m, sx, sy)) { - LOG (llevError, "blocked_link: Passed map, x, y coordinates outside of map\n"); + LOG (llevError | logBacktrace, "blocked_link: Passed map, x, y coordinates outside of map\n"); return 1; } @@ -92,7 +92,7 @@ * go further. Not true for players - all sorts of special * things we need to do for players. */ - if (ob->type != PLAYER && !(mflags & P_IS_ALIVE) && (blocked == 0)) + if (ob->type != PLAYER && !(mflags & P_IS_ALIVE) && blocked == 0) return 0; /* if there isn't anything alive on this space, and this space isn't @@ -561,20 +561,26 @@ print_shop_string (maptile *m) { static dynbuf_text buf; buf.clear (); + bool first = true; for (int i = 0; i < m->shopitems[0].index; i++) { + if (!first) + buf << ';'; + + first = false; + if (m->shopitems[i].typenum) { if (m->shopitems[i].strength) - buf.printf ("%s:%d;", m->shopitems[i].name, m->shopitems[i].strength); + buf.printf ("%s:%d", m->shopitems[i].name, m->shopitems[i].strength); else - buf.printf ("%s;", m->shopitems[i].name); + buf.printf ("%s", m->shopitems[i].name); } else { if (m->shopitems[i].strength) - buf.printf ("*:%d;", m->shopitems[i].strength); + buf.printf ("*:%d", m->shopitems[i].strength); else buf.printf ("*"); } @@ -640,7 +646,7 @@ case KW_no_reset: thawer.get (no_reset); break; case KW_no_drop: thawer.get (no_drop); break; - case KW_region: default_region = region::find (thawer.get_str ()); break; + case KW_region: thawer.get (default_region); break; case KW_shopitems: shopitems = parse_shop_string (thawer.get_str ()); break; // old names new names @@ -1431,11 +1437,11 @@ if (!adjacent_map (op1->map, op2->map, &retval->distance_x, &retval->distance_y)) { /* be conservative and fill in _some_ data */ - retval->distance = 10000; + retval->distance = 10000; retval->distance_x = 10000; retval->distance_y = 10000; - retval->direction = 0; - retval->part = 0; + retval->direction = 0; + retval->part = 0; } else { @@ -1447,7 +1453,7 @@ /* If this is multipart, find the closest part now */ if (!(flags & 1) && op1->more) { - int best_distance = retval->distance_x * retval->distance_x + retval->distance_y * retval->distance_y, tmpi; + int best_distance = idistance (retval->distance_x, retval->distance_y); /* we just take the offset of the piece to head to figure * distance instead of doing all that work above again @@ -1457,12 +1463,12 @@ */ for (object *tmp = op1->more; tmp; tmp = tmp->more) { - tmpi = (op1->x - tmp->x + retval->distance_x) * (op1->x - tmp->x + retval->distance_x) + - (op1->y - tmp->y + retval->distance_y) * (op1->y - tmp->y + retval->distance_y); + int tmpi = idistance (op1->x - tmp->x + retval->distance_x, op1->y - tmp->y + retval->distance_y); + if (tmpi < best_distance) { best_distance = tmpi; - best = tmp; + best = tmp; } } @@ -1473,9 +1479,9 @@ } } - retval->part = best; - retval->distance = upos_max (abs (retval->distance_x), abs (retval->distance_y)); - retval->direction = find_dir_2 (-retval->distance_x, -retval->distance_y); + retval->part = best; + retval->distance = upos_max (abs (retval->distance_x), abs (retval->distance_y)); + retval->direction = find_dir_2 (retval->distance_x, retval->distance_y); } } @@ -1495,20 +1501,20 @@ if (!adjacent_map (m, op2->map, &retval->distance_x, &retval->distance_y)) { /* be conservative and fill in _some_ data */ - retval->distance = 100000; + retval->distance = 100000; retval->distance_x = 32767; retval->distance_y = 32767; - retval->direction = 0; - retval->part = 0; + retval->direction = 0; + retval->part = 0; } else { retval->distance_x += op2->x - x; retval->distance_y += op2->y - y; - retval->part = 0; - retval->distance = upos_max (abs (retval->distance_x), abs (retval->distance_y)); - retval->direction = find_dir_2 (-retval->distance_x, -retval->distance_y); + retval->part = 0; + retval->distance = upos_max (abs (retval->distance_x), abs (retval->distance_y)); + retval->direction = find_dir_2 (retval->distance_x, retval->distance_y); } }