Author: cazfi
Date: Mon May  2 06:42:28 2016
New Revision: 32540

URL: http://svn.gna.org/viewcvs/freeciv?rev=32540&view=rev
Log:
Removed map_exists() macro and use !map_is_empty() instead.

See patch #7131

Modified:
    trunk/client/climap.h
    trunk/client/gui-gtk-2.0/mapctrl.c
    trunk/client/gui-gtk-2.0/mapview.c
    trunk/client/gui-gtk-3.0/mapctrl.c
    trunk/client/gui-gtk-3.0/mapview.c
    trunk/client/gui-gtk-3.x/mapctrl.c
    trunk/client/gui-gtk-3.x/mapview.c
    trunk/client/mapview_common.c
    trunk/common/map.c

Modified: trunk/client/climap.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/climap.h?rev=32540&r1=32539&r2=32540&view=diff
==============================================================================
--- trunk/client/climap.h       (original)
+++ trunk/client/climap.h       Mon May  2 06:42:28 2016
@@ -1,4 +1,4 @@
-/********************************************************************** 
+/***********************************************************************
  Freeciv - Copyright (C) 2002 - The Freeciv Project
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -18,10 +18,9 @@
 extern "C" {
 #endif /* __cplusplus */
 
+/* common */
 #include "fc_types.h"           /* enum direction8, struct tile */
 #include "tile.h"               /* enum known_type */
-
-#define map_exists() (game.map.tiles != NULL)
 
 enum known_type client_tile_get_known(const struct tile *ptile);
 

Modified: trunk/client/gui-gtk-2.0/mapctrl.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-2.0/mapctrl.c?rev=32540&r1=32539&r2=32540&view=diff
==============================================================================
--- trunk/client/gui-gtk-2.0/mapctrl.c  (original)
+++ trunk/client/gui-gtk-2.0/mapctrl.c  Mon May  2 06:42:28 2016
@@ -1,4 +1,4 @@
-/********************************************************************** 
+/***********************************************************************
  Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -428,7 +428,7 @@
    * the map canvas, for instance, it gets called any time the mouse is
    * clicked. */
   gdk_window_get_pointer(map_canvas->window, &canvas_x, &canvas_y, NULL);
-  if (map_exists()
+  if (!map_is_empty()
       && canvas_x >= 0 && canvas_y >= 0
       && canvas_x < mapview.width && canvas_y < mapview.height) {
     control_mouse_cursor(canvas_pos_to_tile(canvas_x, canvas_y));

Modified: trunk/client/gui-gtk-2.0/mapview.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-2.0/mapview.c?rev=32540&r1=32539&r2=32540&view=diff
==============================================================================
--- trunk/client/gui-gtk-2.0/mapview.c  (original)
+++ trunk/client/gui-gtk-2.0/mapview.c  Mon May  2 06:42:28 2016
@@ -1,4 +1,4 @@
-/********************************************************************** 
+/***********************************************************************
  Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -382,7 +382,7 @@
 **************************************************************************/
 gboolean map_canvas_expose(GtkWidget *w, GdkEventExpose *ev, gpointer data)
 {
-  if (can_client_change_view() && map_exists() && !mapview_is_frozen()) {
+  if (can_client_change_view() && !map_is_empty() && !mapview_is_frozen()) {
     /* First we mark the area to be updated as dirty.  Then we unqueue
      * any pending updates, to make sure only the most up-to-date data
      * is written (otherwise drawing bugs happen when old data is copied

Modified: trunk/client/gui-gtk-3.0/mapctrl.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.0/mapctrl.c?rev=32540&r1=32539&r2=32540&view=diff
==============================================================================
--- trunk/client/gui-gtk-3.0/mapctrl.c  (original)
+++ trunk/client/gui-gtk-3.0/mapctrl.c  Mon May  2 06:42:28 2016
@@ -1,4 +1,4 @@
-/********************************************************************** 
+/***********************************************************************
  Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -445,7 +445,7 @@
   /* Bizarrely, this function can be called even when we don't "leave"
    * the map canvas, for instance, it gets called any time the mouse is
    * clicked. */
-  if (map_exists()
+  if (!map_is_empty()
       && event->x >= 0 && event->y >= 0
       && event->x < mapview.width && event->y < mapview.height) {
     control_mouse_cursor(canvas_pos_to_tile(event->x, event->y));

Modified: trunk/client/gui-gtk-3.0/mapview.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.0/mapview.c?rev=32540&r1=32539&r2=32540&view=diff
==============================================================================
--- trunk/client/gui-gtk-3.0/mapview.c  (original)
+++ trunk/client/gui-gtk-3.0/mapview.c  Mon May  2 06:42:28 2016
@@ -402,7 +402,7 @@
 **************************************************************************/
 gboolean map_canvas_draw(GtkWidget *w, cairo_t *cr, gpointer data)
 {
-  if (can_client_change_view() && map_exists() && !mapview_is_frozen()) {
+  if (can_client_change_view() && !map_is_empty() && !mapview_is_frozen()) {
     /* First we mark the area to be updated as dirty.  Then we unqueue
      * any pending updates, to make sure only the most up-to-date data
      * is written (otherwise drawing bugs happen when old data is copied

Modified: trunk/client/gui-gtk-3.x/mapctrl.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.x/mapctrl.c?rev=32540&r1=32539&r2=32540&view=diff
==============================================================================
--- trunk/client/gui-gtk-3.x/mapctrl.c  (original)
+++ trunk/client/gui-gtk-3.x/mapctrl.c  Mon May  2 06:42:28 2016
@@ -1,4 +1,4 @@
-/********************************************************************** 
+/***********************************************************************
  Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -445,7 +445,7 @@
   /* Bizarrely, this function can be called even when we don't "leave"
    * the map canvas, for instance, it gets called any time the mouse is
    * clicked. */
-  if (map_exists()
+  if (!map_is_empty()
       && event->x >= 0 && event->y >= 0
       && event->x < mapview.width && event->y < mapview.height) {
     control_mouse_cursor(canvas_pos_to_tile(event->x, event->y));

Modified: trunk/client/gui-gtk-3.x/mapview.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.x/mapview.c?rev=32540&r1=32539&r2=32540&view=diff
==============================================================================
--- trunk/client/gui-gtk-3.x/mapview.c  (original)
+++ trunk/client/gui-gtk-3.x/mapview.c  Mon May  2 06:42:28 2016
@@ -397,7 +397,7 @@
 **************************************************************************/
 gboolean map_canvas_draw(GtkWidget *w, cairo_t *cr, gpointer data)
 {
-  if (can_client_change_view() && map_exists() && !mapview_is_frozen()) {
+  if (can_client_change_view() && !map_is_empty() && !mapview_is_frozen()) {
     /* First we mark the area to be updated as dirty.  Then we unqueue
      * any pending updates, to make sure only the most up-to-date data
      * is written (otherwise drawing bugs happen when old data is copied

Modified: trunk/client/mapview_common.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/mapview_common.c?rev=32540&r1=32539&r2=32540&view=diff
==============================================================================
--- trunk/client/mapview_common.c       (original)
+++ trunk/client/mapview_common.c       Mon May  2 06:42:28 2016
@@ -2622,7 +2622,7 @@
     tile_updates[i] = NULL;
   }
 
-  if (map_exists()) {
+  if (!map_is_empty()) {
     if ((needed_updates & UPDATE_MAP_CANVAS_VISIBLE)
        || (needed_updates & UPDATE_CITY_DESCRIPTIONS)
         || (needed_updates & UPDATE_TILE_LABELS)) {
@@ -3132,7 +3132,7 @@
     canvas_set_zoom(mapview.tmp_store, map_zoom);
   }
 
-  if (map_exists() && can_client_change_view()) {
+  if (!map_is_empty() && can_client_change_view()) {
     if (tile_size_changed) {
       if (center_tile != NULL) {
         int x0, y0;

Modified: trunk/common/map.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/map.c?rev=32540&r1=32539&r2=32540&view=diff
==============================================================================
--- trunk/common/map.c  (original)
+++ trunk/common/map.c  Mon May  2 06:42:28 2016
@@ -139,14 +139,14 @@
 }
 
 /***************************************************************
-  Returns 1 if we are at a stage of the game where the map
+  Returns TRUE if we are at a stage of the game where the map
   has not yet been generated/loaded.
-  (To be precise, returns 1 if map_allocate() has not yet been
+  (To be precise, returns TRUE if map_allocate() has not yet been
   called.)
 ***************************************************************/
 bool map_is_empty(void)
 {
-  return !game.map.tiles;
+  return game.map.tiles == NULL;
 }
 
 /***************************************************************


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to