Complete.Org: Mailing Lists: Archives: freeciv-java: August 2000:
[FreeCiv-Java] FW: CivLog modifications
Home

[FreeCiv-Java] FW: CivLog modifications

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: "Raimar Falke" <rf13@xxxxxxxxxxxxxxxxx>
Cc: "Freeciv-Java" <freeciv-java@xxxxxxxxxxx>
Subject: [FreeCiv-Java] FW: CivLog modifications
From: "Wong TM (Huang Deming)" <lookmeow@xxxxxxxxxxxx>
Date: Sun, 27 Aug 2000 15:53:55 +0800

Just in case you interested.

-----Original Message-----
From: Michael Grundel [mailto:michael42@xxxxxxxxxx]
Sent: Sunday, August 27, 2000 8:08 AM
To: lookmeow@xxxxxxxxxxxx
Subject: CivLog modifications


Hello!

I really like your CivLog program! I was looking for something like that for 
a long time now.

Since my Java-skills are much better than my C-skills I tried to improve it 
a bit. Based on the code for version 0.02ME which I got from the freeciv-dev  
mailing-list, I have made some modifications:

- loading speed increased (one of my logs needed 20 sec to load, now only 2 sec)
  (I had to change the data structure for that)
- You can now select more than one data-attribute and the display is then 
  split. This makes it easier to compare different strengths/weaknesses.
  Just try it and see.
- some small changes (e.g. each player has the same color all the time,
  before he changed color when selecting more players)

I have tried not to interfere with the generated parts, but I currently don't 
have Forte, so I cannot be sure - let me know if I broke anything.

The changes I made often had implications on other parts of the code, so 
there are changes all over the place (but commented).
Before changing more of your program, I'd like to get some feedback about 
what features you intend to add (I could help), what you think of 
my additions, etc.

The changes are commented in the code (I also commented some parts of your 
code just to understand how it works). Here is a short summary:

The main changes are in CivLogFrame and the new class CivLogDrawArea.
CivLogDrawArea is a JPanel that holds several of your CivLogDraw-Objects.
CivLogFrame is actually about 160 lines shorter than before (mostly removed 
from the xyzActionPerformed-Methods).

CivLogData was changed to use a HashMap instead of the Vector for civscore.
To do this I needed a new class CivLogYearEntry, which is a HashMap also 
and holds all info on one year.
The structure is as follows:
HashMap civscore maps (year)   -> (CivLogYearEntry)
CivLogYearEntry  maps (player) -> (CivLogDataEntry)

So to lookup a CivLogDataEntry you do (simplified):
result     = civscore.get(year)
end-result = result.get(player)

To make it easier to iterate though the years in CivLogDraw, I also added 
an ArrayList which contains the years and is sorted once when all data is 
read in.

CivLogDraw had to be changed in drawGraph() to use the new data-structure 
(all commented in the code). I also changed some details (e.g. it shows what 
data it displays in the upper left corner) and changed player-color-management.
In Freeciv.java I also added some infos.

Attached is the source for all files I changed/added. Considering the amount 
of changes I am not sure a patch is very useful (and I mostly work on w2k
anyway).
If you rather want patches please let me know. I can make them.

If you have questions about my code (or Java) please let me know. It seems 
you use static and non-static a little randomly :-)
I dont yet understand how you draw the lines (it needs some fixing 
on the scale, etc.).

Some ideas I have for further development:
scaling: 
when you change the start/end dates the scale is not recomputed, this 
makes it almost impossible to compare the graph of the first turns 
(because it is so small) -> fix: recompute scale when changing the sliders?)

show Player-Names in Scroll-List in same color as lines in graph

Add display the number of 
- units lost
- units killed
- money in bank
- money used to buy stuff
- science/tax/happy rates
I guess this needs to be added to the logfile in FreeCiv?


Regards,
  Michael 

-- 
eMail: michael42@xxxxxxxxxx
PGP key available on request

Attachment: CivLog-update-michael.zip
Description: Zip compressed data


[Prev in Thread] Current Thread [Next in Thread]
  • [FreeCiv-Java] FW: CivLog modifications, Wong TM (Huang Deming) <=