[Freeciv-Dev] Re: (PR#6977) Goto into unknown area
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=6977 >
On Tue, Jan 06, 2004 at 03:05:32PM -0800, ue80@xxxxxxxxxxxxxxxxxxxxx wrote:
> Looks nearly ok. But triremes think that unexplored water is
> saver and nearer than normal/coastal water.
No unknown positions aren't safe.
I have also fixed the spelling Greg pointed out.
Missing is the increase of the EC of unknown positions. Suggestions
for the amount welcome. It is possible that it works even without the
increase.
Raimar
--
email: rf13@xxxxxxxxxxxxxxxxx
"Using only the operating-system that came with your computer is just
like only playing the demo-disc that came with your CD-player."
Index: ai/aiunit.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aiunit.c,v
retrieving revision 1.306
diff -u -u -r1.306 aiunit.c
--- ai/aiunit.c 2004/01/11 17:45:02 1.306
+++ ai/aiunit.c 2004/01/12 17:56:38
@@ -540,7 +540,7 @@
pft_fill_default_parameter(¶meter);
pft_fill_unit_parameter(¶meter, punit);
- parameter.get_TB = no_fights_or_unknown;
+ parameter.get_TB = pft_no_fights_or_unknown;
/* When exploring, even AI should pretend to not cheat. */
parameter.omniscience = FALSE;
@@ -2257,7 +2257,7 @@
pft_fill_default_parameter(¶meter);
pft_fill_unit_overlap_param(¶meter, punit);
/* We are looking for our units, no need to look into the unknown */
- parameter.get_TB = no_fights_or_unknown;
+ parameter.get_TB = pft_no_fights_or_unknown;
parameter.omniscience = FALSE;
map = pf_create_map(¶meter);
Index: client/goto.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/goto.c,v
retrieving revision 1.65
diff -u -u -r1.65 goto.c
--- client/goto.c 2004/01/10 13:05:59 1.65
+++ client/goto.c 2004/01/12 17:56:39
@@ -28,6 +28,7 @@
#include "clinet.h"
#include "control.h"
#include "mapview_g.h"
+#include "options.h"
#include "goto.h"
@@ -330,7 +331,7 @@
{
struct tile *ptile = map_get_tile(x, y);
- if (known == TILE_UNKNOWN) {
+ if (known == TILE_UNKNOWN && !goto_into_unknown) {
return TB_IGNORE;
}
if (is_non_allied_unit_tile(ptile, param->owner)
@@ -342,7 +343,7 @@
}
/**********************************************************************
- PF callback for caravans. Caravans doesn't go into the unknown and
+ PF callback for caravans. Caravans don't go into the unknown and
don't attack enemy units but enter enemy cities.
***********************************************************************/
static enum tile_behavior get_TB_caravan(int x, int y, enum known_type known,
@@ -350,7 +351,7 @@
{
struct tile *ptile = map_get_tile(x, y);
- if (known == TILE_UNKNOWN) {
+ if (known == TILE_UNKNOWN && !goto_into_unknown) {
return TB_IGNORE;
} else if (is_non_allied_city_tile(ptile, param->owner)) {
/* F_TRADE_ROUTE units can travel to, but not through, enemy cities.
@@ -381,8 +382,10 @@
} else if (unit_flag(punit, F_TRADE_ROUTE)
|| unit_flag(punit, F_HELP_WONDER)) {
parameter->get_TB = get_TB_caravan;
+ } else if (goto_into_unknown) {
+ parameter->get_TB = pft_no_fights;
} else {
- parameter->get_TB = no_fights_or_unknown;
+ parameter->get_TB = pft_no_fights_or_unknown;
}
parameter->turn_mode = TM_WORST_TIME;
parameter->start_x = punit->x;
Index: client/options.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/options.c,v
retrieving revision 1.89
diff -u -u -r1.89 options.c
--- client/options.c 2004/01/11 17:45:03 1.89
+++ client/options.c 2004/01/12 17:56:39
@@ -73,6 +73,7 @@
bool ask_city_name = TRUE;
bool popup_new_cities = TRUE;
bool keyboardless_goto = TRUE;
+bool goto_into_unknown = FALSE;
/* This option is currently set by the client - not by the user. */
bool update_city_text_in_refresh_tile = TRUE;
@@ -125,6 +126,7 @@
GEN_BOOL_OPTION(dialogs_on_top, N_("Keep dialogs on top (GTK+ 2.0
only)")),
GEN_BOOL_OPTION(ask_city_name, N_("Prompt for city names")),
GEN_BOOL_OPTION(popup_new_cities, N_("Pop up city dialog for new
cities")),
+ GEN_BOOL_OPTION(goto_into_unknown, N_("Should units goto into unknown
terrain")),
GEN_OPTION_TERMINATOR
};
#undef GEN_INT_OPTION
Index: client/options.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/options.h,v
retrieving revision 1.33
diff -u -u -r1.33 options.h
--- client/options.h 2003/12/16 15:07:52 1.33
+++ client/options.h 2004/01/12 17:56:40
@@ -47,6 +47,7 @@
extern bool popup_new_cities;
extern bool update_city_text_in_refresh_tile;
extern bool keyboardless_goto;
+extern bool goto_into_unknown;
enum client_option_type {
COT_BOOL,
Index: common/aicore/pf_tools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/aicore/pf_tools.c,v
retrieving revision 1.10
diff -u -u -r1.10 pf_tools.c
--- common/aicore/pf_tools.c 2004/01/11 17:45:05 1.10
+++ common/aicore/pf_tools.c 2004/01/12 17:56:40
@@ -351,9 +351,9 @@
PF callback to prohibit going into the unknown. Also makes sure we
don't plan to attack anyone.
***********************************************************************/
-enum tile_behavior no_fights_or_unknown(int x, int y,
- enum known_type known,
- struct pf_parameter *param)
+enum tile_behavior pft_no_fights_or_unknown(int x, int y,
+ enum known_type known,
+ struct pf_parameter *param)
{
struct tile *ptile = map_get_tile(x, y);
@@ -366,6 +366,24 @@
return TB_NORMAL;
}
+/**********************************************************************
+ PF callback to prohibit going into the unknown. Also makes sure we
+ don't plan to attack anyone.
+***********************************************************************/
+enum tile_behavior pft_no_fights(int x, int y,
+ enum known_type known,
+ struct pf_parameter *param)
+{
+ struct tile *ptile = map_get_tile(x, y);
+
+ if (is_non_allied_unit_tile(ptile, param->owner)
+ || is_non_allied_city_tile(ptile, param->owner)) {
+ /* Can't attack */
+ return TB_IGNORE;
+ }
+ return TB_NORMAL;
+}
+
/* ===================== Postion Dangerous Callbacks ================ */
@@ -376,7 +394,8 @@
static bool trireme_is_pos_dangerous(int x, int y, enum known_type known,
struct pf_parameter *param)
{
- return map_get_terrain(x, y) == T_OCEAN && !is_coastline(x, y);
+ return (known == TILE_UNKNOWN || (map_get_terrain(x, y) == T_OCEAN
+ && !is_coastline(x, y)));
}
Index: common/aicore/pf_tools.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/aicore/pf_tools.h,v
retrieving revision 1.5
diff -u -u -r1.5 pf_tools.h
--- common/aicore/pf_tools.h 2003/10/13 07:30:57 1.5
+++ common/aicore/pf_tools.h 2004/01/12 17:56:40
@@ -24,9 +24,11 @@
struct unit *punit);
void pft_fill_unit_attack_param(struct pf_parameter *parameter,
struct unit *punit);
-enum tile_behavior no_fights_or_unknown(int x, int y,
- enum known_type known,
- struct pf_parameter *param);
+enum tile_behavior pft_no_fights_or_unknown(int x, int y,
+ enum known_type known,
+ struct pf_parameter *param);
+enum tile_behavior pft_no_fights(int x, int y, enum known_type known,
+ struct pf_parameter *param);
#define pf_iterator(map, position) { \
struct pf_position position; \
- [Freeciv-Dev] Re: (PR#6977) Goto into unknown area, Raimar Falke, 2004/01/06
- [Freeciv-Dev] Re: (PR#6977) Goto into unknown area, ue80@xxxxxxxxxxxxxxxxxxxxx, 2004/01/06
- [Freeciv-Dev] Re: (PR#6977) Goto into unknown area, Raimar Falke, 2004/01/06
- [Freeciv-Dev] Re: (PR#6977) Goto into unknown area, ue80@xxxxxxxxxxxxxxxxxxxxx, 2004/01/06
- [Freeciv-Dev] Re: (PR#6977) Goto into unknown area, Jason Short, 2004/01/06
- [Freeciv-Dev] Re: (PR#6977) Goto into unknown area, Arnstein Lindgard, 2004/01/07
- [Freeciv-Dev] Re: (PR#6977) Goto into unknown area, Gregory Berkolaiko, 2004/01/08
- [Freeciv-Dev] Re: (PR#6977) Goto into unknown area, Jason Short, 2004/01/10
- [Freeciv-Dev] Re: (PR#6977) Goto into unknown area,
Raimar Falke <=
|
|