Exemple #1
0
void
determine_map_edges()
{
  int i;
  int row, col;

  loop_province(i) {
    if (region(i) == faery_region ||
        region(i) == hades_region ||
        region(i) == cloud_region ||
        region(i) == tunnel_region || region(i) == nowhere_region)
      continue;

    row = region_row(i);
    col = region_col(i);

    if (row > max_map_row)
      max_map_row = row;

    if (col > max_map_col)
      max_map_col = col;
  }
  next_province;

  max_map_init = TRUE;
}
Exemple #2
0
void reflect_play_region_stop(int n)
{
  if (region_rows)
    {
      regrow *rg;
      rg = region_row(region_id_to_list_position(n));
      if (rg) set_toggle_button(rg->pl, false, false, (void *)rg);
    }
}
Exemple #3
0
static void highlight_region(void)
{
  if (current_region != -1)
    {
      regrow *oldr;
      oldr = region_row(current_region);
      gtk_widget_modify_bg(oldr->nm, GTK_STATE_NORMAL, ss->sgx->zoom_color);
      gtk_widget_modify_base(oldr->nm, GTK_STATE_NORMAL, ss->sgx->zoom_color);
      gtk_widget_modify_bg(oldr->rw, GTK_STATE_NORMAL, ss->sgx->zoom_color);
      gtk_widget_modify_base(oldr->rw, GTK_STATE_NORMAL, ss->sgx->zoom_color);
    }
}
Exemple #4
0
int
los_province_distance(int a, int b)
{
  int ra, rb, r1, r2;
  int ca, cb, c1, c2;
  int d1, d2;

  a = province(a);
  b = province(b);

  ra = region_row(a) - 1;
  rb = region_row(b) - 1;
  ca = region_col(a) - 1;
  cb = region_col(b) - 1;

  r1 = min(ra, rb);
  r2 = max(ra, rb);
  c1 = min(ca, cb);
  c2 = max(ca, cb);

  /* no wrap N-S */

  d1 = r2 - r1;
  if (d1 > (r1 + max_map_row) - r2)
    d1 = (r1 + max_map_row) - r2;

  d2 = c2 - c1;
  if (d2 > (c1 + max_map_col) - c2)
    d2 = (c1 + max_map_col) - c2;

#if 1
  return d1 + d2;               /* since there is no diagonal movement */
#else
  d1 *= d1;
  d2 *= d2;

  return my_sqrt(d1 + d2);
#endif
}
Exemple #5
0
void update_region_browser(bool grf_too)
{
  int i, len;
  region_state *rs;
  rs = region_report();
  len = rs->len;
  for (i = 0; i < len; i++) 
    {
      regrow *r;
      r = region_row(i);
      set_button_label(r->nm, rs->name[i]);
      set_toggle_button(r->pl, false, false, (void *)r);
      gtk_widget_show(r->rw);
    }
  for (i = len; i < max_regions(ss); i++) 
    if (region_rows[i])
      gtk_widget_hide(region_rows[i]->rw);
  free_region_state(rs);
  if (len == 0) return;
  gtk_widget_show(region_list);
  if (grf_too)
    {
      chan_info *cp;
      unhighlight_region();
      set_current_region(0);
      highlight_region();
      goto_window(region_rows[0]->nm);
      cp = rsp->chans[0];
      if (cp) 
	{
	  cp->sound = rsp;
	  cp->chan = 0;
	  set_sensitive(channel_f(cp), false);
	  set_sensitive(channel_w(cp), (region_chans(region_list_position_to_id(0)) > 1));
	  rsp->hdr = fixup_region_data(cp, 0, 0);
	  make_region_labels(rsp->hdr);
	  region_update_graph(cp);
	}
    }
}