Complete.Org: Mailing Lists: Archives: freeciv-dev: June 2004:
[Freeciv-Dev] (PR#9006) player_in_territory() function
Home

[Freeciv-Dev] (PR#9006) player_in_territory() function

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#9006) player_in_territory() function
From: "James Canete" <use_less@xxxxxxxxxxx>
Date: Fri, 18 Jun 2004 04:06:49 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=9006 >

New version.

Changes:
-removed return 0 if players are equal
-added alternate (whole_map_iterate) code, but commented it out
-added transporter count.  On server counts all units, on client counts
one extra unit.
-changed to "struct player *" to remove warning.  Leaving the audit for
later.  :)

I tried timing alternate code vs. normal code (without transporter count):

alternate (whole_map_iterate):

real    22m9.251s
user    0m0.100s
sys     0m0.560s

normal (unit_list_iterate(pplayer2->units)):

real    22m3.253s
user    0m0.090s
sys     0m0.480s

And this was only one less-than-scientific trial, so I think they
perform about the same.

By the way, should I be benchmarking with --enable-debug=no?  I think
that still enables "set timeout -1", but I'm not sure.  The above timing
was with default debug settings.

I placed this function in common/players.c so the client can do its own
check for enemy units in territory before sending an expel enemy units
demand.

However, this check will be duplicated at the server to prevent
cheating, so it may be a waste of time to do it on client-side.

-James Canete

Attachment: player_in_territory-2.diff
Description: Binary data


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