Complete.Org: Mailing Lists: Archives: freeciv-ai: November 2002:
[freeciv-ai] Re: patch/rfc: wrap activity
Home

[freeciv-ai] Re: patch/rfc: wrap activity

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: "Per I. Mathisen" <per@xxxxxxxxxxx>
Cc: freeciv-ai@xxxxxxxxxxx
Subject: [freeciv-ai] Re: patch/rfc: wrap activity
From: "Ross W. Wetmore" <rwetmore@xxxxxxxxxxxx>
Date: Sat, 23 Nov 2002 10:53:47 -0500

If the checks make sense, then push them down to the appropriate level
and do them there.

Do not clutter the code with Tom, Dick and Harry functions that all
patch up the underlying core routine in subtly different ways at the
expense of layered function calls and code duplication.

Cheers,
RossW
=====

At 02:02 PM 02/11/18 +0000, Per I. Mathisen wrote:
>
>This is the essential wrapper for retaining fortification status, taken
>from massive ai patch. Shout if you think this is wrong, otherwise I will
>commit along with the necessary wrapping changes elsewhere in the code.
>
>  - Per
>
>diff -u -r1.62 aitools.c
>
>+/**************************************************************************
>+  Gate all changes to unit activities through here to enforce sanity
>+
>+  FIXME: packetify request
>++**************************************************************************/
>+void ai_unit_new_activity(struct unit *punit, enum unit_activity task)
>+{
>+  if (punit->activity == task) {
>+    return; /* useless */
>+  }
>+  if (punit->activity == ACTIVITY_FORTIFIED && task ==
ACTIVITY_FORTIFYING) {
>+    return; /* worse than useless */
>   }
>+  handle_unit_activity_request(punit, task);
> }




[Prev in Thread] Current Thread [Next in Thread]