Author: cazfi
Date: Mon Apr 20 02:58:44 2015
New Revision: 28820

URL: http://svn.gna.org/viewcvs/freeciv?rev=28820&view=rev
Log:
Fixed warnings from gcc-5 and cppcheck

- Fixed a bug in sdl-clients' where array was referenced via pointer after it 
was out-of-scope
- Cleaned out extra "not" from comparisons of boolean effect values

Patch by Per I. Mathisen <per> and myself

See patch #5994

Modified:
    branches/S2_5/client/gui-sdl/graphics.c
    branches/S2_5/common/city.c
    branches/S2_5/common/improvement.c
    branches/S2_5/common/unittype.c

Modified: branches/S2_5/client/gui-sdl/graphics.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-sdl/graphics.c?rev=28820&r1=28819&r2=28820&view=diff
==============================================================================
--- branches/S2_5/client/gui-sdl/graphics.c     (original)
+++ branches/S2_5/client/gui-sdl/graphics.c     Mon Apr 20 02:58:44 2015
@@ -392,6 +392,7 @@
                                   SDL_Color * pColor, bool add_alpha)
 {
   SDL_Surface *pNew;
+  SDL_Color color = {255, 255, 255, 128};
 
   if (add_alpha) {
     pNew = create_surf_alpha(w, h, iFlags);
@@ -405,7 +406,6 @@
 
   if (!pColor) {
     /* pColor->unused == ALPHA */
-    SDL_Color color ={255, 255, 255, 128};
     pColor = &color;
   }
 

Modified: branches/S2_5/common/city.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/common/city.c?rev=28820&r1=28819&r2=28820&view=diff
==============================================================================
--- branches/S2_5/common/city.c (original)
+++ branches/S2_5/common/city.c Mon Apr 20 02:58:44 2015
@@ -1965,7 +1965,7 @@
 {
   int tithes_bonus = 0;
 
-  if (!get_city_bonus(pcity, EFT_HAPPINESS_TO_GOLD) > 0) {
+  if (get_city_bonus(pcity, EFT_HAPPINESS_TO_GOLD) <= 0) {
     return 0;
   }
 

Modified: branches/S2_5/common/improvement.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/common/improvement.c?rev=28820&r1=28819&r2=28820&view=diff
==============================================================================
--- branches/S2_5/common/improvement.c  (original)
+++ branches/S2_5/common/improvement.c  Mon Apr 20 02:58:44 2015
@@ -426,7 +426,7 @@
     }
   }
   if (space_part &&
-      (!get_player_bonus(p, EFT_ENABLE_SPACE) > 0
+      (get_player_bonus(p, EFT_ENABLE_SPACE) <= 0
        || p->spaceship.state >= SSHIP_LAUNCHED)) {
     return FALSE;
   }

Modified: branches/S2_5/common/unittype.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/common/unittype.c?rev=28820&r1=28819&r2=28820&view=diff
==============================================================================
--- branches/S2_5/common/unittype.c     (original)
+++ branches/S2_5/common/unittype.c     Mon Apr 20 02:58:44 2015
@@ -637,7 +637,7 @@
   }
 
   if (utype_has_flag(punittype, UTYF_NUCLEAR)
-      && !get_player_bonus(p, EFT_ENABLE_NUKE) > 0) {
+      && get_player_bonus(p, EFT_ENABLE_NUKE) <= 0) {
     return FALSE;
   }
   if (utype_has_flag(punittype, UTYF_NOBUILD)) {


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

Reply via email to