Esempio n. 1
0
bool	graph_pic(void *data)
{
  t_list *players;
  t_list *pdata;
  t_fds *client;
  char *to_send;
  int i;

  i = 0;
  client = (t_fds *)data;
  if (asprintf(&to_send, "pic %d %d %d",
	       player_data->x, player_data->y,
	       player_data->level + 1) == -1)
    return (false);
  players = get_box_players(player_data->x, player_data->y);
  while ((pdata = get_data_at(players, i)) && ++i)
    if (asprintf(&to_send, "%s %d", to_send, ((t_player *)pdata)->id) == -1)
      return (false);
  printf("%s", to_send);
  sends_all(to_send);
  free(to_send);
  return (true);
}
Esempio n. 2
0
short
RasterBuffer::get_interpolated(unsigned lx, unsigned ly,
                               unsigned ix, unsigned iy) const
{
  assert(defined());
  assert(lx < get_width());
  assert(ly < get_height());
  assert(ix < 0x100);
  assert(iy < 0x100);

  // perform piecewise linear interpolation
  const unsigned int dx = (lx == get_width() - 1) ? 0 : 1;
  const unsigned int dy = (ly == get_height() - 1) ? 0 : get_width();
  const short *tm = get_data_at(lx, ly);

  if (is_special(*tm) || is_special(tm[dx]) ||
      is_special(tm[dy]) || is_special(tm[dx + dy]))
    return *tm;

  unsigned kx = 0x100 - ix;
  unsigned ky = 0x100 - iy;

  return (*tm * kx * ky + tm[dx] * ix * ky + tm[dy] * kx * iy + tm[dx + dy] * ix * iy) >> 16;
}
Esempio n. 3
0
 gcc_pure
 short get(unsigned x, unsigned y) const {
   return *get_data_at(x, y);
 }
Esempio n. 4
0
struct Transaction *GetTransactionByPosition(int position)
{
    return (struct Transaction *)get_data_at(TransactionManager.transactions, position);
}