#include "maps\compaign_birth.lgc"
#include "maps\monsters.lgc"

CompaignGameTact()
{
  int i,no_monster,dir;
  if( OneTimeInSecond() )
  {
    if( Flagman(0) && GetVidData(179,VID_COUNT)==0 )//если не осталось мест для закладки динамита
    {
      no_monster = 0;
      for( i = 0; i < sizeof(MonstersVid)/4; i++ )
        no_monster += GetVidData(MonstersVid[i],VID_COUNT1);
      if( no_monster > 0 && no_monster < 5 )
      {
        if( !ArrowHint )
          ArrowHint = CreateSprite(786,GetX(Flagman(0)),GetY(Flagman(0)),GetZ(Flagman(0)));
      }
      else if( ArrowHint )
      {
        Destroy(ArrowHint);
        ArrowHint = 0;
      }
      iff( !no_monster )
        Win();
    }
  }
  if( ArrowHint )
    for( i = FirstUnit(U_UNIT); i; i = NextUnit() )
      if( Action(i,ACT_GET_ARMY)==1 && 
         ( (GetUnitVid(i)>=40 && GetUnitVid(i)<=96) || (GetUnitVid(i)>=850 && GetUnitVid(i)<=866) ) )
      {
        dir = DirectionTo(Flagman(0),GetX(i),GetY(i));
        Action(ArrowHint,ACT_CHANGE_DIRECTION,dir);
//        Action(ArrowHint,ACT_CHANGE_COOR,GetX(Flagman(0)),GetY(Flagman(0)),GetZ(Flagman(0))+11);
        Action(ArrowHint,ACT_CHANGE_COOR,GetX(Flagman(0))+Sin(dir)/25,GetY(Flagman(0))-Cos(dir)/25,GetZ(Flagman(0)));
        break;
      }
}
