Re: [Freeciv-Dev] patch to add synchronous game turns
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Gary Moyer wrote:
> David Pfitzner wrote:
>
> > - Shouldn't the change be inside check_for_full_turn_done()
> > as suggested by Mikko Tuumanen <mijutu@xxxxxx> (pity about
> > mail archives) instead of around the sniff_packets call?
> > (Adjust whether check .conn there.)
>
> I've tried this and it doesn't work. Here's why: the main loop (in
> civserver.c)
> breaks out of the while loop and advances the turn when sniff_packets()
> returns
> a value != 1. This is why I had to modify the main loop.
>
> Alternatively I could modify check_for_full_turn_done() (as prescribed) and
> then
> call it inside the sniff_packet() loop when turnblocking is enabled. This
> would
> be cleaner because I could all together do away with the
> all_players_done() function in civserver.c.
But, presumably check_for_full_turn_done() must already be
called somewhere/somehow inside the sniff_packet() loop, for
the current turn-done effect?
<looking...> I guess normally via handle_packet_input() on
a turn done packet, or via lost_connection_to_player().
As a hack I changed
if(game.players[i].conn && ...
to
if(!game.players[i].ai.control && ...
And it seemed to work ok.
(Just deleting the .conn check as I implied before doesn't work,
because it keeps waiting for non-connected AI players to indicate
turn done :-)
Regards,
-- David
|
|