2008/8/21 Krzysztof Sobolewski <[EMAIL PROTECTED]>:
> Thursday 21 of August 2008 15:31:13 Vincent Verhoeven napisaĆ(a):
>> 2008/8/19 Krzysztof Sobolewski <[EMAIL PROTECTED]>:
>> >
>> > I don't think I'll be able to try to reproduce it until saturday, at
>> > least... Are you comfortable with debugging Java programs?
>>
>> I think I'm making some progress. You are using the sizes of the
>> galaxies to determine the map bounds (TParsecDataModel:312 and
>> onwards). Risk has a size of 0 and a position of (0,0,0) on all
>> galaxies it seems. I suppose it only uses them as a container for
>> other stuff, and not something meaningful to be displayed. This means
>> that the mapbounds are (0,0) to (0,0), thus width/height is 0 and
>> division by zero later on.
>
> Ah.
> In Stars! I accumulate all planets and I thought it's the same in TParsec. My
> bad.
> It was just too easy to use the Galaxy... ;)
>
So let's go one layer deeper and just use star systems instead. :)
Since these are displayed in tpclient-pywx (in contrast with
galaxies), it can perhaps be assumed that developers will place them
at the right positions, and thus that you can use them to determine
map bounds. I think this is the same thing tpclient-pywx uses.
I attached a patch for this, however you should review it and probably
design something that is a bit better, because this replaces one
ad-hoc method with another. Also I only tested this with the Risk
ruleset, it might break other rulesets.
The current status is that it now manages to draw the maps. Only
problem is that those are useless because they lack pretty colors. :)
It's probably because of the peculiarities of the ruleset: it doesn't
use ships and I think planet ownership is different or something.
Also, strength is measured by resources because of the absence of
ships. Would it be possible to create a configuration that draws
useful maps of the Risk ruleset?
Iwanowitch
Index: src-model-tparsec/jezuch/utils/starmapper3/model/tparsec/TParsecDataModel.java
===================================================================
--- src-model-tparsec/jezuch/utils/starmapper3/model/tparsec/TParsecDataModel.java (revision 571)
+++ src-model-tparsec/jezuch/utils/starmapper3/model/tparsec/TParsecDataModel.java (working copy)
@@ -305,12 +305,20 @@
this.universe=getUniverse(conn);
//find the map bounds: spanning all galaxies
- GetObjectsByID getGalaxy=new GetObjectsByID();
- for (Object.ContainsType child : universe.getContains())
- getGalaxy.getIds().add(new IdsType(child.getId()));
+ GetObjectsByID getGalaxy=new GetObjectsByID();
+ for (Object.ContainsType child : universe.getContains())
+ getGalaxy.getIds().add(new IdsType(child.getId()));
+
+ GetObjectsByID getStar=new GetObjectsByID();
+ for (int c=conn.sendFrame(getGalaxy, Sequence.class).getNumber(); c > 0; c--)
+ {
+ Object child2=conn.receiveFrame(Object.class);
+ for (Object.ContainsType child3 : child2.getContains())
+ getStar.getIds().add(new IdsType(child3.getId()));
+ }
this.mapBounds=null;
- for (int c=conn.sendFrame(getGalaxy, Sequence.class).getNumber(); c > 0; c--)
+ for (int c=conn.sendFrame(getStar, Sequence.class).getNumber(); c > 0; c--)
{
Object galaxy=conn.receiveFrame(Object.class);
long radius=galaxy.getSize() / 2;
_______________________________________________
tp-devel mailing list
[email protected]
http://www.thousandparsec.net/tp/mailman.php/listinfo/tp-devel