[Freeciv-Dev] Re: (PR#12546) Divide handicaps to real handicaps and chea
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12546 >
First version.
Regression tests passed, compared to version patched with current
#12550 patch. Whatever we do with #12550, this patch needs same changes.
- ML
diff -Nurd -X.diff_ignore freeciv/ai/advdiplomacy.c freeciv/ai/advdiplomacy.c
--- freeciv/ai/advdiplomacy.c 2005-03-22 22:26:59.937500000 +0200
+++ freeciv/ai/advdiplomacy.c 2005-03-23 00:05:28.312500000 +0200
@@ -294,7 +294,7 @@
case CLAUSE_PEACE:
case CLAUSE_CEASEFIRE:
/* Don't do anything in away mode */
- if (ai_handicap(pplayer, H_AWAY)) {
+ if (player_has_handicap(pplayer, H_AWAY)) {
notify(aplayer, _("*%s (AI)* In away mode AI can't sign such a treaty"),
pplayer->name);
worth = -BIG_NUMBER;
@@ -433,7 +433,7 @@
worth -= 15 * city_list_size(aplayer->cities);
/* Make maps from novice player cheap */
- if (ai_handicap(pplayer, H_DIPLOMACY)) {
+ if (player_has_handicap(pplayer, H_DIPLOMACY)) {
worth /= 2;
}
}
@@ -452,7 +452,7 @@
worth *= 4;
}
/* Make maps from novice player cheap */
- if (ai_handicap(pplayer, H_DIPLOMACY)) {
+ if (player_has_handicap(pplayer, H_DIPLOMACY)) {
worth /= 6;
}
}
@@ -751,7 +751,7 @@
/ (2 * MAX_AI_LOVE));
/* Make novice AI more peaceful with human players */
- if (ai_handicap(pplayer, H_DIPLOMACY) && !aplayer->ai.control) {
+ if (player_has_handicap(pplayer, H_DIPLOMACY) && !aplayer->ai.control) {
kill_desire = kill_desire / 2 - 5;
}
@@ -1076,7 +1076,7 @@
ai_diplomacy_suggest(pplayer, aplayer, CLAUSE_EMBASSY, 0);
}
- if (!ai_handicap(pplayer, H_DIPLOMACY) || !aplayer->ai.control) {
+ if (!player_has_handicap(pplayer, H_DIPLOMACY) || !aplayer->ai.control) {
suggest_tech_exchange(pplayer, aplayer);
}
}
diff -Nurd -X.diff_ignore freeciv/ai/aiair.c freeciv/ai/aiair.c
--- freeciv/ai/aiair.c 2005-03-22 22:26:59.937500000 +0200
+++ freeciv/ai/aiair.c 2005-03-23 00:05:28.328125000 +0200
@@ -42,7 +42,7 @@
* Returns 0 if not found.
* TODO: 1. Use proper refuel_iterate, like in ai_find_strategic_airbase
* 2. Special handicaps for planes running out of fuel
- * IMO should be less restrictive than general H_MAP, H_FOG
+ * IMO should be less restrictive than general !C_MAP, !C_FOG
*************************************************************************/
static bool find_nearest_airbase(struct tile *ptile, struct unit *punit,
struct tile **airbase_tile)
@@ -160,7 +160,7 @@
* Returns the want for the best target, records target in punit's goto_dest
* TODO: take counterattack dangers into account
* TODO: make separate handicaps for air units seeing targets
- * IMO should be more restrictive than general H_MAP, H_FOG
+ * IMO should be more restrictive than general !C_MAP, !C_FOG
*********************************************************************/
static int find_something_to_bomb(struct unit *punit, struct tile *ptile)
{
@@ -185,11 +185,11 @@
/* Let's find something to bomb */
iterate_outward(ptile, max_dist, tile1) {
- if (ai_handicap(pplayer, H_MAP) && !map_is_known(tile1, pplayer)) {
+ if (!player_has_handicap(pplayer, C_MAP) && !map_is_known(tile1, pplayer))
{
/* The target tile is unknown */
continue;
}
- if (ai_handicap(pplayer, H_FOG)
+ if (!player_has_handicap(pplayer, C_FOG)
&& !map_is_known_and_seen(tile1, pplayer)) {
/* The tile is fogged */
continue;
@@ -376,7 +376,7 @@
bool want_something = FALSE;
/* This AI doesn't know to build planes */
- if (ai_handicap(pplayer, H_NOPLANES)) {
+ if (player_has_handicap(pplayer, H_NOPLANES)) {
return FALSE;
}
diff -Nurd -X.diff_ignore freeciv/ai/aicity.c freeciv/ai/aicity.c
--- freeciv/ai/aicity.c 2005-03-22 22:26:59.937500000 +0200
+++ freeciv/ai/aicity.c 2005-03-23 00:05:28.328125000 +0200
@@ -498,7 +498,7 @@
}
break;
case EFT_SEA_DEFEND:
- if (ai_handicap(pplayer, H_DEFENSIVE)) {
+ if (player_has_handicap(pplayer, H_DEFENSIVE)) {
v += amount / 10; /* make AI slow */
}
if (is_ocean(map_get_terrain(pcity->tile))) {
@@ -520,7 +520,7 @@
}
break;
case EFT_AIR_DEFEND:
- if (ai_handicap(pplayer, H_DEFENSIVE)) {
+ if (player_has_handicap(pplayer, H_DEFENSIVE)) {
v += amount / 15; /* make AI slow */
}
v += (ai->threats.air && ai->threats.continent[ptile->continent])
@@ -533,7 +533,7 @@
}
break;
case EFT_LAND_DEFEND:
- if (ai_handicap(pplayer, H_DEFENSIVE)) {
+ if (player_has_handicap(pplayer, H_DEFENSIVE)) {
v += amount / 10; /* make AI slow */
}
if (ai->threats.continent[ptile->continent]
@@ -559,7 +559,7 @@
case EFT_GAIN_AI_LOVE:
players_iterate(aplayer) {
if (aplayer->ai.control) {
- if (ai_handicap(pplayer, H_DEFENSIVE)) {
+ if (player_has_handicap(pplayer, H_DEFENSIVE)) {
v += amount / 10;
} else {
v += amount / 20;
@@ -886,7 +886,7 @@
init_choice(&newchoice);
- if (ai_handicap(pplayer, H_AWAY)
+ if (player_has_handicap(pplayer, H_AWAY)
&& city_built_last_turn(pcity)
&& pcity->ai.urgency == 0) {
/* Don't change existing productions unless we have to. */
diff -Nurd -X.diff_ignore freeciv/ai/aidata.c freeciv/ai/aidata.c
--- freeciv/ai/aidata.c 2005-03-22 22:26:59.953125000 +0200
+++ freeciv/ai/aidata.c 2005-03-23 00:05:28.328125000 +0200
@@ -494,7 +494,7 @@
Continent_id continent = map_get_continent(ptile);
if (is_ocean(ptile->terrain)) {
- if (ai->explore.sea_done && ai_handicap(pplayer, H_TARGETS)
+ if (ai->explore.sea_done && !player_has_handicap(pplayer, C_TARGETS)
&& !map_is_known(ptile, pplayer)) {
/* We're not done there. */
ai->explore.sea_done = FALSE;
@@ -508,13 +508,13 @@
continue;
}
if (map_has_special(ptile, S_HUT)
- && (!ai_handicap(pplayer, H_HUTS)
+ && (player_has_handicap(pplayer, C_HUTS)
|| map_is_known(ptile, pplayer))) {
ai->explore.land_done = FALSE;
ai->explore.continent[continent] = TRUE;
continue;
}
- if (ai_handicap(pplayer, H_TARGETS) && !map_is_known(ptile, pplayer)) {
+ if (!player_has_handicap(pplayer, C_TARGETS) && !map_is_known(ptile,
pplayer)) {
/* this AI must explore */
ai->explore.land_done = FALSE;
ai->explore.continent[continent] = TRUE;
diff -Nurd -X.diff_ignore freeciv/ai/aidiplomat.c freeciv/ai/aidiplomat.c
--- freeciv/ai/aidiplomat.c 2005-03-22 22:26:59.953125000 +0200
+++ freeciv/ai/aidiplomat.c 2005-03-23 00:05:28.328125000 +0200
@@ -151,7 +151,7 @@
return;
}
- if (ai_handicap(pplayer, H_DIPLOMAT)) {
+ if (player_has_handicap(pplayer, H_DIPLOMAT)) {
/* Diplomats are too tough on newbies */
return;
}
diff -Nurd -X.diff_ignore freeciv/ai/aiexplorer.c freeciv/ai/aiexplorer.c
--- freeciv/ai/aiexplorer.c 2005-03-22 22:26:59.953125000 +0200
+++ freeciv/ai/aiexplorer.c 2005-03-23 00:05:28.343750000 +0200
@@ -226,9 +226,12 @@
desirable = 0;
}
- if ((!pplayer->ai.control || !ai_handicap(pplayer, H_HUTS))
- && map_is_known(ptile, pplayer)
- && map_has_special(ptile, S_HUT)) {
+ /* Players with C_HUTS cheat see truth, others
+ * think that there is hut iff private map says so */
+ if ((map_has_special(ptile, S_HUT)
+ && player_has_handicap(pplayer, C_HUTS))
+ || (((pplayer->private_map + ptile->index)->special & S_HUT)
+ && !player_has_handicap(pplayer, C_HUTS))) {
/* we want to explore huts whenever we can,
* even if doing so will not uncover any tiles. */
desirable += HUT_SCORE;
diff -Nurd -X.diff_ignore freeciv/ai/aihand.c freeciv/ai/aihand.c
--- freeciv/ai/aihand.c 2005-03-22 22:26:59.953125000 +0200
+++ freeciv/ai/aihand.c 2005-03-23 00:05:28.343750000 +0200
@@ -95,8 +95,8 @@
**************************************************************************/
static void ai_manage_taxes(struct player *pplayer)
{
- int maxrate = (ai_handicap(pplayer, H_RATES)
- ? get_government_max_rate(pplayer->government) : 100);
+ int maxrate = (player_has_handicap(pplayer, C_RATES)
+ ? 100 : get_government_max_rate(pplayer->government));
bool celebrate = TRUE;
int can_celebrate = 0, total_cities = 0;
struct government *g = get_gov_pplayer(pplayer);
@@ -281,7 +281,7 @@
ai->goal.govt.req = A_UNSET;
ai->goal.revolution = pplayer->government;
- if (ai_handicap(pplayer, H_AWAY) || !pplayer->is_alive) {
+ if (player_has_handicap(pplayer, H_AWAY) || !pplayer->is_alive) {
return;
}
@@ -377,7 +377,7 @@
{
struct ai_data *ai = ai_data_get(pplayer);
- if (!pplayer->is_alive || ai_handicap(pplayer, H_AWAY)) {
+ if (!pplayer->is_alive || player_has_handicap(pplayer, H_AWAY)) {
return;
}
diff -Nurd -X.diff_ignore freeciv/ai/aihunt.c freeciv/ai/aihunt.c
--- freeciv/ai/aihunt.c 2005-03-22 22:26:59.953125000 +0200
+++ freeciv/ai/aihunt.c 2005-03-23 00:05:28.343750000 +0200
@@ -215,7 +215,7 @@
if ((best_land_hunter == -1 && best_sea_hunter == -1)
|| is_barbarian(pplayer) || !pplayer->is_alive
- || ai_handicap(pplayer, H_TARGETS)) {
+ || !player_has_handicap(pplayer, C_TARGETS)) {
return; /* None available */
}
if (hunter) {
diff -Nurd -X.diff_ignore freeciv/ai/aisettler.c freeciv/ai/aisettler.c
--- freeciv/ai/aisettler.c 2005-03-22 22:27:00.046875000 +0200
+++ freeciv/ai/aisettler.c 2005-03-23 00:05:28.343750000 +0200
@@ -117,7 +117,7 @@
int sum = 0;
bool virtual_city = FALSE;
int curr_govt = pplayer->government;
- bool handicap = ai_handicap(pplayer, H_MAP);
+ bool cheat = player_has_handicap(pplayer, C_MAP);
pplayer->government = ai->goal.govt.idx;
@@ -140,7 +140,7 @@
bool city_center = is_city_center(i, j);
if (reserved < 0
- || (handicap && !map_is_known(ptile, pplayer))
+ || (!cheat && !map_is_known(ptile, pplayer))
|| ptile->worked != NULL) {
/* Tile is reserved or we can't see it */
result->citymap[i][j].shield = 0;
@@ -386,7 +386,7 @@
result->total = 0;
if (!city_can_be_built_here(ptile, punit)
- || (ai_handicap(pplayer, H_MAP)
+ || (!player_has_handicap(pplayer, C_MAP)
&& !map_is_known(ptile, pplayer))) {
return;
}
diff -Nurd -X.diff_ignore freeciv/ai/aiunit.c freeciv/ai/aiunit.c
--- freeciv/ai/aiunit.c 2005-03-22 22:27:00.062500000 +0200
+++ freeciv/ai/aiunit.c 2005-03-23 00:05:28.359375000 +0200
@@ -642,7 +642,7 @@
break;
}
- if (ai_handicap(pplayer, H_TARGETS)
+ if (!player_has_handicap(pplayer, C_TARGETS)
&& !map_is_known_and_seen(pos.tile, pplayer)) {
/* The target is under fog of war */
continue;
@@ -1238,7 +1238,7 @@
struct tile *best_tile = NULL;
/* Build cost of the attacker (+adjustments) */
int bcost, bcost_bal;
- bool handicap = ai_handicap(pplayer, H_TARGETS);
+ bool cheat = player_has_handicap(pplayer, C_TARGETS);
struct unit *ferryboat = NULL;
/* Type of our boat (a future one if ferryboat == NULL) */
Unit_Type_id boattype = U_LAST;
@@ -1385,7 +1385,7 @@
continue;
}
- if (handicap && !map_is_known(acity->tile, pplayer)) {
+ if (!cheat && !map_is_known(acity->tile, pplayer)) {
/* Can't see it */
continue;
}
@@ -1535,7 +1535,7 @@
continue;
}
- if (handicap && !map_is_known(aunit->tile, pplayer)) {
+ if (!cheat && !map_is_known(aunit->tile, pplayer)) {
/* Can't see the target */
continue;
}
@@ -1919,7 +1919,7 @@
if ((punit->activity == ACTIVITY_SENTRY
|| punit->activity == ACTIVITY_FORTIFIED)
- && ai_handicap(pplayer, H_AWAY)) {
+ && player_has_handicap(pplayer, H_AWAY)) {
/* Don't move sentried or fortified units controlled by a player
* in away mode. */
punit->ai.done = TRUE;
diff -Nurd -X.diff_ignore freeciv/common/aicore/pf_tools.c
freeciv/common/aicore/pf_tools.c
--- freeciv/common/aicore/pf_tools.c 2005-03-22 22:27:02.734375000 +0200
+++ freeciv/common/aicore/pf_tools.c 2005-03-23 00:05:28.359375000 +0200
@@ -591,7 +591,7 @@
parameter->owner = unit_owner(punit);
parameter->unit_flags = unit_type(punit)->flags;
- parameter->omniscience = !ai_handicap(unit_owner(punit), H_MAP);
+ parameter->omniscience = player_has_handicap(unit_owner(punit), C_MAP);
}
/**********************************************************************
diff -Nurd -X.diff_ignore freeciv/common/player.c freeciv/common/player.c
--- freeciv/common/player.c 2005-03-22 22:27:02.859375000 +0200
+++ freeciv/common/player.c 2005-03-23 00:06:38.406250000 +0200
@@ -500,15 +500,13 @@
}
/**************************************************************************
- AI players may have handicaps - allowing them to cheat or preventing
- them from using certain algorithms. This function returns whether the
- player has the given handicap. Human players are assumed to have no
- handicaps.
+ This function returns whether player is subject to given handicap
**************************************************************************/
-bool ai_handicap(const struct player *pplayer, enum handicap_type htype)
+bool player_has_handicap(const struct player *pplayer, enum handicap_type
htype)
{
+ /* Currently only AI players have handicaps, humans go by rules. */
if (!pplayer->ai.control) {
- return TRUE;
+ return FALSE;
}
return BOOL_VAL(pplayer->ai.handicap & htype);
}
diff -Nurd -X.diff_ignore freeciv/common/player.h freeciv/common/player.h
--- freeciv/common/player.h 2005-03-22 22:27:02.859375000 +0200
+++ freeciv/common/player.h 2005-03-23 00:05:28.375000000 +0200
@@ -41,21 +41,23 @@
SEA_BARBARIAN = 2
};
+/* Each bit denotes difference from optimal, but rules obeying AI.
+ * So, some bits make AI stronger (cheats) and some weaker (handicaps) */
enum handicap_type {
- H_NONE = 0, /* No handicaps */
+ HC_NONE = 0, /* No handicaps */
H_DIPLOMAT = 1, /* Can't build offensive diplomats */
H_AWAY = 2, /* Away mode */
H_LIMITEDHUTS = 4, /* Can get only 25 gold and barbs from huts */
H_DEFENSIVE = 8, /* Build defensive buildings without calculating need */
- H_EXPERIMENTAL = 16,/* Enable experimental AI features (for testing) */
- H_RATES = 32, /* Can't set its rates beyond government limits */
- H_TARGETS = 64, /* Can't target anything it doesn't know exists */
- H_HUTS = 128, /* Doesn't know which unseen tiles have huts on them */
- H_FOG = 256, /* Can't see through fog of war */
+ C_EXPERIMENTAL = 16,/* Enable experimental AI features (for testing) */
+ C_RATES = 32, /* Can set its rates beyond government limits */
+ C_TARGETS = 64, /* Can target things it doesn't know exists */
+ C_HUTS = 128, /* Sees which unseen tiles have huts on them */
+ C_FOG = 256, /* Sees through fog of war */
H_NOPLANES = 512, /* Doesn't build air units */
- H_MAP = 1024, /* Only knows map_is_known tiles */
+ C_MAP = 1024, /* Knows all tiles */
H_DIPLOMACY = 2048, /* Not very good at diplomacy */
- H_REVOLUTION = 4096 /* Cannot skip anarchy */
+ C_REVOLUTION = 4096 /* Can skip anarchy */
};
struct player_economic {
@@ -272,7 +274,7 @@
struct city *find_palace(const struct player *pplayer);
-bool ai_handicap(const struct player *pplayer, enum handicap_type htype);
+bool player_has_handicap(const struct player *pplayer, enum handicap_type
htype);
bool ai_fuzzy(const struct player *pplayer, bool normal_decision);
const char *reputation_text(const int rep);
diff -Nurd -X.diff_ignore freeciv/doc/README.AI freeciv/doc/README.AI
--- freeciv/doc/README.AI 2005-03-22 22:27:12.031250000 +0200
+++ freeciv/doc/README.AI 2005-03-23 00:05:28.375000000 +0200
@@ -281,18 +281,15 @@
while 'medium' has a number of handicaps. In 'easy', the AI
also does random stupid things through the ai_fuzzy function. The
'experimental' level is only for coding - you can gate new code
-with the H_EXPERIMENTAL handicap and test 'experimental' level
+with the C_EXPERIMENTAL cheat and test 'experimental' level
AIs against 'hard' level AIs. In 'novice' the AI researches slower
than normal players.
-Other handicaps used are:
- H_RATES, can't set its rates beyond government limits
- H_TARGETS, can't target anything it doesn't know exists
- H_HUTS, doesn't know which unseen tiles have huts on them
- H_FOG, can't see through fog of war
-
-The other defined handicaps (in common/player.h) are not currently in
-use.
+Other handicaps and cheats used are:
+ C_RATES, can set its rates beyond government limits
+ C_TARGETS, can target anything it doesn't know exists
+ C_HUTS, knows which unseen tiles have huts on them
+ C_FOG, can see through fog of war
THINGS THAT NEED TO BE FIXED
diff -Nurd -X.diff_ignore freeciv/server/gotohand.c freeciv/server/gotohand.c
--- freeciv/server/gotohand.c 2005-03-22 22:27:16.687500000 +0200
+++ freeciv/server/gotohand.c 2005-03-23 00:05:28.375000000 +0200
@@ -1,7 +1,7 @@
/**********************************************************************
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
+ it under the terms of the GNU General Public License as publismmmmhed by
the Free Software Foundation; either version 2, or (at your option)
any later version.
@@ -856,7 +856,7 @@
****************************************************************************/
static bool is_coast_seen(struct tile *ptile, struct player *pplayer)
{
- bool ai_always_see_map = !ai_handicap(pplayer, H_MAP);
+ bool ai_always_see_map = player_has_handicap(pplayer, C_MAP);
adjc_iterate(ptile, adjc_tile) {
/* Is there land here, and if so can we see it? */
@@ -1425,24 +1425,25 @@
static bool airspace_looks_safe(struct tile *ptile, struct player *pplayer)
{
/*
- * We do handicap checks for the player with ai_handicap(). This
- * function returns true if the player is handicapped. For human
- * players they'll always return true. This is the desired behavior.
+ * We do cheat checks for the player with ai_cheat(). This
+ * function returns true if the player can cheat. For human
+ * players they'll always return false. This is the desired behavior.
*/
/* If the tile's unknown, we (may) assume it's safe. */
- if (ai_handicap(pplayer, H_MAP) && !map_is_known(ptile, pplayer)) {
+ if (!player_has_handicap(pplayer, C_MAP) && !map_is_known(ptile, pplayer)) {
return AIR_ASSUMES_UNKNOWN_SAFE;
}
/* This is bad: there could be a city there that the player doesn't
- know about. How can we check that? */
+ * know about. How can we check that?
+ * TODO: By checking if player has dummy city info. */
if (is_non_allied_city_tile(ptile, pplayer)) {
return FALSE;
}
/* If the tile's fogged we again (may) assume it's safe. */
- if (ai_handicap(pplayer, H_FOG) &&
+ if (!player_has_handicap(pplayer, C_FOG) &&
!map_is_known_and_seen(ptile, pplayer)) {
return AIR_ASSUMES_FOGGED_SAFE;
}
diff -Nurd -X.diff_ignore freeciv/server/plrhand.c freeciv/server/plrhand.c
--- freeciv/server/plrhand.c 2005-03-22 22:27:16.703125000 +0200
+++ freeciv/server/plrhand.c 2005-03-23 00:05:28.390625000 +0200
@@ -886,9 +886,9 @@
/* Set revolution_finishes value. */
if (pplayer->revolution_finishes > 0) {
/* Player already has an active revolution. */
- } else if ((pplayer->ai.control && !ai_handicap(pplayer, H_REVOLUTION))
+ } else if ((player_has_handicap(pplayer, C_REVOLUTION))
|| get_player_bonus(pplayer, EFT_NO_ANARCHY)) {
- /* AI players without the H_REVOLUTION handicap can skip anarchy */
+ /* AI players with the C_REVOLUTION cheat can skip anarchy */
pplayer->revolution_finishes = game.turn;
} else if (game.revolution_length == 0) {
pplayer->revolution_finishes = game.turn + myrand(5) + 1;
diff -Nurd -X.diff_ignore freeciv/server/stdinhand.c freeciv/server/stdinhand.c
--- freeciv/server/stdinhand.c 2005-03-22 22:27:16.828125000 +0200
+++ freeciv/server/stdinhand.c 2005-03-23 00:05:28.390625000 +0200
@@ -684,21 +684,20 @@
static int handicap_of_skill_level(int level)
{
int h[11] = { -1,
- /* away */ H_AWAY | H_RATES | H_TARGETS | H_HUTS | H_FOG | H_MAP
- | H_REVOLUTION,
- /* novice */ H_RATES | H_TARGETS | H_HUTS | H_NOPLANES
- | H_DIPLOMAT | H_LIMITEDHUTS | H_DEFENSIVE
- | H_DIPLOMACY | H_REVOLUTION,
- /* easy */ H_RATES | H_TARGETS | H_HUTS | H_NOPLANES
- | H_DIPLOMAT | H_LIMITEDHUTS | H_DEFENSIVE
- | H_REVOLUTION,
- H_NONE,
- /* medium */ H_RATES | H_TARGETS | H_HUTS | H_DIPLOMAT,
- H_NONE,
- /* hard */ H_NONE,
- H_NONE,
- H_NONE,
- /* testing */ H_EXPERIMENTAL,
+ /* away */ H_AWAY,
+
+ /* novice */ H_NOPLANES | H_DIPLOMAT | H_LIMITEDHUTS | H_DEFENSIVE
+ | H_DIPLOMACY | C_FOG | C_MAP,
+ /* easy */ H_NOPLANES | H_DIPLOMAT | H_LIMITEDHUTS | H_DEFENSIVE
+ | C_FOG | C_MAP,
+ HC_NONE,
+ /* medium */ H_DIPLOMAT | C_FOG | C_MAP | C_REVOLUTION,
+ HC_NONE,
+ /* hard */ C_RATES | C_TARGETS | C_HUTS | C_FOG | C_MAP | C_REVOLUTION,
+ HC_NONE,
+ HC_NONE,
+ /* testing */ C_RATES | C_TARGETS | C_HUTS | C_FOG | C_MAP | C_REVOLUTION
+ | C_EXPERIMENTAL
};
assert(level>0 && level<=10);
diff -Nurd -X.diff_ignore freeciv/server/unittools.c freeciv/server/unittools.c
--- freeciv/server/unittools.c 2005-03-22 22:27:16.828125000 +0200
+++ freeciv/server/unittools.c 2005-03-23 00:05:28.406250000 +0200
@@ -1179,7 +1179,7 @@
d = unit_def_rating_basic_sq(punit) * db;
adjc_iterate(ptile, ptile1) {
- if (ai_handicap(pplayer, H_FOG)
+ if (!player_has_handicap(pplayer, C_FOG)
&& !map_is_known_and_seen(ptile1, unit_owner(punit))) {
/* We cannot see danger at (ptile1) => assume there is none */
continue;
@@ -2380,8 +2380,7 @@
}
/* AI with H_LIMITEDHUTS only gets 25 gold (or barbs if unlucky) */
- if (pplayer->ai.control && ai_handicap(pplayer, H_LIMITEDHUTS)
- && hut_chance != 10) {
+ if (player_has_handicap(pplayer, H_LIMITEDHUTS) && hut_chance != 10) {
hut_chance = 0;
}
@@ -2500,8 +2499,8 @@
enum diplstate_type ds =
pplayer_get_diplstate(unit_owner(punit), enemyplayer)->type;
- if (((enemyplayer->ai.control && ai_handicap(enemyplayer,
H_EXPERIMENTAL))
- || game.autoattack)
+ if ((player_has_handicap(enemyplayer, C_EXPERIMENTAL)
+ || game.autoattack)
&& penemy->moves_left > 0
&& ds == DS_WAR
&& can_unit_attack_unit_at_tile(penemy, punit, punit->tile)) {
|
|