Author: sveinung
Date: Wed Jun 29 08:18:28 2016
New Revision: 33105

URL: http://svn.gna.org/viewcvs/freeciv?rev=33105&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:
    branches/S2_6/common/actions.c
    branches/S2_6/common/actions.h
    branches/S2_6/common/fc_types.h

Modified: branches/S2_6/common/actions.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/actions.c?rev=33105&r1=33104&r2=33105&view=diff
==============================================================================
--- branches/S2_6/common/actions.c      (original)
+++ branches/S2_6/common/actions.c      Wed Jun 29 08:18:28 2016
@@ -971,7 +971,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% */
@@ -1053,7 +1053,7 @@
   } unit_list_iterate_end;
 
   /* No diplomatic battle will occur. */
-  return 200;
+  return ACTPROB_CERTAIN;
 }
 
 /**************************************************************************
@@ -1149,7 +1149,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? */
@@ -1169,18 +1169,18 @@
     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_COUNT:
     fc_assert(FALSE);
@@ -1299,6 +1299,14 @@
 action_probability action_prob_new_impossible(void)
 {
   return 0;
+}
+
+/**************************************************************************
+  Returns the certain action probability.
+**************************************************************************/
+action_probability action_prob_new_certain(void)
+{
+  return 200;
 }
 
 /**************************************************************************

Modified: branches/S2_6/common/actions.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/actions.h?rev=33105&r1=33104&r2=33105&view=diff
==============================================================================
--- branches/S2_6/common/actions.h      (original)
+++ branches/S2_6/common/actions.h      Wed Jun 29 08:18:28 2016
@@ -188,10 +188,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: branches/S2_6/common/fc_types.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/fc_types.h?rev=33105&r1=33104&r2=33105&view=diff
==============================================================================
--- branches/S2_6/common/fc_types.h     (original)
+++ branches/S2_6/common/fc_types.h     Wed Jun 29 08:18:28 2016
@@ -716,6 +716,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