[freeciv-ai] Re: (PR#9247) cm shouldn't count waste as a good thing
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=9247 >
On Fri, Jul 16, 2004 at 08:11:56AM -0700, Jason Short wrote:
>
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=9247 >
>
> > [bhudson - Tue Jul 13 22:44:19 2004]:
>
> > Production is not used; it's not clear to me why the CM should care
> > about it at all.
>
> Agreed.
>
> > While we're at removing things, we could remove the factor_target too,
> > since (a) no code uses FT_EXTRA; (b) it shouldn't change the results
> > anyway; (c) it does change the results because the current 'base = min -
> > surplus' logic is wrong: higher surplus right now means lower score!
>
> Agreed.
>
> > Attached patch removes those and also merges some duplicated code
> > between cm.c and cma_core.c (only that duplicated code that is
> > affected).
>
> I like the idea but the patch doesn't apply (conflicts in cm.c) and
> doesn't compile (factor_target is still used in some of the GUI code).
Doesn't apply? Odd, I had just updated minutes before. As for
compiling for all the GUI front-ends, is there a convenient way of doing
that?
> It would also be nice to split it up into smaller patches, but that's
> not strictly necessary.
Looking more carefully, I wonder about removing factor_target -- what is
the dio_... stuff? I feel leery about changing an interface without
need. We could simply ignore the field, instead of removing it. This
also fixes the problem with GUI front-ends.
Attached: one patch (cm-ign-...) that ignores factor_target but does not
eliminate that field.
Independantly, one patch (cm-1-...) that removes the duplicate functions
from cma_core.c and makes them extern in cm.[ch] ; and one patch that
depends on it (cm-2-...) that removes the production field (and, while I
was at it, makes a couple things go from enumerating 0..5 into being a
for loop).
For reasons of my incompetance, ign and 1 apply with -p0 and 2 applies
with -p1.
-- Benoît
Index: common/aicore/cm.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/aicore/cm.c,v
retrieving revision 1.33
diff -b -u -p -r1.33 cm.c
--- common/aicore/cm.c 15 Jul 2004 20:43:32 -0000 1.33
+++ common/aicore/cm.c 16 Jul 2004 16:39:03 -0000
@@ -681,17 +681,8 @@ static void calc_fitness(struct city *pc
*minor_fitness = 0;
for (i = 0; i < NUM_STATS; i++) {
- int base;
- if (parameter->factor_target == FT_SURPLUS) {
- base = result->surplus[i];
- } else if (parameter->factor_target == FT_EXTRA) {
- base = parameter->minimal_surplus[i] - result->surplus[i];
- } else {
- base = 0;
- assert(0);
- }
-
- *major_fitness += base * parameter->factor[i];
+ assert(parameter->factor_target == FT_SURPLUS);
+ *major_fitness += result->surplus[i] * parameter->factor[i];
*minor_fitness += result->surplus[i];
}
Index: client/agents/cma_core.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/agents/cma_core.c,v
retrieving revision 1.54
diff -b -u -p -r1.54 cma_core.c
--- client/agents/cma_core.c 13 Jul 2004 18:16:54 -0000 1.54
+++ client/agents/cma_core.c 16 Jul 2004 15:57:57 -0000
@@ -85,23 +85,6 @@ static struct {
} city_map_checked_iterate_end; \
}
-/****************************************************************************
- Returns the number of workers of the given result. The given result
- has to be a result for the given city.
-*****************************************************************************/
-static int count_worker(struct city *pcity,
- const struct cm_result *const result)
-{
- int worker = 0;
-
- my_city_map_iterate(pcity, x, y) {
- if (result->worker_positions_used[x][y]) {
- worker++;
- }
- } my_city_map_iterate_end;
-
- return worker;
-}
#define T(x) if (result1->x != result2->x) { \
freelog(RESULTS_ARE_EQUAL_LOG_LEVEL, #x); \
@@ -148,119 +131,6 @@ static bool results_are_equal(struct cit
#undef T
-/****************************************************************************
- Print the current state of the given city via
- freelog(LOG_NORMAL,...).
-*****************************************************************************/
-static void print_city(struct city *pcity)
-{
- freelog(LOG_NORMAL, "print_city(city='%s'(id=%d))",
- pcity->name, pcity->id);
- freelog(LOG_NORMAL,
- " size=%d, entertainers=%d, scientists=%d, taxmen=%d",
- pcity->size, pcity->specialists[SP_ELVIS],
- pcity->specialists[SP_SCIENTIST],
- pcity->specialists[SP_TAXMAN]);
- freelog(LOG_NORMAL, " workers at:");
- my_city_map_iterate(pcity, x, y) {
- if (pcity->city_map[x][y] == C_TILE_WORKER) {
- freelog(LOG_NORMAL, " (%2d,%2d)", x, y);
- }
- } my_city_map_iterate_end;
-
- freelog(LOG_NORMAL, " food = %3d (%+3d)",
- pcity->food_prod, pcity->food_surplus);
- freelog(LOG_NORMAL, " shield = %3d (%+3d)",
- pcity->shield_prod + pcity->shield_waste, pcity->shield_prod);
- freelog(LOG_NORMAL, " trade = %3d (%+3d)",
- pcity->trade_prod + pcity->corruption, pcity->trade_prod);
-
- freelog(LOG_NORMAL, " gold = %3d (%+3d)", pcity->tax_total,
- city_gold_surplus(pcity));
- freelog(LOG_NORMAL, " luxury = %3d", pcity->luxury_total);
- freelog(LOG_NORMAL, " science = %3d", pcity->science_total);
-}
-
-/****************************************************************************
- Print the given result via freelog(LOG_NORMAL,...). The given result
- has to be a result for the given city.
-*****************************************************************************/
-static void print_result(struct city *pcity,
- const struct cm_result *const result)
-{
- int y, i, worker = count_worker(pcity, result);
-
- freelog(LOG_NORMAL, "print_result(result=%p)", result);
- freelog(LOG_NORMAL,
- "print_result: found_a_valid=%d disorder=%d happy=%d",
- result->found_a_valid, result->disorder, result->happy);
-#if UNUSED
- freelog(LOG_NORMAL, "print_result: workers at:");
- my_city_map_iterate(pcity, x, y) {
- if (result->worker_positions_used[x][y]) {
- freelog(LOG_NORMAL, "print_result: (%2d,%2d)", x, y);
- }
- } my_city_map_iterate_end;
-#endif
-
- for (y = 0; y < CITY_MAP_SIZE; y++) {
- char line[CITY_MAP_SIZE + 1];
- int x;
-
- line[CITY_MAP_SIZE] = 0;
-
- for (x = 0; x < CITY_MAP_SIZE; x++) {
- if (!is_valid_city_coords(x, y)) {
- line[x] = '-';
- } else if (is_city_center(x, y)) {
- line[x] = 'c';
- } else if (result->worker_positions_used[x][y]) {
- line[x] = 'w';
- } else {
- line[x] = '.';
- }
- }
- freelog(LOG_NORMAL, "print_result: %s", line);
- }
-
- freelog(LOG_NORMAL,
- "print_result: people: W/E/S/T %d/%d/%d/%d",
- worker, result->specialists[SP_ELVIS],
- result->specialists[SP_SCIENTIST], result->specialists[SP_TAXMAN]);
-
- for (i = 0; i < NUM_STATS; i++) {
- freelog(LOG_NORMAL,
- "print_result: %10s production=%d surplus=%d",
- cm_get_stat_name(i), result->production[i],
- result->surplus[i]);
- }
-}
-
-/****************************************************************************
- Copy the current production stats and happy status of the given city
- to the result.
-*****************************************************************************/
-static void copy_stats(struct city *pcity, struct cm_result *result)
-{
- result->production[FOOD] = pcity->food_prod;
- result->production[SHIELD] = pcity->shield_prod + pcity->shield_waste;
- result->production[TRADE] = pcity->trade_prod + pcity->corruption;
-
- result->surplus[FOOD] = pcity->food_surplus;
- result->surplus[SHIELD] = pcity->shield_surplus;
- result->surplus[TRADE] = pcity->trade_prod;
-
- result->production[GOLD] = pcity->tax_total;
- result->production[LUXURY] = pcity->luxury_total;
- result->production[SCIENCE] = pcity->science_total;
-
- result->surplus[GOLD] = city_gold_surplus(pcity);
- result->surplus[LUXURY] = result->production[LUXURY];
- result->surplus[SCIENCE] = result->production[SCIENCE];
-
- result->disorder = city_unhappy(pcity);
- result->happy = city_happy(pcity);
-}
/****************************************************************************
Copy the current city state (citizen assignment, production stats and
@@ -292,7 +162,7 @@ static void get_current_as_result(struct
result->found_a_valid = TRUE;
- copy_stats(pcity, result);
+ cm_copy_result_from_city(pcity, result);
}
/****************************************************************************
@@ -351,13 +221,13 @@ static bool apply_result_on_server(struc
connection_do_buffer(&aconnection);
/* Do checks */
- worker = count_worker(pcity, result);
+ worker = cm_count_worker(pcity, result);
if (pcity->size !=
(worker + result->specialists[SP_ELVIS]
+ result->specialists[SP_SCIENTIST]
+ result->specialists[SP_TAXMAN])) {
- print_city(pcity);
- print_result(pcity, result);
+ cm_print_city(pcity);
+ cm_print_result(pcity, result);
assert(0);
}
@@ -448,9 +318,9 @@ static bool apply_result_on_server(struc
if (SHOW_APPLY_RESULT_ON_SERVER_ERRORS) {
freelog(LOG_NORMAL, "expected");
- print_result(pcity, result);
+ cm_print_result(pcity, result);
freelog(LOG_NORMAL, "got");
- print_result(pcity, ¤t_state);
+ cm_print_result(pcity, ¤t_state);
}
}
return success;
Index: common/aicore/cm.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/aicore/cm.c,v
retrieving revision 1.33
diff -b -u -p -r1.33 cm.c
--- common/aicore/cm.c 15 Jul 2004 20:43:32 -0000 1.33
+++ common/aicore/cm.c 16 Jul 2004 15:57:57 -0000
@@ -236,8 +236,7 @@ struct tile_stats {
Returns the number of workers of the given result. The given result
has to be a result for the given city.
*****************************************************************************/
-static int count_worker(struct city *pcity,
- const struct cm_result *const result)
+int cm_count_worker(const struct city *pcity, const struct cm_result *result)
{
int worker = 0;
@@ -350,7 +349,7 @@ static bool is_valid_result(const struct
Print the current state of the given city via
freelog(LOG_NORMAL,...).
*****************************************************************************/
-static void print_city(struct city *pcity)
+void cm_print_city(const struct city *pcity)
{
freelog(LOG_NORMAL, "print_city(city='%s'(id=%d))",
pcity->name, pcity->id);
@@ -382,10 +381,10 @@ static void print_city(struct city *pcit
Print the given result via freelog(LOG_NORMAL,...). The given result
has to be a result for the given city.
*****************************************************************************/
-static void print_result(struct city *pcity,
+void cm_print_result(const struct city *pcity,
const struct cm_result *const result)
{
- int y, i, worker = count_worker(pcity, result);
+ int y, i, worker = cm_count_worker(pcity, result);
freelog(LOG_NORMAL, "print_result(result=%p)", result);
freelog(LOG_NORMAL,
@@ -460,7 +459,8 @@ static void print_combination(struct cit
Copy the current production stats and happy status of the given city
to the result.
*****************************************************************************/
-static void copy_stats(struct city *pcity, struct cm_result *result)
+void cm_copy_result_from_city(const struct city *pcity,
+ struct cm_result *result)
{
result->production[FOOD] = pcity->food_prod;
result->production[SHIELD] = pcity->shield_prod + pcity->shield_waste;
@@ -574,7 +574,7 @@ static void update_cache2(struct city *p
}
q = get_city_status(result->production[LUXURY],
- count_worker(pcity, result));
+ cm_count_worker(pcity, result));
if (!q->is_valid) {
q->disorder = result->disorder;
q->happy = result->happy;
@@ -611,7 +611,7 @@ static void clear_cache(void)
static void real_fill_out_result(struct city *pcity,
struct cm_result *result)
{
- int worker = count_worker(pcity, result);
+ int worker = cm_count_worker(pcity, result);
struct city backup;
freelog(LOG_DEBUG, "real_fill_out_result(city='%s'(%d))", pcity->name,
@@ -619,8 +619,8 @@ static void real_fill_out_result(struct
/* Do checks */
if (pcity->size != worker + get_num_specialists(result)) {
- print_city(pcity);
- print_result(pcity, result);
+ cm_print_city(pcity);
+ cm_print_result(pcity, result);
assert(0);
}
@@ -647,14 +647,14 @@ static void real_fill_out_result(struct
/* Do a local recalculation of the city */
generic_city_refresh(pcity, FALSE, NULL);
- copy_stats(pcity, result);
+ cm_copy_result_from_city(pcity, result);
/* Restore */
memcpy(pcity, &backup, sizeof(struct city));
freelog(LOG_DEBUG, "xyz: w=%d e=%d s=%d t=%d trade=%d "
"sci=%d lux=%d tax=%d dis=%s happy=%s",
- count_worker(pcity, result), result->specialists[SP_ELVIS],
+ cm_count_worker(pcity, result), result->specialists[SP_ELVIS],
result->specialists[SP_SCIENTIST], result->specialists[SP_TAXMAN],
result->production[TRADE],
result->production[SCIENCE],
@@ -1373,7 +1373,7 @@ static void optimize_final(struct city *
freelog(LOG_NORMAL, "expected:");
print_combination(pcity, current);
freelog(LOG_NORMAL, "got:");
- print_result(pcity, &result);
+ cm_print_result(pcity, &result);
assert(0);
}
}
Index: common/aicore/cm.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/aicore/cm.h,v
retrieving revision 1.6
diff -b -u -p -r1.6 cm.h
--- common/aicore/cm.h 16 Jun 2004 03:01:02 -0000 1.6
+++ common/aicore/cm.h 16 Jul 2004 15:57:57 -0000
@@ -89,4 +89,9 @@ bool cm_are_parameter_equal(const struct
const struct cm_parameter *const p2);
void cm_copy_parameter(struct cm_parameter *dest,
const struct cm_parameter *const src);
+
+void cm_print_city(const struct city *);
+void cm_print_result(const struct city *, const struct cm_result *);
+int cm_count_worker(const struct city *, const struct cm_result *);
+void cm_copy_result_from_city(const struct city *, struct cm_result *);
#endif
diff -rbup -X freeciv-cm-1-refactor/diff_ignore
freeciv-cm-1-refactor/client/agents/cma_core.c
freeciv-cm-2-noprod/client/agents/cma_core.c
--- freeciv-cm-1-refactor/client/agents/cma_core.c Fri Jul 16 11:51:08 2004
+++ freeciv-cm-2-noprod/client/agents/cma_core.c Fri Jul 16 12:16:53 2004
@@ -98,25 +98,16 @@ static bool results_are_equal(struct cit
const struct cm_result *const result1,
const struct cm_result *const result2)
{
+ enum cm_stat stat;
T(disorder);
T(happy);
T(specialists[SP_ELVIS]);
T(specialists[SP_SCIENTIST]);
T(specialists[SP_TAXMAN]);
- T(production[FOOD]);
- T(production[SHIELD]);
- T(production[TRADE]);
- T(production[GOLD]);
- T(production[LUXURY]);
- T(production[SCIENCE]);
-
- T(surplus[FOOD]);
- T(surplus[SHIELD]);
- T(surplus[TRADE]);
- T(surplus[GOLD]);
- T(surplus[LUXURY]);
- T(surplus[SCIENCE]);
+ for(stat=0; stat<NUM_STATS; ++stat) {
+ T(surplus[stat]);
+ }
my_city_map_iterate(pcity, x, y) {
if (result1->worker_positions_used[x][y] !=
diff -rbup -X freeciv-cm-1-refactor/diff_ignore
freeciv-cm-1-refactor/client/agents/cma_fec.c
freeciv-cm-2-noprod/client/agents/cma_fec.c
--- freeciv-cm-1-refactor/client/agents/cma_fec.c Sat May 29 16:34:31 2004
+++ freeciv-cm-2-noprod/client/agents/cma_fec.c Fri Jul 16 12:23:20 2004
@@ -345,19 +345,9 @@ const char *cmafec_get_result_descr(stru
for (j = 0; j < RESULT_COLUMNS; j++)
my_snprintf(buf[j], BUFFER_SIZE, "---");
} else {
- my_snprintf(buf[0], BUFFER_SIZE, "%3d(%+3d)",
- result->production[FOOD], result->surplus[FOOD]);
- my_snprintf(buf[1], BUFFER_SIZE, "%3d(%+3d)",
- result->production[SHIELD], result->surplus[SHIELD]);
- my_snprintf(buf[2], BUFFER_SIZE, "%3d(%+3d)",
- result->production[TRADE], result->surplus[TRADE]);
-
- my_snprintf(buf[3], BUFFER_SIZE, "%3d(%+3d)",
- result->production[GOLD], result->surplus[GOLD]);
- my_snprintf(buf[4], BUFFER_SIZE, "%3d(%+3d)",
- result->production[LUXURY], result->surplus[LUXURY]);
- my_snprintf(buf[5], BUFFER_SIZE, "%3d(%+3d)",
- result->production[SCIENCE], result->surplus[SCIENCE]);
+ for (j = 0; j < NUM_STATS; ++j) {
+ my_snprintf(buf[j], BUFFER_SIZE, "%+3d", result->surplus[j]);
+ }
my_snprintf(buf[6], BUFFER_SIZE, "%d/%d/%d/%d%s",
pcity->size -
@@ -387,8 +377,10 @@ const char *cmafec_get_result_descr(stru
" City grows: %s\n"
"Production completed: %s"),
buf[9],
- buf[0], buf[3],
- buf[1], buf[4], buf[2], buf[5], buf[6], buf[7], buf[8]);
+ buf[FOOD], buf[GOLD],
+ buf[SHIELD], buf[LUXURY],
+ buf[TRADE], buf[SCIENCE],
+ buf[6], buf[7], buf[8]);
freelog(LOG_DEBUG, "\n%s", buffer);
return buffer;
Only in freeciv-cm-2-noprod/common/aicore: .cm.c.swn
Only in freeciv-cm-2-noprod/common/aicore: .cm.c.swo
Only in freeciv-cm-2-noprod/common/aicore: .cm.h.swo
diff -rbup -X freeciv-cm-1-refactor/diff_ignore
freeciv-cm-1-refactor/common/aicore/cm.c freeciv-cm-2-noprod/common/aicore/cm.c
--- freeciv-cm-1-refactor/common/aicore/cm.c Fri Jul 16 11:54:34 2004
+++ freeciv-cm-2-noprod/common/aicore/cm.c Fri Jul 16 12:15:38 2004
@@ -163,7 +163,7 @@ static struct {
struct secondary_stat {
bool is_valid;
- short int production, surplus;
+ short int surplus;
} *secondary_stats;
struct city_status {
bool is_valid, disorder, happy;
@@ -427,9 +427,8 @@ void cm_print_result(const struct city *
for (i = 0; i < NUM_STATS; i++) {
freelog(LOG_NORMAL,
- "print_result: %10s production=%d surplus=%d",
- cm_get_stat_name(i), result->production[i],
- result->surplus[i]);
+ "print_result: %10s surplus=%d",
+ cm_get_stat_name(i), result->surplus[i]);
}
}
@@ -462,21 +461,12 @@ static void print_combination(struct cit
void cm_copy_result_from_city(const struct city *pcity,
struct cm_result *result)
{
- result->production[FOOD] = pcity->food_prod;
- result->production[SHIELD] = pcity->shield_prod + pcity->shield_waste;
- result->production[TRADE] = pcity->trade_prod + pcity->corruption;
-
result->surplus[FOOD] = pcity->food_surplus;
result->surplus[SHIELD] = pcity->shield_surplus;
result->surplus[TRADE] = pcity->trade_prod;
-
- result->production[GOLD] = pcity->tax_total;
- result->production[LUXURY] = pcity->luxury_total;
- result->production[SCIENCE] = pcity->science_total;
-
result->surplus[GOLD] = city_gold_surplus(pcity);
- result->surplus[LUXURY] = result->production[LUXURY];
- result->surplus[SCIENCE] = result->production[SCIENCE];
+ result->surplus[LUXURY] = pcity->luxury_total;
+ result->surplus[SCIENCE] = pcity->science_total;
result->disorder = city_unhappy(pcity);
result->happy = city_happy(pcity);
@@ -528,16 +518,14 @@ static void update_cache2(struct city *p
* unhappy_city_check.
*/
if (!result->disorder) {
- p = get_secondary_stat(result->production[TRADE],
+ p = get_secondary_stat(result->surplus[TRADE],
result->specialists[SP_SCIENTIST],
SP_SCIENTIST);
if (!p->is_valid) {
- p->production = result->production[SCIENCE];
p->surplus = result->surplus[SCIENCE];
p->is_valid = TRUE;
} else {
- assert(p->production == result->production[SCIENCE] &&
- p->surplus == result->surplus[SCIENCE]);
+ assert(p->surplus == result->surplus[SCIENCE]);
}
}
@@ -546,34 +534,30 @@ static void update_cache2(struct city *p
* unhappy_city_check.
*/
if (!result->disorder) {
- p = get_secondary_stat(result->production[TRADE],
+ p = get_secondary_stat(result->surplus[TRADE],
result->specialists[SP_TAXMAN],
SP_TAXMAN);
if (!p->is_valid && !result->disorder) {
- p->production = result->production[GOLD];
p->surplus = result->surplus[GOLD];
p->is_valid = TRUE;
} else {
- assert(p->production == result->production[GOLD] &&
- p->surplus == result->surplus[GOLD]);
+ assert(p->surplus == result->surplus[GOLD]);
}
}
- p = get_secondary_stat(result->production[TRADE],
+ p = get_secondary_stat(result->surplus[TRADE],
result->specialists[SP_ELVIS],
SP_ELVIS);
if (!p->is_valid) {
- p->production = result->production[LUXURY];
p->surplus = result->surplus[LUXURY];
p->is_valid = TRUE;
} else {
if (!result->disorder) {
- assert(p->production == result->production[LUXURY] &&
- p->surplus == result->surplus[LUXURY]);
+ assert(p->surplus == result->surplus[LUXURY]);
}
}
- q = get_city_status(result->production[LUXURY],
+ q = get_city_status(result->surplus[LUXURY],
cm_count_worker(pcity, result));
if (!q->is_valid) {
q->disorder = result->disorder;
@@ -656,10 +640,10 @@ static void real_fill_out_result(struct
"sci=%d lux=%d tax=%d dis=%s happy=%s",
cm_count_worker(pcity, result), result->specialists[SP_ELVIS],
result->specialists[SP_SCIENTIST], result->specialists[SP_TAXMAN],
- result->production[TRADE],
- result->production[SCIENCE],
- result->production[LUXURY],
- result->production[GOLD],
+ result->surplus[TRADE],
+ result->surplus[SCIENCE],
+ result->surplus[LUXURY],
+ result->surplus[GOLD],
result->disorder ? "yes" : "no", result->happy ? "yes" : "no");
update_cache2(pcity, result);
}
@@ -843,42 +827,37 @@ static void fill_out_result(struct city
* all_entertainer result
*/
for (i = 0; i < NUM_PRIMARY_STATS; i++) {
- result->production[i] =
- base_combination->all_entertainer.production[i];
result->surplus[i] = base_combination->all_entertainer.surplus[i];
}
- p = get_secondary_stat(result->production[TRADE],
+ p = get_secondary_stat(result->surplus[TRADE],
result->specialists[SP_SCIENTIST],
SP_SCIENTIST);
if (!p->is_valid) {
got_all = FALSE;
} else {
- result->production[SCIENCE] = p->production;
result->surplus[SCIENCE] = p->surplus;
}
- p = get_secondary_stat(result->production[TRADE],
+ p = get_secondary_stat(result->surplus[TRADE],
result->specialists[SP_TAXMAN],
SP_TAXMAN);
if (!p->is_valid) {
got_all = FALSE;
} else {
- result->production[GOLD] = p->production;
result->surplus[GOLD] = p->surplus;
}
- p = get_secondary_stat(result->production[TRADE],
+ p = get_secondary_stat(result->surplus[TRADE],
result->specialists[SP_ELVIS],
SP_ELVIS);
if (!p->is_valid) {
got_all = FALSE;
} else {
- result->production[LUXURY] = p->production;
result->surplus[LUXURY] = p->surplus;
}
- q = get_city_status(result->production[LUXURY],
+ q = get_city_status(result->surplus[LUXURY],
base_combination->worker);
if (!q->is_valid) {
got_all = FALSE;
@@ -1352,7 +1331,7 @@ static void optimize_final(struct city *
for (i = 0; i < MAX_COMBINATIONS; i++) {
struct combination *current =
&cache3.results[fields_used].combinations[i];
- int stat, major_fitness, minor_fitness;
+ int major_fitness, minor_fitness;
struct cm_result result;
if (!current->is_valid) {
@@ -1364,19 +1343,6 @@ static void optimize_final(struct city *
/* this will set the all_entertainer result */
fill_out_result(pcity, &result, current, 0, 0);
- /*
- * Check. The actual production can be bigger because of city
- * improvements such a Factory.
- */
- for (stat = 0; stat < NUM_PRIMARY_STATS; stat++) {
- if (result.production[stat] < current->production2[stat]) {
- freelog(LOG_NORMAL, "expected:");
- print_combination(pcity, current);
- freelog(LOG_NORMAL, "got:");
- cm_print_result(pcity, &result);
- assert(0);
- }
- }
/*
* the secondary stats aren't calculated yet but we want to use
diff -rbup -X freeciv-cm-1-refactor/diff_ignore
freeciv-cm-1-refactor/common/aicore/cm.h freeciv-cm-2-noprod/common/aicore/cm.h
--- freeciv-cm-1-refactor/common/aicore/cm.h Fri Jul 16 11:51:15 2004
+++ freeciv-cm-2-noprod/common/aicore/cm.h Fri Jul 16 12:14:39 2004
@@ -53,7 +53,6 @@ struct cm_parameter {
struct cm_result {
bool found_a_valid, disorder, happy;
- int production[NUM_STATS];
int surplus[NUM_STATS];
bool worker_positions_used[CITY_MAP_SIZE][CITY_MAP_SIZE];
|
|