Author: cazfi
Date: Thu Sep 10 21:25:19 2015
New Revision: 29853

URL: http://svn.gna.org/viewcvs/freeciv?rev=29853&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_6/client/tilespec.c
    branches/S2_6/common/map.c

Modified: branches/S2_6/client/tilespec.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/tilespec.c?rev=29853&r1=29852&r2=29853&view=diff
==============================================================================
--- branches/S2_6/client/tilespec.c     (original)
+++ branches/S2_6/client/tilespec.c     Thu Sep 10 21:25:19 2015
@@ -5761,7 +5761,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_6/common/map.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/map.c?rev=29853&r1=29852&r2=29853&view=diff
==============================================================================
--- branches/S2_6/common/map.c  (original)
+++ branches/S2_6/common/map.c  Thu Sep 10 21:25:19 2015
@@ -1206,7 +1206,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];
 }
@@ -1246,7 +1246,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