Author: sveinung
Date: Fri Sep 18 14:40:14 2015
New Revision: 29918

URL: http://svn.gna.org/viewcvs/freeciv?rev=29918&view=rev
Log:
Add action enabler copy function

so an action enabler quickly can be cloned.

See patch #6361

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

Modified: trunk/common/actions.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/actions.c?rev=29918&r1=29917&r2=29918&view=diff
==============================================================================
--- trunk/common/actions.c      (original)
+++ trunk/common/actions.c      Fri Sep 18 14:40:14 2015
@@ -510,6 +510,22 @@
 }
 
 /**************************************************************************
+  Create a new copy of an existing action enabler.
+**************************************************************************/
+struct action_enabler *
+action_enabler_copy(const struct action_enabler *original)
+{
+  struct action_enabler *enabler = action_enabler_new();
+
+  enabler->action = original->action;
+
+  requirement_vector_copy(&enabler->actor_reqs, &original->actor_reqs);
+  requirement_vector_copy(&enabler->target_reqs, &original->target_reqs);
+
+  return enabler;
+}
+
+/**************************************************************************
   Add an action enabler.
 **************************************************************************/
 void action_enabler_add(struct action_enabler *enabler)

Modified: trunk/common/actions.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/actions.h?rev=29918&r1=29917&r2=29918&view=diff
==============================================================================
--- trunk/common/actions.h      (original)
+++ trunk/common/actions.h      Fri Sep 18 14:40:14 2015
@@ -232,6 +232,8 @@
 action_enablers_for_action(enum gen_action action);
 
 struct action_enabler *action_enabler_new(void);
+struct action_enabler *
+action_enabler_copy(const struct action_enabler *original);
 void action_enabler_add(struct action_enabler *enabler);
 
 bool action_blocks_attack(const struct unit *actor_unit,


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

Reply via email to