Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2002:
[Freeciv-Dev] [PATCH] aiunit.c ai_military_findvictim() cleanup
Home

[Freeciv-Dev] [PATCH] aiunit.c ai_military_findvictim() cleanup

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Cc: bugs@xxxxxxxxxxx, rwetmore@xxxxxxxxxxxx
Subject: [Freeciv-Dev] [PATCH] aiunit.c ai_military_findvictim() cleanup
From: Petr Baudis <pasky@xxxxxxxxxxx>
Date: Sat, 16 Feb 2002 20:14:36 +0100

Hello,

  attached patch cleans the ai_military_findvictim function in aiunit.c of AI.
Behaviour is not changed (autogames are same), it was only commented and
variable names were expanded to something meaningful. Oh, yes, and it seems to
me that it compiles.

  I think it's ready to actually go in, altough I'm open to objections and
ideas how to extend/correct it even more. I can imagine generally possible
objections to variable names, as it's pretty difficult to name them properly
sometimes ;-).

  Note that this patch is obviously only fourth in very long line. It should be
relatively light stuff and its path to CVS should be IMHO short. It cleans up
relatively very small part of code, but it's worth it:

  As you can see, I've left some TODOs and dummy variables there, for one
simple reason - aside of better idea how the equation actually works, it's
pretty clear that the main equation is just pasted there from some other part
of code .. and after quick research one will discover that the same pattern of
formula is used in the famous "fat functions" of AI. So I wanted to keep the
formula in it's 'pure form' as much as possible, thus making it easy for my
next patch to move this equation to separate function, possibly even preparing
for some big cleanup of the fat functions (which seem to share also a lot of
other common code). This TODOs will be obviously removed in my next patch.

  Happy reviewing ;),

-- 

                                Petr "Pasky" Baudis

* elinks maintainer                * IPv6 guy (XS26 co-coordinator)
* IRCnet operator                  * FreeCiv AI hacker
.
No one can feel as helpless as the owner of a sick goldfish.
.
Public PGP key && geekcode && homepage: http://pasky.ji.cz/~pasky/

Attachment: findvictim-cleanup.patch
Description: Text document


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