SAIL - Sprawdzanie czy cel jest osiągalny

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

Moderator: zoNE

Post Reply
User avatar
zoNE
The Great Uniter & Site Administrator
The Great Uniter & Site Administrator
Posts: 2059
Joined: Fri Feb 17, 2006 3:44 pm
Location: Poland
Contact:

SAIL - Sprawdzanie czy cel jest osiągalny

Post by zoNE »

Serpent wrote: Sun Sep 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.

Code: Select all

//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
Post Reply