[Freeciv-Dev] GUI PATCH: refresh_tile_mapcanvas cleanup
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
The function refresh_tile_mapcanvas() is absolutely identical in every
GUI.
So, in the process of cleaning up the map_adjust_[xy] calls I moved it
into common client code. Two problems:
- There is no client/mapview.[ch], where it should properly go, so I put
it into client/climisc.[ch].
- I can only test the correctness of the GTK client. All others should
work so long as the #includes and such are set up correctly, but who
knows?
In summary, all of the GUI authors will need to sign off on such a patch
for it to go through.
jason ? rc
Index: client/climisc.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/climisc.c,v
retrieving revision 1.62
diff -u -r1.62 climisc.c
--- client/climisc.c 2001/10/04 19:36:54 1.62
+++ client/climisc.c 2001/10/10 15:46:22
@@ -828,3 +828,19 @@
}
return cids_used;
}
+
+/**************************************************************************
+ GUI Independent (with new access functions). However, this should go
+ in client/mapview.c instead of client/climisc.c.
+**************************************************************************/
+void refresh_tile_mapcanvas(int x, int y, int write_to_screen)
+{
+ assert(is_real_tile(x, y));
+ if (!normalize_map_pos(&x, &y))
+ return;
+
+ if (tile_visible_mapcanvas(x, y)) {
+ update_map_canvas(x,y, 1, 1, write_to_screen);
+ }
+ overview_update_tile(x, y);
+}
Index: client/climisc.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/climisc.h,v
retrieving revision 1.23
diff -u -r1.23 climisc.h
--- client/climisc.h 2001/09/19 18:48:46 1.23
+++ client/climisc.h 2001/10/10 15:46:22
@@ -77,5 +77,8 @@
int collect_cids2(cid * dest_cids);
int collect_cids3(cid * dest_cids);
+/* This should be moved into client/mapview.c. */
+void refresh_tile_mapcanvas(int x, int y, int write_to_screen);
+
#endif /* FC__CLIMISC_H */
Index: client/gui-gtk/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/mapview.c,v
retrieving revision 1.103
diff -u -r1.103 mapview.c
--- client/gui-gtk/mapview.c 2001/10/05 09:47:41 1.103
+++ client/gui-gtk/mapview.c 2001/10/10 15:46:23
@@ -640,21 +640,6 @@
/**************************************************************************
...
**************************************************************************/
-void refresh_tile_mapcanvas(int x, int y, int write_to_screen)
-{
- x = map_adjust_x(x);
- y = map_adjust_y(y);
-
- if (tile_visible_mapcanvas(x, y)) {
- update_map_canvas(x, y, 1, 1, write_to_screen);
- }
- overview_update_tile(x, y);
-}
-
-
-/**************************************************************************
-...
-**************************************************************************/
int tile_visible_mapcanvas(int x, int y)
{
if (is_isometric) {
Index: client/gui-mui/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-mui/mapview.c,v
retrieving revision 1.32
diff -u -r1.32 mapview.c
--- client/gui-mui/mapview.c 2001/09/15 21:25:08 1.32
+++ client/gui-mui/mapview.c 2001/10/10 15:46:24
@@ -371,21 +371,6 @@
set(main_government_sprite, MUIA_Sprite_Sprite, gov_sprite);
}
-/**************************************************************************
- GUI Independ (with new access functions)
-**************************************************************************/
-void refresh_tile_mapcanvas(int x, int y, int write_to_screen)
-{
- x = map_adjust_x(x);
- y = map_adjust_y(y);
-
- if (tile_visible_mapcanvas(x, y))
- {
- update_map_canvas(x,y, 1, 1, write_to_screen);
- }
- overview_update_tile(x, y);
-}
-
/**************************************************************************
Finds the pixel coordinates of a tile.
Index: client/gui-stub/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-stub/mapview.c,v
retrieving revision 1.7
diff -u -r1.7 mapview.c
--- client/gui-stub/mapview.c 2001/02/10 20:43:39 1.7
+++ client/gui-stub/mapview.c 2001/10/10 15:46:24
@@ -153,12 +153,6 @@
/* PORTME */
}
-void
-refresh_tile_mapcanvas(int x, int y, int write_to_screen)
-{
- /* PORTME */
-}
-
void draw_segment(int src_x, int src_y, int dir)
{
/* PORTME */
Index: client/gui-win32/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/mapview.c,v
retrieving revision 1.5
diff -u -r1.5 mapview.c
--- client/gui-win32/mapview.c 2001/09/23 16:09:37 1.5
+++ client/gui-win32/mapview.c 2001/10/10 15:46:25
@@ -1210,21 +1210,6 @@
/**************************************************************************
**************************************************************************/
-void
-refresh_tile_mapcanvas(int x, int y, int write_to_screen)
-{
- x=map_adjust_x(x);
- y=map_adjust_y(y);
-
- if(tile_visible_mapcanvas(x, y)) {
- update_map_canvas(x,y, 1, 1, write_to_screen);
- }
- overview_update_tile(x, y);
-}
-
-/**************************************************************************
-
-**************************************************************************/
void map_handle_hscroll(int pos)
{
if (get_client_state()!=CLIENT_GAME_RUNNING_STATE)
Index: client/gui-xaw/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/mapview.c,v
retrieving revision 1.83
diff -u -r1.83 mapview.c
--- client/gui-xaw/mapview.c 2001/10/04 20:23:34 1.83
+++ client/gui-xaw/mapview.c 2001/10/10 15:46:26
@@ -390,20 +390,6 @@
/**************************************************************************
...
**************************************************************************/
-void refresh_tile_mapcanvas(int x, int y, int write_to_screen)
-{
- x=map_adjust_x(x);
- y=map_adjust_y(y);
-
- if(tile_visible_mapcanvas(x, y)) {
- update_map_canvas(x, y, 1, 1, write_to_screen);
- }
- overview_update_tile(x, y);
-}
-
-/**************************************************************************
-...
-**************************************************************************/
int tile_visible_mapcanvas(int x, int y)
{
return (y>=map_view_y0 && y<map_view_y0+map_canvas_store_theight &&
Index: client/include/mapview_g.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/include/mapview_g.h,v
retrieving revision 1.15
diff -u -r1.15 mapview_g.h
--- client/include/mapview_g.h 2001/02/04 13:45:21 1.15
+++ client/include/mapview_g.h 2001/10/10 15:46:26
@@ -47,7 +47,6 @@
void refresh_overview_canvas(void);
void refresh_overview_viewrect(void);
-void refresh_tile_mapcanvas(int x, int y, int write_to_screen);
void draw_segment(int src_x, int src_y, int dir);
void undraw_segment(int src_x, int src_y, int dir);
|
|