Exemple #1
0
int CompareRestTime(Item Rest1, Item Rest2, int direction)
{
    int r=0;

    if (direction == 1)
    {
        if (GetRestTime((Rest*) Rest1) > GetRestTime((Rest*) Rest2))
            r = 1 ;
        else
            r = 0;
    }
    else if (direction == 2)
    {
        if (GetRestTime((Rest*) Rest1) > GetRestTime((Rest*) Rest2))
            r = 0 ;
        else
            r = 1;
    }
    return r;
}
Exemple #2
0
ListNode * HandleRest(ListNode * resthead, ParkingLot * parkinglot, int timeunit, FILE * outputfile)
{
      Rest * rest;
      ListNode * aux;
      int i=0;
      /*Get the head of the restricion list to the aux pointer for the first while comparation*/
      aux = resthead;

      if(aux == NULL)
        return NULL;

      /*Get the first restriction*/
      rest = (Rest*) getItemLinkedList(aux);

      while(aux != NULL && GetRestTime(rest) == timeunit)
      {
          if(GetRestFlag(rest) == 'p')
          {
            i = FindIP(GetVertices(parkinglot), GetRestCoord(rest, 'x'), GetRestCoord(rest, 'y'), GetRestCoord(rest, 'z'), GetDecoder(parkinglot) );

            if(GetIP_Flagres(i, GetDecoder(parkinglot) ) == 1)
             {
                 ReleasePos(i, GetDecoder(parkinglot) );
                 IncFreeSpots(parkinglot);
                if( GetFreeSpots(parkinglot) != 0)
                  HandleQueue(parkinglot, outputfile, timeunit);
              }
            else
            {
                RestrictPos(i, GetDecoder(parkinglot) );
                DecFreeSpots(parkinglot);
            }
          }
          else if(GetRestFlag(rest) == 'f')
          {
            if( IsFloorRestricted( GetRestCoord(rest, 'z'), parkinglot ) )
            {
            	ReleaseWholeFloor(i, parkinglot ); /* la dento temos de fazer bue release spots */
              if( GetFreeSpots(parkinglot) != 0)
           			HandleQueue(parkinglot, outputfile, timeunit);
            }
            else
              RestrictWholeFloor( GetRestCoord(rest, 'z'), parkinglot );
          }


        aux = getNextNodeLinkedList(aux);
        rest = (Rest*) getItemLinkedList(aux);
      }

      /*Return the new head of the linked list*/
      return aux;

}
void MyTask_InfoEffect::Draw() const{
	TCHAR str[INFOEFFECT_STRSIZE];
	float f;
	int w;
	int a = 255;
	SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 255);
	switch(typeID){
	case INFO_DAMAGENUM_ENEMY:
		a = PARAM(12*(GetLifeTime()-existTime));
		SetDrawBlendMode(DX_BLENDMODE_ALPHA, a);
		f = min(0, 0.4*existTime*(existTime-20));
		DrawNum(param, x, y+f,
			g_image.chars.num_damage_m,
			NUM_DAMAGE_M_WIDTH-8, 4, 1, false, false);
		break;
	case INFO_DAMAGENUM_ENEMY_STRONG:
		a = PARAM(12*(GetLifeTime()-existTime));
		SetDrawBlendMode(DX_BLENDMODE_ALPHA, a);
		f = min(0, 0.4*existTime*(existTime-20));
		DrawNum(param, x, y+f,
			g_image.chars.num_damage_l,
			NUM_DAMAGE_L_WIDTH-12, 4, 1, false, false);
		break;
	case INFO_DAMAGENUM_ENEMY_RESIST:
		a = PARAM(12*(GetLifeTime()-existTime));
		SetDrawBlendMode(DX_BLENDMODE_ALPHA, a);
		f = min(0, 0.4*existTime*(existTime-20));
		DrawNum(param, x, y+f,
			g_image.chars.num_damage_s,
			NUM_DAMAGE_S_WIDTH-8, 4, 1, false, false);
		break;
	case INFO_DAMAGENUM_DOLL:
		a = PARAM(12*(GetLifeTime()-existTime));
		SetDrawBlendMode(DX_BLENDMODE_ALPHA, a);
		f = min(0, 0.4*existTime*(existTime-20));
		DrawNum(param, x, y+f,
			g_image.chars.num_damage_m,
			NUM_DAMAGE_M_WIDTH-8, 4, 1, false, false);
		break;
	case INFO_DAMAGENUM_DOLL_STRONG:
		a = PARAM(12*(GetLifeTime()-existTime));
		SetDrawBlendMode(DX_BLENDMODE_ALPHA, a);
		f = min(0, 0.4*existTime*(existTime-20));
		DrawNum(param, x, y+f,
			g_image.chars.num_damage_l,
			NUM_DAMAGE_L_WIDTH-12, 4, 1, false, false);
		break;
	case INFO_DAMAGENUM_DOLL_RESIST:
		a = PARAM(12*(GetLifeTime()-existTime));
		SetDrawBlendMode(DX_BLENDMODE_ALPHA, a);
		f = min(0, 0.4*existTime*(existTime-20));
		DrawNum(param, x, y+f,
			g_image.chars.num_damage_s,
			NUM_DAMAGE_S_WIDTH-8, 4, 1, false, false);
		break;
	case INFO_LEVELUP:
		a = min(255, 16*GetRestTime());
		f = min(1.0, 0.2+0.06*GetExistTime());
		SetDrawBlendMode(DX_BLENDMODE_ALPHA, a);
		DrawRotaGraph(
			x, y-1.5*GetExistTime(), 
			f, 0, g_image.icon.levelup, 1, 0);
		SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 255);
		break;
	}
	SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 255);
}