--- deliantra/server/server/player.C 2007/08/23 15:20:33 1.161 +++ deliantra/server/server/player.C 2007/08/23 17:13:04 1.162 @@ -3168,14 +3168,13 @@ * a pile (say a coin under a table would return "viewable" * by this routine). Another question, should we be * concerned with the direction the player is looking - * in? Realistically, most of use cant see stuff behind + * in? Realistically, most of us can't see stuff behind * our backs...on the other hand, does the "facing" direction - * imply the way your head, or body is facing? Its possible + * imply the way your head, or body is facing? It's possible * for them to differ. Sigh, this fctn could get a bit more complex. * -b.t. * This function is now map tiling safe. */ - int player_can_view (object *pl, object *op) { @@ -3197,7 +3196,7 @@ /* starting with the 'head' part, lets loop * through the object and find if it has any - * part that is in the los array but isnt on + * part that is in the los array but isn't on * a blocked los square. * we use the archetype to figure out offsets. */ @@ -3210,12 +3209,14 @@ * code, so we need to restrict ourselves to that range of values * for any meaningful values. */ - if (FABS (dx) <= (pl->contr->ns->mapx / 2) && - FABS (dy) <= (pl->contr->ns->mapy / 2) && + if (abs (dx) <= (pl->contr->ns->mapx / 2) && + abs (dy) <= (pl->contr->ns->mapy / 2) && !pl->contr->blocked_los[dx + (pl->contr->ns->mapx / 2)][dy + (pl->contr->ns->mapy / 2)]) return 1; + op = op->more; } + return 0; } @@ -3228,7 +3229,6 @@ int action_makes_visible (object *op) { - if (op->invisible && QUERY_FLAG (op, FLAG_ALIVE)) { if (QUERY_FLAG (op, FLAG_MAKE_INVIS)) @@ -3244,6 +3244,7 @@ return 1; } } + return 0; } @@ -3258,42 +3259,44 @@ int op_on_battleground (object *op, int *x, int *y) { - object *tmp; - /* A battleground-tile needs the following attributes to be valid: * is_floor 1 (has to be the FIRST floor beneath the player's feet), * name="battleground", no_pick 1, type=58 (type BATTLEGROUND) * and the exit-coordinates sp/hp must both be > 0. * => The intention here is to prevent abuse of the battleground- * feature (like pickable or hidden battleground tiles). */ - for (tmp = op->below; tmp != NULL; tmp = tmp->below) + for (object *tmp = op->below; tmp; tmp = tmp->below) { if (QUERY_FLAG (tmp, FLAG_IS_FLOOR)) { - if (QUERY_FLAG (tmp, FLAG_NO_PICK) && - strcmp (tmp->name, "battleground") == 0 && tmp->type == BATTLEGROUND && EXIT_X (tmp) && EXIT_Y (tmp)) + if (QUERY_FLAG (tmp, FLAG_NO_PICK) + && tmp->type == BATTLEGROUND + && tmp->name == shstr_battleground + && EXIT_X (tmp) && EXIT_Y (tmp)) { - /*before we assign the exit, check if this is a teambattle */ + /* before we assign the exit, check if this is a teambattle */ if (EXIT_ALT_X (tmp) && EXIT_ALT_Y (tmp) && EXIT_PATH (tmp)) { - object *invtmp; - - for (invtmp = op->inv; invtmp != NULL; invtmp = invtmp->below) + for (object *invtmp = op->inv; invtmp; invtmp = invtmp->below) { - if (invtmp->type == FORCE && invtmp->slaying && !strcmp (EXIT_PATH (tmp), invtmp->slaying)) + if (invtmp->type == FORCE && invtmp->slaying && tmp->slaying == invtmp->slaying) { - if (x != NULL && y != NULL) + if (x && y) *x = EXIT_ALT_X (tmp), *y = EXIT_ALT_Y (tmp); + return 1; } } } - if (x != NULL && y != NULL) + + if (x && y) *x = EXIT_X (tmp), *y = EXIT_Y (tmp); + return 1; } } } + /* If we got here, did not find a battleground */ return 0; }