… | |
… | |
502 | * map is the map that changed, x and y are the coordinates. |
502 | * map is the map that changed, x and y are the coordinates. |
503 | */ |
503 | */ |
504 | void |
504 | void |
505 | update_all_los (const maptile *map, int x, int y) |
505 | update_all_los (const maptile *map, int x, int y) |
506 | { |
506 | { |
|
|
507 | // no need to do anything if we don't have darkness |
|
|
508 | if (map->darklevel () <= 0) |
|
|
509 | return; |
|
|
510 | |
507 | map->at (x, y).invalidate (); |
511 | map->at (x, y).invalidate (); |
508 | |
512 | |
509 | for_all_players (pl) |
513 | for_all_players (pl) |
510 | { |
514 | { |
511 | /* Player should not have a null map, but do this |
515 | /* Player should not have a null map, but do this |
… | |
… | |
522 | * player can't be on another map that may be closer, |
526 | * player can't be on another map that may be closer, |
523 | * so by setting it up this way, we trim processing |
527 | * so by setting it up this way, we trim processing |
524 | * some. |
528 | * some. |
525 | */ |
529 | */ |
526 | if (pl->ob->map == map) |
530 | if (pl->ob->map == map) |
527 | { |
|
|
528 | if ((abs (pl->ob->x - x) <= pl->ns->mapx / 2) && (abs (pl->ob->y - y) <= pl->ns->mapy / 2)) |
531 | if ((abs (pl->ob->x - x) <= pl->ns->mapx / 2) && (abs (pl->ob->y - y) <= pl->ns->mapy / 2)) |
529 | pl->do_los = 1; |
532 | pl->do_los = 1; |
530 | } |
|
|
531 | |
533 | |
532 | /* Now we check to see if player is on adjacent |
534 | /* Now we check to see if player is on adjacent |
533 | * maps to the one that changed and also within |
535 | * maps to the one that changed and also within |
534 | * view. The tile_maps[] could be null, but in that |
536 | * view. The tile_maps[] could be null, but in that |
535 | * case it should never match the pl->ob->map, so |
537 | * case it should never match the pl->ob->map, so |