Author: sveinung
Date: Wed Jun 29 07:45:02 2016
New Revision: 33103

URL: http://svn.gna.org/viewcvs/freeciv?rev=33103&view=rev
Log:
actprob: replace magic number for 100% certainty.

The action probability for 100% certainty is now called ACTPROB_CERTAIN.

See patch #7338

Modified:
    trunk/common/actions.c
    trunk/common/actions.h
    trunk/common/fc_types.h

Modified: trunk/common/actions.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/actions.c?rev=33103&r1=33102&r2=33103&view=diff
==============================================================================
--- trunk/common/actions.c      (original)
+++ trunk/common/actions.c      Wed Jun 29 07:45:02 2016
@@ -2133,7 +2133,7 @@
   if (unit_has_type_flag(pattacker, UTYF_SUPERSPY)) {
     /* An attacking UTYF_SUPERSPY will defeat every possible defender
      * except another UTYF_SUPERSPY. */
-    return 200;
+    return ACTPROB_CERTAIN;
   }
 
   /* Base chance is 50% */
@@ -2216,7 +2216,7 @@
   } unit_list_iterate_end;
 
   /* No diplomatic battle will occur. */
-  return 200;
+  return ACTPROB_CERTAIN;
 }
 
 /**************************************************************************
@@ -2322,7 +2322,7 @@
     /* TODO */
     break;
   case ACTION_ESTABLISH_EMBASSY:
-    chance = 200;
+    chance = ACTPROB_CERTAIN;
     break;
   case ACTION_SPY_STEAL_TECH:
     /* Do the victim have anything worth taking? */
@@ -2342,38 +2342,38 @@
     break;
   case ACTION_SPY_INVESTIGATE_CITY:
     /* There is no risk that the city won't get investigated. */
-    chance = 200;
+    chance = ACTPROB_CERTAIN;
     break;
   case ACTION_TRADE_ROUTE:
     /* TODO */
     break;
   case ACTION_MARKETPLACE:
     /* Possible when not blocked by is_action_possible() */
-    chance = 200;
+    chance = ACTPROB_CERTAIN;
     break;
   case ACTION_HELP_WONDER:
     /* Possible when not blocked by is_action_possible() */
-    chance = 200;
+    chance = ACTPROB_CERTAIN;
     break;
   case ACTION_CAPTURE_UNITS:
     /* No battle is fought first. */
-    chance = 200;
+    chance = ACTPROB_CERTAIN;
     break;
   case ACTION_EXPEL_UNIT:
     /* No battle is fought first. */
-    chance = 200;
+    chance = ACTPROB_CERTAIN;
     break;
   case ACTION_BOMBARD:
     /* No battle is fought first. */
-    chance = 200;
+    chance = ACTPROB_CERTAIN;
     break;
   case ACTION_FOUND_CITY:
     /* Possible when not blocked by is_action_possible() */
-    chance = 200;
+    chance = ACTPROB_CERTAIN;
     break;
   case ACTION_JOIN_CITY:
     /* Possible when not blocked by is_action_possible() */
-    chance = 200;
+    chance = ACTPROB_CERTAIN;
     break;
   case ACTION_SPY_NUKE:
     /* TODO */
@@ -2383,23 +2383,23 @@
     break;
   case ACTION_DESTROY_CITY:
     /* No battle is fought first. */
-    chance = 200;
+    chance = ACTPROB_CERTAIN;
     break;
   case ACTION_RECYCLE_UNIT:
     /* No battle is fought first. */
-    chance = 200;
+    chance = ACTPROB_CERTAIN;
     break;
   case ACTION_DISBAND_UNIT:
     /* No battle is fought first. */
-    chance = 200;
+    chance = ACTPROB_CERTAIN;
     break;
   case ACTION_HOME_CITY:
     /* No battle is fought first. */
-    chance = 200;
+    chance = ACTPROB_CERTAIN;
     break;
   case ACTION_UPGRADE_UNIT:
     /* No battle is fought first. */
-    chance = 200;
+    chance = ACTPROB_CERTAIN;
     break;
   case ACTION_PARADROP:
     /* TODO */
@@ -2578,7 +2578,7 @@
     return ACTPROB_IMPOSSIBLE;
   }
 
-  prob_all = 200;
+  prob_all = ACTPROB_CERTAIN;
   unit_list_iterate(target_tile->units, target_unit) {
     action_probability prob_unit;
 
@@ -2724,6 +2724,14 @@
 }
 
 /**************************************************************************
+  Returns the certain action probability.
+**************************************************************************/
+action_probability action_prob_new_certain(void)
+{
+  return 200;
+}
+
+/**************************************************************************
   Returns the n/a action probability.
 **************************************************************************/
 action_probability action_prob_new_not_relevant(void)

Modified: trunk/common/actions.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/actions.h?rev=33103&r1=33102&r2=33103&view=diff
==============================================================================
--- trunk/common/actions.h      (original)
+++ trunk/common/actions.h      Wed Jun 29 07:45:02 2016
@@ -379,10 +379,12 @@
 action_probability action_prob_new_not_relevant(void);
 action_probability action_prob_new_not_impl(void);
 action_probability action_prob_new_unknown(void);
+action_probability action_prob_new_certain(void);
 
 /* Special action probability values. Documented in fc_types.h's
  * definition of action_probability. */
 #define ACTPROB_IMPOSSIBLE action_prob_new_impossible()
+#define ACTPROB_CERTAIN action_prob_new_certain()
 #define ACTPROB_NA action_prob_new_not_relevant()
 #define ACTPROB_NOT_IMPLEMENTED action_prob_new_not_impl()
 #define ACTPROB_NOT_KNOWN action_prob_new_unknown()

Modified: trunk/common/fc_types.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/fc_types.h?rev=33103&r1=33102&r2=33103&view=diff
==============================================================================
--- trunk/common/fc_types.h     (original)
+++ trunk/common/fc_types.h     Wed Jun 29 07:45:02 2016
@@ -762,6 +762,9 @@
  * 0   ACTPROB_IMPOSSIBLE is another way of saying that the probability
  *     is 0%. It isn't really a special value since it is in range.
  *
+ * 200 ACTPROB_CERTAIN is another way of saying that the probability
+ *     is 100%. It isn't really a special value since it is in range.
+ *
  * 253 ACTPROB_NA indicates that no probability should exist.
  *
  * 254 ACTPROB_NOT_IMPLEMENTED indicates that support for finding this


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

Reply via email to