Complete.Org: Mailing Lists: Archives: freeciv-ai: December 2002:
[freeciv-ai] Cleanup of kill_something_with
Home

[freeciv-ai] Cleanup of kill_something_with

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-ai@xxxxxxxxxxx
Subject: [freeciv-ai] Cleanup of kill_something_with
From: Gregory Berkolaiko <Gregory.Berkolaiko@xxxxxxxxxxxx>
Date: Tue, 24 Dec 2002 12:14:24 +0000

The attached patch is a cleanup of kill_something_with (k_s_w).  I renamed a 
lot of variables and made things more ordered.  Also lots of comments.  Variable
names are chosen to correspond to those in process_attacker_want (p_a_w)
(although I don't always agree with the naming there).

Pity these changes won't last.

And this is why.  Upon cleanup it has transpired that k_s_w does a calculation
previously done in find_something_to_kill (f_s_t_k) and which will also be done
again in p_a_w.  So the ultimate aim of the cleanups is to make this function
disappear.  

But first it must be cleaned up.  The code in the three functions is almost
identical.  But there are few differences, some just mistakes, some related to
bugs fixed in one place and not fixed in the other etc, some deliberate (or at
least beneficial).  These have to be detected and treated accordingly.

So here is the roadmap:
1. Clean up k_s_w.
2. Clean up f_s_t_k.
3. Move the common code out.
4. Synchronize the calculations (or explain the differences).
5. Remove unnecessary calculations.

Notes: 
1. All clean-ups are done so that savegames are identical.
2. Clean-ups will be committed on a very short notice.  The code is going to 
change a lot, so nit-picks during the initial stage are NOT welcome.
3. The underlying code is quite smart.  Hopefully, once the cleanups are
finished everyone will be able to see it.

Cleanup of k_s_w attached (savegames identical).  Will go in in about 4 hours.

Attachment: ksw_clean4.diff
Description: Text document


[Prev in Thread] Current Thread [Next in Thread]
  • [freeciv-ai] Cleanup of kill_something_with, Gregory Berkolaiko <=