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

F1420_10(int unit)
{
    iff( SizeTo(Flagman(0), GetX(unit),GetY(unit)) < 80 )
    {
        Win();
        WinTime = 1;
//      Win();
    }
}

static int ExitSprite = 0;
static int NextDinamit = 0;

CompaignGameTact()
{
/*  int i,no_monster,dir;
  if( OneTimeInSecond() )
  {
    if ( !ExitSprite )
        ExitSprite = FindNearestSprite(GETSPRITE_VID_FLAG + 1420, 0, 0, 20000);
    if ( GetAnimation(ExitSprite) == ANI_STAND_OPEN && gbState_Bar )
        if ( GetUnitVid(MenuFind(4, 1)) != 6 )
        {
            MenuAction(4, 1, ACT_CHANGE_VID, 6);
            if ( GetString("Levels", "Level"+itoa(LevelNumber)) != ""  )
            {
                string text;
                text = GetString("Levels", "Success");
                MenuAction(4, 1, ACT_SET_TEXT, &text);
                MenuAction(960, 0, ANI_STAND_OPEN);
            }
        }
    if ( GetVidData(179, VID_COUNT) )// если еще есть неуничтоженные шахты
    {
        NextDinamit = FindNearestSprite(GETSPRITE_VID_FLAG + 179, GetX(Flagman(0)), GetY(Flagman(0)), 20000);
        //if ( Flagman(0) && !ArrowHint && LevelNumber != 1 )//LevelNumber для демы
        //  ArrowHint = CreateSprite(786,GetX(Flagman(0)),GetY(Flagman(0)),GetZ(Flagman(0)));
    }
    if ( ExitSprite && GetAnimation(ExitSprite) == ANI_STAND_OPEN )
    {
      if ( ArrowHint )
        Action(ArrowHint, ACT_CHANGE_VID, 789);
      else
        ArrowHint = CreateSprite(789,GetX(Flagman(0)),GetY(Flagman(0)),GetZ(Flagman(0)));
    }
    else 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( no_monster == 0 && ArrowHint && GetUnitVid(ArrowHint) == 786 )
      {
        Destroy(ArrowHint);
        ArrowHint = 0;
      }
      iff( !no_monster && LevelNumber == 5 )
          Action(ExitSprite, ANI_STAND_OPEN);*
//      int unit;
//      unit = FindNearestSprite(GETSPRITE_VID_FLAG + 1420, 0, 0, 15000);
//      iff( GetAnimation(unit) == ANI_STAND_OPEN && SizeTo(Flagman(0), GetX(unit),GetY(unit)) < 70 )
//      {
//          Win();
//          WinTime = 1;
//      }
    }
  }*/
/*  if ( ArrowHint )
  {
    int unit;
    unit = 0;
    if ( GetUnitVid(ArrowHint) == 789 )
    {
        if ( GetAnimation(ExitSprite) == ANI_STAND_OPEN )
            unit = ExitSprite;
    }
    else if ( GetVidData(179, VID_COUNT) )
    {// если еще есть неуничтоженные шахты
        if ( !PlayerExplosive )
            unit = FindNearestSprite(GETSPRITE_VID_FLAG + 301, GetX(Flagman(0)), GetY(Flagman(0)), 20000);
        else
            unit = NextDinamit;
    }
    else
    {
        for ( i = FirstUnit(U_UNIT); i; i = NextUnit() )
          if ( Action(i,ACT_GET_ARMY)==1 &&                                                  //zmnew! 2004Aug27
             ( (GetUnitVid(i)>=40 && GetUnitVid(i)<=96) || (GetUnitVid(i)>=850 && GetUnitVid(i)<=890) || GetUnitVid(i) == 1550 )  )//866
          {
            unit = i;    
            break;
          }
    }
    if ( unit )
    {
        dir = DirectionTo(Flagman(0),GetX(unit),GetY(unit));
        Action(ArrowHint,ACT_CHANGE_DIRECTION,dir);
        Action(ArrowHint,ACT_CHANGE_COOR,GetX(Flagman(0))+Sin(dir)/25,GetY(Flagman(0))-Cos(dir)/25 + 20,GetZ(Flagman(0)) + 20);
    }
  }*/
}
