/* Code snippet graveyard */

/* Supports the V-Wing 1.91 palette */
char vwing_format(Uint8 col) {
  if(col==0||col==1) return TER_FREE;
  if(col==16) return TER_WATER;
  if(col==17) return TER_WATERFD;
  if(col==18) return TER_WATERFR;
  if(col==19) return TER_WATERFL;
  if(col>19&&col<=30) return TER_FREE;
  if(col==39) return TER_SNOW;
  if(col>=40&&col<=42) return TER_EXPLOSIVE2;
  if(col==43&&col==45) return TER_EXPLOSIVE;
  if(col==49) return  TER_GROUND; /* Clay */
  if(col==50) return TER_BASE;
  if(col==51) return TER_GROUND; /* Ash */
  if(col==52) return TER_SNOW;
  if(col>=57&&col<=150) return TER_GROUND;
  if(col>=151&&col<=175) return TER_COMBUSTABLE;
  if(col>=176&&col<=199) return  TER_COMBUSTABL2;
  if(col==200) return TER_INDESTRUCT;
  if(col==201||col==202) return TER_UNDERWATER;
  if(col==203) return TER_ICE;
  if(col>=204&&col<=219) return TER_UNDERWATER;
  if(col>=220&&col<=243) return TER_INDESTRUCT;
  if(col>=248&&col<=256) return TER_INDESTRUCT;
  return TER_GROUND;
}

/* Supports the Wings 1.40 palette according to colors.txt.
 *
 * Entries marked with NOT are not currently supported by luola,
 * the nearest suitable terrain type is chosen for them.
 */
char wings_format(Uint8 col)
{
  if (col == 0) return TER_FREE;                /* Background */
  if (col >= 1 && col <= 31) return TER_GROUND; /* Reserved */
  if (col >= 32 && col <= 37) return TER_BASE;  /* Normal base */
  if (col >= 38 && col <= 39)return TER_BASE;   /* Indesctructible base(NOT) */
  if (col >= 40 && col <= 41)return TER_BASE;   /* Team 1 base (NOT) */
  if (col >= 42 && col <= 43) return TER_BASE;  /* Team 2 base (NOT) */
  if (col >= 44 && col <= 45) return TER_BASE;  /* Team 3 base (NOT) */
  if (col >= 46 && col <= 47) return TER_BASE;  /* Team 4 base (NOT) */
  if (col == 48) return TER_WATER;      /* Plain water */
  if (col == 49) return TER_WATERFD;    /* Water flowing down */
  if (col == 50) return TER_WATERFL;    /* Water flowing up */
  if (col == 51) return TER_WATERFR;    /* Water flowing right */
  if (col == 52) return TER_WATER;      /* Bubbles (INCOMPATIBLE) */
  if (col == 53) return TER_SNOW;       /* Snow */
  if (col >= 55 && col <= 56) return TER_EXPLOSIVE;  /* Explosive */
  if (col >= 57 && col <= 63) return TER_GROUND;     /* For future additions */
  if (col >= 64 && col <= 79) return TER_FREE;       /* Background */
  if (col >= 80 && col <= 95) return TER_INDESTRUCT; /* Indestructibe ground */
  if (col >= 96 && col <= 111) return TER_GROUND;    /* Soft ground (NOT)*/
  if (col >= 112 && col <= 127) return TER_COMBUSTABLE; /* Burning ground */
  if (col >= 128 && col <= 255) return TER_GROUND;      /* Ordinary ground */
  return TER_GROUND;
}
