SAIL - Sprawdzanie czy cel jest osiągalny

Gotowe kody SAIL'a, informacje na temat moddingu, itd.

Модератор: zoNE

Ответить
Аватара пользователя
zoNE
The Great Uniter & Site Administrator
The Great Uniter & Site Administrator
Сообщения: 2061
Зарегистрирован: Пт фев 17, 2006 3:44 pm
Откуда: Poland
Контактная информация:

SAIL - Sprawdzanie czy cel jest osiągalny

Сообщение zoNE »

Serpent писал(а): Вс сен 03, 2017 10:34 pm Napisałem kodzik który sprawdza czy cel jest osiągalny. Jeśli tak to jednostka podąża w podane miejsce i funkcja zwraca TRUE, w przeciwnym razie funkcja zwraca FALSE.

Код: Выделить всё

//Destination Reachable Function by Serpent
Export unreachableList;
On DestinationUnreachable(unit) Do
begin
if not unit in unreachableList then
   unreachableList := Insert(unreachableList, unreachableList+1, unit);
end;

Export Function DestinationReachable(unit, x, y);
begin
if unit in unreachableList then
  unreachableList := unreachableList diff unit;

   ComMoveXY(unit, x, y);

   Wait(1);

if unit in unreachableList then
   result := false
    else
     result := true;
End;
Author: Serpent
Topic: https://forum.original-war.net/viewtopi ... =42&t=5633
Ответить