Set to version 1.16.1 and prepared new ai code.

This commit is contained in:
johns 2000-03-31 15:02:05 +00:00
parent 4b9c9bb396
commit 23ec67c664
10 changed files with 114 additions and 39 deletions

View file

@ -17,7 +17,7 @@
all: $(OBJS)
doc: $(OBJS:.o=.doc)
doc: $(OBJS:.o=.doc) $(HDRS:.h=.doc)
clean::
$(RM) $(OBJS) core *.doc
@ -27,7 +27,8 @@ clobber: clean
depend::
@echo -n >.depend
@for i in $(OBJS:.o=.c) ; do $(CC) -MM $(GLIB) $(IFLAGS) $$i >>.depend ; done
@for i in $(OBJS:.o=.c) ; do\
$(CC) -MM $(GLIB) $(IFLAGS) $$i >>.depend ; done
tags::
@for i in $(OBJS:.o=.c) ; do\
@ -37,20 +38,20 @@ tags::
done
ci::
ci -l $(OBJS:.o=.c) Makefile
ci -l $(OBJS:.o=.c) $(HDRS) Makefile
lockver::
$(LOCKVER) $(OBJS:.o=.c) Makefile
$(LOCKVER) $(OBJS:.o=.c) $(HDRS) Makefile
distlist::
@echo >>$(DISTLIST)
@for i in `echo $(OBJS:.o=.c)` Makefile $(EXTRA) ; do \
@for i in `echo $(OBJS:.o=.c)` $(HDRS) Makefile $(EXTRA) ; do \
echo src/$(MODULE)/$$i >>$(DISTLIST) ; done
$(OBJS): $(TOPDIR)/Rules.make
#
# include dependency files they exist
# include dependency files, if they exist
#
ifeq (.depend,$(wildcard .depend))
include .depend

View file

@ -169,7 +169,7 @@ XIFLAGS = -I/usr/X11R6/include -I/usr/local/include \
#PROFILE= -pg
# Version
VERSION= '-DVERSION="1.16.1pre2"'
VERSION= '-DVERSION="1.16.1"'
############################################################################
# below this, nothing should be changed!

View file

@ -169,7 +169,7 @@ XIFLAGS = -I/usr/X11R6/include -I/usr/local/include \
#PROFILE= -pg
# Version
VERSION= '-DVERSION="1.16.1pre2"'
VERSION= '-DVERSION="1.16.1"'
############################################################################
# below this, nothing should be changed!

2
setup
View file

@ -33,7 +33,7 @@ MAKE=make
#------------------------------------------------------------------------------
# DON'T CHANGE ANYTHING FROM HERE DOWN UNLESS YOU KNOW WHAT YOU ARE DOING
VERSION="-DVERSION=\"1.16.1pre2-19\""
VERSION="-DVERSION=\"1.16.1\""
WIN32=-1
# Choose optimization level

View file

@ -21,6 +21,8 @@ include $(TOPDIR)/Rules.make
MODULE = ai
OBJS = ai.$(OE)
HDRS = ai_local.h
OBJS = ai.$(OE) new_ai.$(OE) ccl_ai.$(OE)
include $(TOPDIR)/Common.mk

19
src/ai/ai.cpp Normal file
View file

@ -0,0 +1,19 @@
// ___________ _________ _____ __
// \_ _____/______ ____ ____ \_ ___ \____________ _/ ____\/ |_
// | __) \_ __ \_/ __ \_/ __ \/ \ \/\_ __ \__ \\ __\\ __\
// | \ | | \/\ ___/\ ___/\ \____| | \// __ \| | | |
// \___ / |__| \___ >\___ >\______ /|__| (____ /__| |__|
// \/ \/ \/ \/ \/
// ______________________ ______________________
// T H E W A R B E G I N S
// FreeCraft - A free fantasy real time strategy game engine
//
/**@name new_ai.c - The new computer player AI main file. */
/*
** (c) Copyright 2000 by Lutz Sammer
**
** $Id$
*/
#ifdef NEW_AI // {
#endif // } NEW_AI

26
src/ai/ai_local.h Normal file
View file

@ -0,0 +1,26 @@
// ___________ _________ _____ __
// \_ _____/______ ____ ____ \_ ___ \____________ _/ ____\/ |_
// | __) \_ __ \_/ __ \_/ __ \/ \ \/\_ __ \__ \\ __\\ __\
// | \ | | \/\ ___/\ ___/\ \____| | \// __ \| | | |
// \___ / |__| \___ >\___ >\______ /|__| (____ /__| |__|
// \/ \/ \/ \/ \/
// ______________________ ______________________
// T H E W A R B E G I N S
// FreeCraft - A free fantasy real time strategy game engine
//
/**@name ai_local.h - The local AI header file. */
/*
** (c) Copyright 2000 by Lutz Sammer
**
** $Id$
*/
#ifndef __AI_LOCAL_H__
#define __AI_LOCAL_H__
//@{
//@}
#endif // !__AI_LOCAL_H__

View file

@ -15,6 +15,8 @@
** $Id$
*/
#ifndef NEW_AI // {
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -1360,9 +1362,9 @@ global void AiTrainingComplete(Unit* unit,Unit* what)
/**
** This is called for each player, each frame.
**
** @param player The player number.
** @param player The player structure pointer.
*/
global void AiEachFrame(int player)
global void AiEachFrame(Player* player)
{
AiCommand command;
@ -1372,8 +1374,8 @@ global void AiEachFrame(int player)
return;
}
AiPlayer=&Ais[player];
DebugLevel3(__FUNCTION__": Player %d\n",player);
AiPlayer=player->Ai;
DebugLevel3(__FUNCTION__": Player %d\n",player->Player);
command = AiPlayer->Commands[AiPlayer->CmdIndex];
if(AiPlayer->GoalHead->Next == 0)
{
@ -1394,15 +1396,15 @@ global void AiEachFrame(int player)
/**
** This called for each player, each second.
**
** @param player The player number.
** @param player The player structure pointer.
*/
global void AiEachSecond(int player)
global void AiEachSecond(Player* player)
{
DebugLevel3(__FUNCTION__": Player %d\n",player);
DebugLevel3(__FUNCTION__": Player %d\n",player->Player);
if( AiSleep ) { // wait some time. FIXME: see above
return;
}
AiPlayer=&Ais[player]; // Prepare ai.
AiPlayer=player->Ai; // Prepare ai.
AiAssignWorker();
if(AiCommandAttack(UnitBallista,
ForceAttacking[AiPlayer->CurrentAttack].Ballista,
@ -1419,18 +1421,19 @@ global void AiEachSecond(int player)
/**
** Setup all at start.
**
** @param player The player number.
** @param player The player structure pointer.
*/
global void AiInit(int player)
global void AiInit(Player* player)
{
int i;
int j;
PlayerAi* aip;
Unit* units[MAX_UNITS];
DebugLevel2(__FUNCTION__": Player %d\n",player);
aip=&Ais[player];
aip->Player=&Players[player];
DebugLevel2(__FUNCTION__": Player %d\n",player->Player);
player->Ai=aip=&Ais[player->Player];
aip->Player=player;
for(i=0; i<UnitTypeMax/(sizeof(int)*8); ++i) {aip->Build[i]=0;}
aip->GoalHead=(AiGoal*)&aip->GoalNil1;
aip->GoalNil1=(AiGoal*)0;
@ -1453,9 +1456,9 @@ global void AiInit(int player)
//
for( i=0; i<UnitTypeInternalMax; ++i ) {
for( j=0; j<MaxCosts; ++j ) {
UnitTypes[i].Stats[player].Costs[j]*=
UnitTypes[i].Stats[player->Player].Costs[j]*=
j==TimeCost ? AiTimeFactor : AiCostFactor;
UnitTypes[i].Stats[player].Costs[j]/=100;
UnitTypes[i].Stats[player->Player].Costs[j]/=100;
}
}
@ -1467,3 +1470,4 @@ global void AiInit(int player)
}
#endif // } NEW_AI

37
src/ai/script_ai.cpp Normal file
View file

@ -0,0 +1,37 @@
// ___________ _________ _____ __
// \_ _____/______ ____ ____ \_ ___ \____________ _/ ____\/ |_
// | __) \_ __ \_/ __ \_/ __ \/ \ \/\_ __ \__ \\ __\\ __\
// | \ | | \/\ ___/\ ___/\ \____| | \// __ \| | | |
// \___ / |__| \___ >\___ >\______ /|__| (____ /__| |__|
// \/ \/ \/ \/ \/
// ______________________ ______________________
// T H E W A R B E G I N S
// FreeCraft - A free fantasy real time strategy game engine
//
/**@name ccl_ai.c - The AI ccl functions. */
/*
** (c) Copyright 2000 by Lutz Sammer
**
** $Id$
*/
//@{
#include <stdio.h>
#include <stdlib.h>
#include "clone.h"
#if defined(USE_CCL) || defined(USE_CCL2) // {
/**
** Register CCL features for unit-type.
*/
global void AiCclRegister(void)
{
// FIXME: Need to save memory here.
}
#endif // } USE_CCL && USE_CCL2
//@}

View file

@ -36,18 +36,4 @@ HDRS = actions.h ai.h ccl.h clone.h construct.h cursor.h font.h icons.h \
all:
echo done.
doc: $(HDRS:.h=.doc)
distlist::
#echo src/include/Makefile >>$(DISTLIST)
@for i in $(HDRS) ; do echo src/include/$$i >>$(DISTLIST) ; done
ci::
@ci -l Makefile
@for i in $(HDRS) ; do ci -l $$i ; done
lockver::
@for i in $(HDRS) ; do $(LOCKVER) $$i ; done
@$(LOCKVER) Makefile
include $(TOPDIR)/Common.mk