<URL: http://bugs.freeciv.org/Ticket/Display.html?id=34695 >

 This adds new AI level 'cheating'. It is codewise just like 'hard',
but distributed rulesets provide some cheating effects for this new
level.
 Applies on top of #34431


 - ML

diff -Nurd -X.diff_ignore freeciv/common/fc_types.h freeciv/common/fc_types.h
--- freeciv/common/fc_types.h	2007-01-27 22:57:24.000000000 +0200
+++ freeciv/common/fc_types.h	2007-01-27 22:43:39.000000000 +0200
@@ -168,6 +168,7 @@
                 AI_LEVEL_EASY         = 3,
                 AI_LEVEL_NORMAL       = 5,
                 AI_LEVEL_HARD         = 7,
+                AI_LEVEL_CHEATING     = 8,
                 AI_LEVEL_EXPERIMENTAL = 10,
                 AI_LEVEL_LAST};
 
diff -Nurd -X.diff_ignore freeciv/common/player.c freeciv/common/player.c
--- freeciv/common/player.c	2007-01-27 22:57:24.000000000 +0200
+++ freeciv/common/player.c	2007-01-27 22:43:21.000000000 +0200
@@ -39,7 +39,7 @@
  * must match these. */
 static const char *ai_level_names[] = {
   NULL, N_("Away"), N_("Novice"), N_("Easy"), NULL, N_("Normal"),
-  NULL, N_("Hard"), NULL, NULL, N_("Experimental")
+  NULL, N_("Hard"), N_("Cheating"), NULL, N_("Experimental")
 };
 
 /***************************************************************
diff -Nurd -X.diff_ignore freeciv/data/civ1/effects.ruleset freeciv/data/civ1/effects.ruleset
--- freeciv/data/civ1/effects.ruleset	2006-07-17 23:56:23.000000000 +0300
+++ freeciv/data/civ1/effects.ruleset	2007-01-27 23:42:43.000000000 +0200
@@ -16,6 +16,8 @@
 ; /* <-- avoid gettext warnings
 ; */ <-- avoid gettext warnings
 
+; Cheating AI effects are in separate file
+*include "default/ai_effects.ruleset"
 
 ; Specialist output bonuses
 
diff -Nurd -X.diff_ignore freeciv/data/civ2/effects.ruleset freeciv/data/civ2/effects.ruleset
--- freeciv/data/civ2/effects.ruleset	2006-07-17 23:56:23.000000000 +0300
+++ freeciv/data/civ2/effects.ruleset	2007-01-27 23:42:31.000000000 +0200
@@ -16,6 +16,9 @@
 ; /* <-- avoid gettext warnings
 ; */ <-- avoid gettext warnings
 
+; Cheating AI effects are in separate file
+*include "default/ai_effects.ruleset"
+
 [effect_gov_tile_bonus_0]
 name    = "Output_Penalty_Tile"
 value   = 2
diff -Nurd -X.diff_ignore freeciv/data/default/ai_effects.ruleset freeciv/data/default/ai_effects.ruleset
--- freeciv/data/default/ai_effects.ruleset	1970-01-01 02:00:00.000000000 +0200
+++ freeciv/data/default/ai_effects.ruleset	2007-01-27 23:33:26.000000000 +0200
@@ -0,0 +1,47 @@
+; Modifying this file:
+; You should not modify this file except to make bugfixes or
+; for other "maintenance".  If you want to make custom changes,
+; you should create a new datadir subdirectory and copy this file
+; into that directory, and then modify that copy.  Then use the
+; command "rulesetdir <mysubdir>" in the server to have freeciv
+; use your new customized file. Note that this file is not read
+; directly, but only thorugh *include* in effects.ruleset
+
+; Note that the freeciv AI may not cope well with anything more
+; than minor changes.
+
+; /* <-- avoid gettext warnings
+; */ <-- avoid gettext warnings
+
+[effect_ai_cheat_science]
+name    = "Output_Bonus"
+value   = 40
+reqs    =
+    { "type", "name", "range"
+      "AI", "Cheating", "Player"
+      "OutputType", "Science", "Local"
+    }
+
+[effect_ai_cheat_happiness]
+name	= "Make_Content"
+value	= 1
+reqs	=
+    { "type", "name", "range"
+      "AI", "Cheating", "Player"
+    }
+
+[effect_ai_cheat_pollution]
+name	= "Pollu_Prod_Pct"
+value	= -25
+reqs	=
+    { "type", "name", "range"
+      "AI", "Cheating", "Player"
+    }
+
+[effect_ai_cheat_veteran]
+name    = "Veteran_Combat"
+value   = 20
+reqs    =
+    { "type", "name", "range"
+      "AI", "Cheating", "Player"
+    }
diff -Nurd -X.diff_ignore freeciv/data/default/effects.ruleset freeciv/data/default/effects.ruleset
--- freeciv/data/default/effects.ruleset	2006-07-17 23:56:23.000000000 +0300
+++ freeciv/data/default/effects.ruleset	2007-01-27 23:22:32.000000000 +0200
@@ -16,6 +16,9 @@
 ; /* <-- avoid gettext warnings
 ; */ <-- avoid gettext warnings
 
+; Cheating AI effects are in separate file
+*include "default/ai_effects.ruleset"
+
 [effect_unhappysize]
 name    = "City_Unhappy_Size"
 value   = 4
diff -Nurd -X.diff_ignore freeciv/server/commands.c freeciv/server/commands.c
--- freeciv/server/commands.c	2006-07-17 23:56:22.000000000 +0300
+++ freeciv/server/commands.c	2007-01-27 22:56:35.000000000 +0200
@@ -250,6 +250,15 @@
       "sets the default level for any new AI players to 'hard'.  With an "
       "argument, sets the skill level for that player only.")
   },
+  {"cheating",  ALLOW_CTRL,
+   /* TRANS: translate text between <> only */
+   N_("cheating\n"
+      "cheating <player-name>"),
+   N_("Set one or all AI players to 'cheating'."),
+   N_("With no arguments, sets all AI players to skill level 'cheating', and "
+      "sets the default level for any new AI players to 'cheating'.  With an "
+      "argument, sets the skill level for that player only.")
+  },
   {"experimental",	ALLOW_CTRL,
    /* TRANS: translate text between <> only */
    N_("experimental\n"
diff -Nurd -X.diff_ignore freeciv/server/commands.h freeciv/server/commands.h
--- freeciv/server/commands.h	2006-07-17 23:56:22.000000000 +0300
+++ freeciv/server/commands.h	2007-01-27 22:44:02.000000000 +0200
@@ -66,6 +66,7 @@
   CMD_EASY,
   CMD_NORMAL,
   CMD_HARD,
+  CMD_CHEATING,
   CMD_EXPERIMENTAL,
   CMD_CMDLEVEL,
   CMD_FIRSTLEVEL,
diff -Nurd -X.diff_ignore freeciv/server/stdinhand.c freeciv/server/stdinhand.c
--- freeciv/server/stdinhand.c	2007-01-27 22:57:24.000000000 +0200
+++ freeciv/server/stdinhand.c	2007-01-27 22:59:08.000000000 +0200
@@ -679,7 +679,7 @@
  /* medium */	H_RATES | H_TARGETS | H_HUTS | H_DIPLOMAT,
 		H_NONE,
  /* hard */	H_NONE,
-		H_NONE,
+ /* cheating */ H_NONE,
 		H_NONE,
  /* testing */	H_EXPERIMENTAL,
 		};
@@ -1075,7 +1075,7 @@
 	cmdlevel_name(first_access_level));
 
     fprintf(script_file, "%s\n",
-        (game.info.skill_level == 1) ?       "away" :
+        (game.info.skill_level == 1) ?  "away" :
 	(game.info.skill_level == 2) ?	"novice" :
 	(game.info.skill_level == 3) ?	"easy" :
 	(game.info.skill_level == 5) ?	"medium" :
@@ -1744,6 +1744,7 @@
     case 3 : return CMD_EASY;
     case 5 : return CMD_NORMAL;
     case 7 : return CMD_HARD;
+    case 8 : return CMD_CHEATING;
     case 10 : return CMD_EXPERIMENTAL;
   }
   assert(FALSE);
@@ -3557,6 +3558,7 @@
   case CMD_EASY:
   case CMD_NORMAL:
   case CMD_HARD:
+  case CMD_CHEATING:
   case CMD_EXPERIMENTAL:
     return set_ai_level_named(caller, arg, commands[cmd].name, check);
   case CMD_QUIT:
@@ -4430,6 +4432,7 @@
   CMD_EASY,
   CMD_NORMAL,
   CMD_HARD,
+  CMD_CHEATING,
   CMD_EXPERIMENTAL,
   CMD_REMOVE,
   CMD_TEAM,
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to