[Freeciv-Dev] (PR#4683) allow pauses during client-side goto
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Client-side goto is clever now, and will have your trireme wait if it
doesn't have enough MP to cross dangerous ocean tiles.
But the server-side execution is not so clever, and when this happens it
will think the goto route has failed and cancel your goto.
I'm no expert on PF, but AFAICT the way the client indicates the pause
is just by indicating the same coordinate twice in a row. In other
words, if your trireme is at (x,y) and the next step in the goto route
is (x,y), that means to end your turn at the current location.
As a side note, I wonder how well this works with rand() moves. I'm
guessing not very. Fortunately this is not an issue for triremes.
This patch follows exactly the above logic: if the goto route moves the
unit to its current location, simply set its MP to 0. We then have to
manually send unit info out.
I've tested this, but only in a couple of different scenarios.
jason
Index: server/unittools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unittools.c,v
retrieving revision 1.236
diff -u -r1.236 unittools.c
--- server/unittools.c 2003/07/24 16:52:28 1.236
+++ server/unittools.c 2003/07/25 08:47:25
@@ -3010,7 +3010,16 @@
/* Move unit */
last_tile = (((index + 1) % pgr->length) == (pgr->last_index));
freelog(LOG_DEBUG, "handling\n");
- res = handle_unit_move_request(punit, x, y, FALSE, !last_tile);
+ if (same_pos(punit->x, punit->y, x, y)) {
+ /* Wait here. This can be an important part of a goto route, e.g.
+ * for tririemes. FIXME: we shouldn't lose the movepoints but should
+ * instead return GR_WAITING and just sit tight. */
+ res = TRUE;
+ punit->moves_left = 0;
+ send_unit_info_to_onlookers(NULL, punit, punit->x, punit->y, FALSE);
+ } else {
+ res = handle_unit_move_request(punit, x, y, FALSE, !last_tile);
+ }
if (!player_find_unit_by_id(pplayer, unitid)) {
return GR_DIED;
- [Freeciv-Dev] (PR#4683) allow pauses during client-side goto,
Jason Short <=
|
|