forked from Warzone2100/warzone2100
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathai.h
81 lines (61 loc) · 2.92 KB
/
ai.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
This file is part of Warzone 2100.
Copyright (C) 1999-2004 Eidos Interactive
Copyright (C) 2005-2012 Warzone 2100 Project
Warzone 2100 is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Warzone 2100 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Warzone 2100; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/** @file
* Definitions for the AI system structures
*/
#ifndef __INCLUDED_SRC_AI_H__
#define __INCLUDED_SRC_AI_H__
#include "droiddef.h"
#define ALLIANCE_BROKEN 0 // states of alliance between players
#define ALLIANCE_REQUESTED 1
#define ALLIANCE_INVITATION 2
#define ALLIANCE_FORMED 3
#define ALLIANCE_NULL 4 // for setting values only.
#define NO_ALLIANCES 0 //alliance possibilities for games.
#define ALLIANCES 1
#define ALLIANCES_TEAMS 2 //locked teams
// alliances
extern uint8_t alliances[MAX_PLAYER_SLOTS][MAX_PLAYER_SLOTS];
extern PlayerMask alliancebits[MAX_PLAYER_SLOTS];
extern PlayerMask satuplinkbits;
/** Check no alliance has formed. This is a define to make sure we inline it. */
#define aiCheckAlliances(_s1, _s2) (alliances[_s1][_s2] == ALLIANCE_FORMED)
/* Initialise the AI system */
bool aiInitialise(void);
/* Shutdown the AI system */
bool aiShutdown(void);
/* Initialise a droid structure for AI */
//extern bool aiInitDroid(DROID *psDroid);
/* Do the AI for a droid */
void aiUpdateDroid(DROID *psDroid);
// Find the nearest best target for a droid
// returns integer representing quality of choice, -1 if failed
int aiBestNearestTarget(DROID *psDroid, BASE_OBJECT **ppsObj, int weapon_slot, int extraRange = 0);
int aiBestNearestTarget(DROID *psDroid, BASE_OBJECT **ppsObj, int weapon_slot, void const *extraRange);
// Are there a lot of bullets heading towards the structure?
bool aiObjectIsProbablyDoomed(BASE_OBJECT *psObject);
// Update the expected damage of the object.
void aiObjectAddExpectedDamage(BASE_OBJECT *psObject, SDWORD damage);
/* See if there is a target in range added int weapon_slot*/
bool aiChooseTarget(BASE_OBJECT *psObj,
BASE_OBJECT **ppsTarget, int weapon_slot, bool bUpdateTarget, UWORD *targetOrigin);
/** See if there is a target in range for Sensor objects. */
bool aiChooseSensorTarget(BASE_OBJECT *psObj, BASE_OBJECT **ppsTarget);
/*set of rules which determine whether the weapon associated with the object
can fire on the propulsion type of the target*/
bool validTarget(BASE_OBJECT *psObject, BASE_OBJECT *psTarget, int weapon_slot);
#endif // __INCLUDED_SRC_AI_H__