[Freeciv-Dev] (PR#9942) planned unit movement
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: |
undisclosed-recipients: ; |
Subject: |
[Freeciv-Dev] (PR#9942) planned unit movement |
From: |
"Zoltán Lakatos" <lakatoszoltan@xxxxxxxxxx> |
Date: |
Sat, 4 Sep 2004 15:41:18 -0700 |
Reply-to: |
rt@xxxxxxxxxxx |
<URL: http://rt.freeciv.org/Ticket/Display.html?id=9942 >
Hi!
This patch implements a new movement style in freeciv. Players can not move
their units in the same time, but they can plan their route paralell. It
decreases the advantages of fast clicking and gives more chance to strategy.
This idea came in connection with alternate unit movement problem #576, but it
is a something different solution.
It works so, that blocks movement till end of turn, then streams all plan. The
needed plan functions like the useful GOTO exsisted in freeciv, therefore the
patch isn't too large.
The main problem can be to find a fair and consequent player and unit order,
but I haven't checked the current methods yet.
zoli
--- freeciv-1.14.1/server/unittools.c 2003-11-30 20:22:48.000000000 +0100
+++ unittools.c 2004-09-05 23:20:19.000000000 +0200
@@ -1,4 +1,4 @@
-/**********************************************************************
+/**********************************************************************
Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -598,6 +598,27 @@
punit->moves_left=unit_move_rate(punit);
}
+/***************************************************************************
+ move points are set to zero --zoli
+***************************************************************************/
+static void unit_setzero_movepoints(struct player *pplayer, struct unit *punit)
+{
+ /* TODO: settlers and diplomats can't work without moves_left, caravans can
+ there are still some problem with fighters, how they return in one turn?
+ unit step order is a great question --zoli*/
+
+ if (!pplayer->ai.control) {
+ if (is_diplomat_unit(punit)) {
+ if (punit->moves_left > 1)
+ punit->moves_left = 1;
+ }
+ else if (!unit_flag(punit, F_SETTLERS))
+ punit->moves_left = 0;
+
+ }
+
+}
+
/**************************************************************************
iterate through all units and update them.
**************************************************************************/
@@ -816,8 +837,14 @@
bool more_to_explore = ai_manage_explorer(punit);
if (more_to_explore && player_find_unit_by_id(pplayer, id))
handle_unit_activity_request(punit, ACTIVITY_EXPLORE);
- else
- return;
+ else {
+ /* only planned movement allowed --zoli*/
+ if (!more_to_explore) {
+ unit_setzero_movepoints(pplayer, punit);
+ }
+
+ return;
+ }
}
if (activity==ACTIVITY_PILLAGE) {
@@ -992,7 +1019,7 @@
}
if (activity==ACTIVITY_FORTIFYING) {
- if (punit->activity_count >= 1) {
+ if (punit->activity_count >= 0) {
set_unit_activity(punit,ACTIVITY_FORTIFIED);
}
}
@@ -1002,7 +1029,12 @@
punit->ai.passenger != 0 || !pplayer->ai.control)) {
/* autosettlers otherwise waste time; idling them breaks assignment */
/* Stalling infantry on GOTO so I can see where they're GOing TO. -- Syela */
- (void) do_unit_goto(punit, GOTO_MOVE_ANY, TRUE);
+ if (do_unit_goto(punit, GOTO_MOVE_ANY, TRUE) == GR_DIED) {
+ return;
+ }
+
+ /* only planned movement allowed --zoli*/
+ unit_setzero_movepoints(pplayer, punit);
}
return;
}
@@ -1014,6 +1046,10 @@
}
send_unit_info(NULL, punit);
+
+ /* only planned movement allowed, but movepoints=0 info will not appear in
client,
+ to hold unit activatig --zoli */
+ unit_setzero_movepoints(pplayer, punit);
unit_list_iterate(ptile->units, punit2) {
if (!can_unit_continue_current_activity(punit2))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#9942) planned unit movement,
Zoltán Lakatos <=
|
|