Author: cazfi
Date: Thu Sep 10 21:25:26 2015
New Revision: 29854

URL: http://svn.gna.org/viewcvs/freeciv?rev=29854&view=rev
Log:
Do not call is_valid_dir() with invalid direction when unit sprite facing 
random direction
is requested.

See bug #23863

Modified:
    branches/S2_5/client/tilespec.c
    branches/S2_5/common/map.c

Modified: branches/S2_5/client/tilespec.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/tilespec.c?rev=29854&r1=29853&r2=29854&view=diff
==============================================================================
--- branches/S2_5/client/tilespec.c     (original)
+++ branches/S2_5/client/tilespec.c     Thu Sep 10 21:25:26 2015
@@ -5415,7 +5415,7 @@
 
   fc_assert_ret_val(NULL != punittype, NULL);
 
-  if (!is_valid_dir(facing)) {
+  if (!direction8_is_valid(facing) || !is_valid_dir(facing)) {
     /* Fallback to using random orientation sprite. */
     facing = rand_direction();
   }

Modified: branches/S2_5/common/map.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/common/map.c?rev=29854&r1=29853&r2=29854&view=diff
==============================================================================
--- branches/S2_5/common/map.c  (original)
+++ branches/S2_5/common/map.c  Thu Sep 10 21:25:26 2015
@@ -1239,7 +1239,7 @@
 **************************************************************************/
 bool is_valid_dir(enum direction8 dir)
 {
-  fc_assert_ret_val(dir >= 0 && dir < 8, FALSE);
+  fc_assert_ret_val(direction8_is_valid(dir), FALSE);
 
   return dir_validity[dir];
 }
@@ -1279,7 +1279,7 @@
 **************************************************************************/
 bool is_cardinal_dir(enum direction8 dir)
 {
-  fc_assert_ret_val(dir >= 0 && dir < 8, FALSE);
+  fc_assert_ret_val(direction8_is_valid(dir), FALSE);
 
   return dir_cardinality[dir];
 }


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

Reply via email to