Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2002:
[Freeciv-Dev] RFC: Unifying mapview parameters
Home

[Freeciv-Dev] RFC: Unifying mapview parameters

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Freeciv List <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] RFC: Unifying mapview parameters
From: Jason Short <vze2zq63@xxxxxxxxxxx>
Date: Tue, 15 Jan 2002 23:11:04 -0500
Reply-to: jdorje@xxxxxxxxxxxx

Each different GUI has its own parameters for the mapview, but they are almost identical.

GTK:
  map_view_x0, map_view_y0 => window origin (in mapview.h)
  map_canvas_store_twidth, map_canvas_store_theight =>
    window width and height in tiles (in gui_main.h)
  mapview window pixel dimensions are determined on-demand

XAW:
  (same as GTK)

WIN32:
  map_view_x, map_view_y => window origin
  map_win_width, map_win_height: window pixel dimensions
  mapview window tile dimensions are determined on-demand (I think)

MUI:
  map_view_x0, map_view_y0 => window origin
  everything else is determined on-demand

I propose that these be unified into one common set of values in mapview_common.[ch]. This will allow further unification of the mapview code (including center_tile_mapcanvas, get_map_xy, get_canvas_xy, get_center_tile_mapcanvas, tile_visible_and_not_on_border_mapcanvas, tile_visible_mapcanvas, show_city_descriptions, and update_map_canvas_visible for starters, update_map_canvas and others with a little more work), make cross-GUI programming a lot easier (no more need for everyone to think about these differences :-), and make the code (very insigificantly) faster.

I also propose that they take the form of a struct:

  struct mapview_window {
    int origin_x, origin_y;
    int pixel_width, pixel_height;
    int tile_width, tile_height;
  } mapview;

although this could just as easily be 6 separate values.

There are really 5 parts to this conversion process:
  - Introduce the struct into mapview_common.[ch]
  - Change GUI-specific code for each GUI to use the new structure.
I can provide patches for each of these steps, but the GUI authors should verify and apply them (at least for MUI and WIN32, which I cannot test).

jason



[Prev in Thread] Current Thread [Next in Thread]