Prepared new AI.
This commit is contained in:
parent
fd6da9424b
commit
ee6388e291
3 changed files with 31 additions and 15 deletions
29
include/ai.h
29
include/ai.h
|
@ -1,9 +1,16 @@
|
|||
/*
|
||||
** A clone of a famous game.
|
||||
*/
|
||||
// ___________ _________ _____ __
|
||||
// \_ _____/______ ____ ____ \_ ___ \____________ _/ ____\/ |_
|
||||
// | __) \_ __ \_/ __ \_/ __ \/ \ \/\_ __ \__ \\ __\\ __\
|
||||
// | \ | | \/\ ___/\ ___/\ \____| | \// __ \| | | |
|
||||
// \___ / |__| \___ >\___ >\______ /|__| (____ /__| |__|
|
||||
// \/ \/ \/ \/ \/
|
||||
// ______________________ ______________________
|
||||
// T H E W A R B E G I N S
|
||||
// FreeCraft - A free fantasy real time strategy game engine
|
||||
//
|
||||
/**@name ai.h - The ai headerfile. */
|
||||
/*
|
||||
** (c) Copyright 1998,1999 by Lutz Sammer
|
||||
** (c) Copyright 1998-2000 by Lutz Sammer
|
||||
**
|
||||
** $Id$
|
||||
*/
|
||||
|
@ -13,6 +20,12 @@
|
|||
|
||||
//@{
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
-- Includes
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "player.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
-- Variables
|
||||
----------------------------------------------------------------------------*/
|
||||
|
@ -25,9 +38,11 @@ extern int AiCostFactor; /// Adjust the AI costs
|
|||
-- Functions
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
extern void AiEachFrame(int player); /// Called each frame
|
||||
extern void AiEachSecond(int player); /// Called each second
|
||||
extern void AiInit(int player); /// Init AI for this player
|
||||
extern void AiEachFrame(Player* player);/// Called each frame
|
||||
extern void AiEachSecond(Player* player);/// Called each second
|
||||
extern void AiInit(Player* player); /// Init AI for this player
|
||||
|
||||
extern void AiCclRegister(void); /// register ccl features
|
||||
|
||||
/*--------------------------------------------------------
|
||||
-- Call Backs/Triggers
|
||||
|
|
|
@ -47,7 +47,7 @@ struct _player_ {
|
|||
unsigned Type; /// type of player (human,computer,...)
|
||||
unsigned Race; /// race of player (orc,human,...)
|
||||
unsigned Team; /// team of player
|
||||
unsigned Ai; /// AI for computer
|
||||
unsigned AiNum; /// AI for computer
|
||||
|
||||
unsigned X; /// map tile start X position
|
||||
unsigned Y; /// map tile start Y position
|
||||
|
@ -61,6 +61,7 @@ struct _player_ {
|
|||
unsigned UnitTypesCount[UnitTypeInternalMax]; /// each type unit count
|
||||
|
||||
unsigned AiEnabled; /// handle ai on this computer
|
||||
void* Ai; /// Ai structure pointer
|
||||
|
||||
Unit** Units; /// units of this player
|
||||
unsigned TotalNumUnits; /// total # units for units' list.
|
||||
|
|
|
@ -147,7 +147,7 @@ global void CreatePlayer(char* name,int type)
|
|||
player->Type=type;
|
||||
player->Race=PlayerRaceHuman;
|
||||
player->Team=team;
|
||||
player->Ai=PlayerAiUniversal;
|
||||
player->AiNum=PlayerAiUniversal;
|
||||
|
||||
//
|
||||
// Initial default resources.
|
||||
|
@ -205,7 +205,7 @@ global void PlayerSetSide(Player* player,int side)
|
|||
*/
|
||||
global void PlayerSetAiNum(Player* player,int ai)
|
||||
{
|
||||
player->Ai=ai;
|
||||
player->AiNum=ai;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
|
@ -423,7 +423,7 @@ global void PlayersInitAi(void)
|
|||
|
||||
for( player=0; player<NumPlayers; ++player ) {
|
||||
if( Players[player].AiEnabled ) {
|
||||
AiInit(player);
|
||||
AiInit(&Players[player]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -437,7 +437,7 @@ global void PlayersEachFrame(void)
|
|||
|
||||
for( player=0; player<NumPlayers; ++player ) {
|
||||
if( Players[player].AiEnabled ) {
|
||||
AiEachFrame(player);
|
||||
AiEachFrame(&Players[player]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -451,7 +451,7 @@ global void PlayersEachSecond(void)
|
|||
|
||||
for( player=0; player<NumPlayers; ++player ) {
|
||||
if( Players[player].AiEnabled ) {
|
||||
AiEachSecond(player);
|
||||
AiEachSecond(&Players[player]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -604,8 +604,8 @@ global void DebugPlayers(void)
|
|||
case PlayerRaceNeutral: DebugLevel0("neutral "); break;
|
||||
default: DebugLevel0("what %d ",Players[i].Race); break;
|
||||
}
|
||||
DebugLevel0("%2d ",Players[i].Ai);
|
||||
switch( Players[i].Ai ) {
|
||||
DebugLevel0("%2d ",Players[i].AiNum);
|
||||
switch( Players[i].AiNum ) {
|
||||
case PlayerAiLand: DebugLevel0("(land)"); break;
|
||||
case PlayerAiPassive: DebugLevel0("(passive)"); break;
|
||||
case PlayerAiAir: DebugLevel0("(air)"); break;
|
||||
|
|
Loading…
Reference in a new issue