Author: sveinung
Date: Sat Oct  8 20:37:53 2016
New Revision: 34059

URL: http://svn.gna.org/viewcvs/freeciv?rev=34059&view=rev
Log:
Make names of action rule name getters similar.

Rename action_get_rule_name() to action_id_rule_name(). Move the header
declaration of action_rule_name() next to it.

See patch #7788

Modified:
    trunk/common/actions.c
    trunk/common/actions.h
    trunk/common/scriptcore/api_game_methods.c
    trunk/server/rssanity.c
    trunk/server/unithand.c

Modified: trunk/common/actions.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/actions.c?rev=34059&r1=34058&r2=34059&view=diff
==============================================================================
--- trunk/common/actions.c      (original)
+++ trunk/common/actions.c      Sat Oct  8 20:37:53 2016
@@ -534,7 +534,7 @@
 const char *action_rule_name(const struct action *action)
 {
   /* Rule name is still hard coded. */
-  return action_get_rule_name(action->id);
+  return action_id_rule_name(action->id);
 }
 
 /**************************************************************************
@@ -550,7 +550,7 @@
 /**************************************************************************
   Get the rule name of the action.
 **************************************************************************/
-const char *action_get_rule_name(int action_id)
+const char *action_id_rule_name(int action_id)
 {
   fc_assert_msg(actions[action_id], "Action %d don't exist.", action_id);
 
@@ -723,7 +723,7 @@
 
   fc_assert_msg(AAK_UNIT == action_id_get_actor_kind(action_id),
                 "Action %s isn't performed by a unit",
-                action_get_rule_name(action_id));
+                action_id_rule_name(action_id));
 
   return action_id + L_LAST;
 }

Modified: trunk/common/actions.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/actions.h?rev=34059&r1=34058&r2=34059&view=diff
==============================================================================
--- trunk/common/actions.h      (original)
+++ trunk/common/actions.h      Sat Oct  8 20:37:53 2016
@@ -316,7 +316,6 @@
   action_get_target_kind(action_by_number(action_id))
 
 int action_number(const struct action *action);
-const char *action_rule_name(const struct action *action);
 
 const char *action_name_translation(const struct action *action);
 
@@ -344,7 +343,8 @@
 
 int action_get_role(int action_id);
 
-const char *action_get_rule_name(int action_id);
+const char *action_rule_name(const struct action *action);
+const char *action_id_rule_name(int action_id);
 const char *action_get_ui_name(int action_id);
 const char *action_get_ui_name_mnemonic(int action_id,
                                         const char* mnemonic);

Modified: trunk/common/scriptcore/api_game_methods.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/scriptcore/api_game_methods.c?rev=34059&r1=34058&r2=34059&view=diff
==============================================================================
--- trunk/common/scriptcore/api_game_methods.c  (original)
+++ trunk/common/scriptcore/api_game_methods.c  Sat Oct  8 20:37:53 2016
@@ -643,7 +643,7 @@
   LUASCRIPT_CHECK_STATE(L, NULL);
   LUASCRIPT_CHECK_SELF(L, pact, NULL);
 
-  return action_get_rule_name(pact->id);
+  return action_id_rule_name(pact->id);
 }
 
 /*****************************************************************************

Modified: trunk/server/rssanity.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/rssanity.c?rev=34059&r1=34058&r2=34059&view=diff
==============================================================================
--- trunk/server/rssanity.c     (original)
+++ trunk/server/rssanity.c     Sat Oct  8 20:37:53 2016
@@ -921,14 +921,14 @@
 
     if (paction->min_distance < 0) {
       ruleset_error(LOG_ERROR, "Action %s: negative min distance (%d).",
-                    action_get_rule_name(act), paction->min_distance);
+                    action_id_rule_name(act), paction->min_distance);
       ok = FALSE;
     }
 
     if (paction->min_distance > ACTION_DISTANCE_LAST_NON_SIGNAL) {
       ruleset_error(LOG_ERROR, "Action %s: min distance (%d) larger than "
                                "any distance on a map can be (%d).",
-                    action_get_rule_name(act), paction->min_distance,
+                    action_id_rule_name(act), paction->min_distance,
                     ACTION_DISTANCE_LAST_NON_SIGNAL);
       ok = FALSE;
     }
@@ -936,14 +936,14 @@
     if (paction->max_distance > ACTION_DISTANCE_MAX) {
       ruleset_error(LOG_ERROR, "Action %s: max distance is %d. "
                     "A map can't be that big.",
-                    action_get_rule_name(act), paction->max_distance);
+                    action_id_rule_name(act), paction->max_distance);
       ok = FALSE;
     }
 
     if (!action_distance_inside_max(paction, paction->min_distance)) {
       ruleset_error(LOG_ERROR,
                     "Action %s: min distance is %d but max distance is %d.",
-                    action_get_rule_name(act),
+                    action_id_rule_name(act),
                     paction->min_distance, paction->max_distance);
       ok = FALSE;
     }
@@ -957,8 +957,8 @@
          * unit) */
         ruleset_error(LOG_ERROR,
                       "The action %s can't block %s.",
-                      action_get_rule_name(blocker),
-                      action_get_rule_name(act));
+                      action_id_rule_name(blocker),
+                      action_id_rule_name(act));
         ok = FALSE;
       }
     } action_iterate_end;
@@ -970,7 +970,7 @@
                                    "Action Enabler Target Reqs")) {
         ruleset_error(LOG_ERROR,
                       "Action enabler for %s has conflicting or invalid "
-                      "requirements!", action_get_rule_name(act));
+                      "requirements!", action_id_rule_name(act));
         ok = FALSE;
       }
 
@@ -983,8 +983,8 @@
           ruleset_error(LOG_ERROR,
                         "An action enabler for %s has a target "
                         "requirement vector. %s doesn't have a target.",
-                        action_get_rule_name(act),
-                        action_get_rule_name(act));
+                        action_id_rule_name(act),
+                        action_id_rule_name(act));
           ok = FALSE;
         }
       }
@@ -1000,7 +1000,7 @@
                         "requirement %s in target_reqs! Please read the "
                         "section \"Requirement vector rules\" in "
                         "doc/README.actions",
-                        action_get_rule_name(act),
+                        action_id_rule_name(act),
                         req_to_fstring(preq));
           ok = FALSE;
         }
@@ -1037,7 +1037,7 @@
           ruleset_error(LOG_ERROR,
                         "All action enablers for %s must require a "
                         "foreign target.",
-                        action_get_rule_name(act));
+                        action_id_rule_name(act));
           ok = FALSE;
         }
       }
@@ -1060,7 +1060,7 @@
           ruleset_error(LOG_ERROR,
                         "All action enablers for %s must require a "
                         "target the actor is at war with.",
-                        action_get_rule_name(act));
+                        action_id_rule_name(act));
           ok = FALSE;
         }
       }
@@ -1077,7 +1077,7 @@
           ruleset_error(LOG_ERROR,
                         "All action enablers for %s must require a "
                         "domestic target.",
-                        action_get_rule_name(act));
+                        action_id_rule_name(act));
           ok = FALSE;
         }
       }
@@ -1095,7 +1095,7 @@
           ruleset_error(LOG_ERROR,
                         "All action enablers for %s must require that "
                         "the actor doesn't have the NoHome utype flag.",
-                        action_get_rule_name(act));
+                        action_id_rule_name(act));
           ok = FALSE;
         }
       }
@@ -1114,7 +1114,7 @@
           ruleset_error(LOG_ERROR,
                         "All action enablers for %s must require that "
                         "the actor doesn't have the NonMil utype flag.",
-                        action_get_rule_name(act));
+                        action_id_rule_name(act));
           ok = FALSE;
         }
       }
@@ -1131,7 +1131,7 @@
           ruleset_error(LOG_ERROR,
                         "All action enablers for %s must require that "
                         "the actor has the CanOccupyCity uclass flag.",
-                        action_get_rule_name(act));
+                        action_id_rule_name(act));
           ok = FALSE;
         }
       }
@@ -1149,7 +1149,7 @@
           ruleset_error(LOG_ERROR,
                         "All action enablers for %s must require that "
                         "the actor is at war with the target.",
-                        action_get_rule_name(act));
+                        action_id_rule_name(act));
           ok = FALSE;
         }
       }
@@ -1166,7 +1166,7 @@
           ruleset_error(LOG_ERROR,
                         "All action enablers for %s must require that "
                         "the actor has a movement point left.",
-                        action_get_rule_name(act));
+                        action_id_rule_name(act));
           ok = FALSE;
         }
       }
@@ -1197,7 +1197,7 @@
           ruleset_error(LOG_ERROR,
                         "All action enablers for %s must require that "
                         "the target city is empty.",
-                        action_get_rule_name(act));
+                        action_id_rule_name(act));
           ok = FALSE;
         }
       }
@@ -1217,7 +1217,7 @@
           ruleset_error(LOG_ERROR,
                         "All action enablers for %s must require that "
                         "the actor isn't transporting another unit.",
-                        action_get_rule_name(act));
+                        action_id_rule_name(act));
           ok = FALSE;
         }
       }
@@ -1392,8 +1392,8 @@
 
       if (!action_id_would_be_blocked_by(blocked, blocker)) {
         log_verbose("Autoblocking %s with %s",
-                    action_get_rule_name(blocked),
-                    action_get_rule_name(blocker));
+                    action_id_rule_name(blocked),
+                    action_id_rule_name(blocker));
         BV_SET(action_by_number(blocked)->blocked_by, blocker);
       }
     }

Modified: trunk/server/unithand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/unithand.c?rev=34059&r1=34058&r2=34059&view=diff
==============================================================================
--- trunk/server/unithand.c     (original)
+++ trunk/server/unithand.c     Sat Oct  8 20:37:53 2016
@@ -4744,7 +4744,7 @@
         /* Actor must be on the target tile. */
         log_error("handle_unit_orders() can't do %s to a neighbor tile. "
                   "Sent in order number %d from %s to unit number %d.",
-                  action_get_rule_name(packet->action[i]), i,
+                  action_id_rule_name(packet->action[i]), i,
                   player_name(pplayer), packet->unit_id);
 
         return;
@@ -4760,7 +4760,7 @@
 
           log_error("handle_unit_orders() can't do %s without a target. "
                     "Sent in order number %d from %s to unit number %d.",
-                    action_get_rule_name(packet->action[i]), i,
+                    action_id_rule_name(packet->action[i]), i,
                     player_name(pplayer), packet->unit_id);
 
           return;
@@ -4774,7 +4774,7 @@
 
           log_error("handle_unit_orders() can't do %s without a target. "
                     "Sent in order number %d from %s to unit number %d.",
-                    action_get_rule_name(packet->action[i]), i,
+                    action_id_rule_name(packet->action[i]), i,
                     player_name(pplayer), packet->unit_id);
 
           return;


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

Reply via email to