Index: ai/Makefile.am =================================================================== RCS file: /home/freeciv/CVS/freeciv/ai/Makefile.am,v retrieving revision 1.5 diff -u -r1.5 Makefile.am --- Makefile.am 1998/11/15 01:42:35 1.5 +++ Makefile.am 1999/06/17 16:22:01 @@ -19,6 +19,8 @@ advmilitary.h \ advscience.c \ advscience.h \ + advspace.c \ + advspace.h \ advtrade.c \ advtrade.h \ aicity.c \ Index: ai/Makefile.in =================================================================== RCS file: /home/freeciv/CVS/freeciv/ai/Makefile.in,v retrieving revision 1.11 diff -u -r1.11 Makefile.in --- Makefile.in 1999/06/13 05:15:00 1.11 +++ Makefile.in 1999/06/17 16:22:01 @@ -84,7 +84,7 @@ INCLUDES = -I$(srcdir)/../common -I$(srcdir)/../server -libcivai_a_SOURCES = advattitude.c advattitude.h advdomestic.c advdomestic.h advforeign.c advforeign.h advisland.c advisland.h advleader.c advleader.h advmilitary.c advmilitary.h advscience.c advscience.h advtrade.c advtrade.h aicity.c aicity.h aihand.c aihand.h aitech.c aitech.h aitools.c aitools.h aiunit.c aiunit.h +libcivai_a_SOURCES = advattitude.c advattitude.h advdomestic.c advdomestic.h advforeign.c advforeign.h advisland.c advisland.h advleader.c advleader.h advmilitary.c advmilitary.h advscience.c advscience.h advspace.c advspace.h advtrade.c advtrade.h aicity.c aicity.h aihand.c aihand.h aitech.c aitech.h aitools.c aitools.h aiunit.c aiunit.h mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = ../config.h @@ -102,8 +102,8 @@ X_PRE_LIBS = @X_PRE_LIBS@ libcivai_a_LIBADD = libcivai_a_OBJECTS = advattitude.o advdomestic.o advforeign.o \ -advisland.o advleader.o advmilitary.o advscience.o advtrade.o aicity.o \ -aihand.o aitech.o aitools.o aiunit.o +advisland.o advleader.o advmilitary.o advscience.o advspace.o advtrade.o \ +aicity.o aihand.o aitech.o aitools.o aiunit.o AR = ar CFLAGS = @CFLAGS@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -118,8 +118,8 @@ GZIP_ENV = --best DEP_FILES = .deps/advattitude.P .deps/advdomestic.P .deps/advforeign.P \ .deps/advisland.P .deps/advleader.P .deps/advmilitary.P \ -.deps/advscience.P .deps/advtrade.P .deps/aicity.P .deps/aihand.P \ -.deps/aitech.P .deps/aitools.P .deps/aiunit.P +.deps/advscience.P .deps/advspace.P .deps/advtrade.P .deps/aicity.P \ +.deps/aihand.P .deps/aitech.P .deps/aitools.P .deps/aiunit.P SOURCES = $(libcivai_a_SOURCES) OBJECTS = $(libcivai_a_OBJECTS) Index: ai/advdomestic.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/ai/advdomestic.c,v retrieving revision 1.40 diff -u -r1.40 advdomestic.c --- advdomestic.c 1999/06/12 07:41:35 1.40 +++ advdomestic.c 1999/06/17 16:22:02 @@ -353,6 +353,24 @@ game.foodbox - pcity->food_stock)); } + if (game.spacerace) { + if (could_build_improvement(pcity, B_SCOMP)) { + if (pplayer->spaceship.components < NUM_SS_COMPONENTS) { + values[B_SCOMP] = values[B_CAPITAL]+1; + } + } + if (could_build_improvement(pcity, B_SMODULE)) { + if (pplayer->spaceship.modules < NUM_SS_MODULES) { + values[B_SMODULE] = values[B_CAPITAL]+1; + } + } + if (could_build_improvement(pcity, B_SSTRUCTURAL)) { + if (pplayer->spaceship.structurals < NUM_SS_STRUCTURALS) { + values[B_SSTRUCTURAL] = values[B_CAPITAL]+1; + } + } + } + if (could_build_improvement(pcity, B_STOCK)) values[B_STOCK] = (tax + 3*pcity->ppl_taxman + pcity->ppl_elvis*wwtv)/2; @@ -455,6 +473,11 @@ if (punit->unhappiness) values[i] += t * 2; unit_list_iterate_end; } + + if ((i == B_APOLLO) && game.spacerace) { + values[i] = values[B_CAPITAL]+1; + } + /* ignoring APOLLO, LIGHTHOUSE, MAGELLAN, MANHATTEN, STATUE, UNITED */ } } Index: ai/aihand.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/ai/aihand.c,v retrieving revision 1.36 diff -u -r1.36 aihand.c --- aihand.c 1999/06/12 07:41:38 1.36 +++ aihand.c 1999/06/17 16:22:02 @@ -27,12 +27,14 @@ #include "cityhand.h" #include "citytools.h" #include "cityturn.h" +#include "spacerace.h" #include "unithand.h" #include "aicity.h" #include "aitech.h" #include "aitools.h" #include "aiunit.h" +#include "advspace.h" #include "aihand.h" @@ -97,6 +99,7 @@ void ai_manage_taxes(struct player *pplayer); void ai_manage_government(struct player *pplayer); void ai_manage_diplomacy(struct player *pplayer); +void ai_manage_spaceship(struct player *pplayer); void ai_after_work(struct player *pplayer); @@ -125,6 +128,9 @@ ai_manage_government(pplayer); ai_manage_diplomacy(pplayer); ai_manage_tech(pplayer); + freelog(LOG_DEBUG, "Managing %s's spaceship.", pplayer->name); + ai_manage_spaceship(pplayer); + freelog(LOG_DEBUG, "Managing %s's taxes.", pplayer->name); ai_after_work(pplayer); freelog(LOG_DEBUG, "Done with %s.", pplayer->name); } @@ -146,6 +152,20 @@ void ai_manage_diplomacy(struct player *pplayer) { +} + +void ai_manage_spaceship(struct player *pplayer) +{ + if (game.spacerace) { + if (pplayer->spaceship.state == SSHIP_STARTED) { + ai_spaceship_autoplace(pplayer, &pplayer->spaceship); + /* if we have built the best possible spaceship -- AJS 19990610 */ + if ((pplayer->spaceship.structurals == NUM_SS_STRUCTURALS) && + (pplayer->spaceship.components == NUM_SS_COMPONENTS) && + (pplayer->spaceship.modules == NUM_SS_MODULES)) + handle_spaceship_launch(pplayer); + } + } } /**************************************************************************