[go: up one dir, main page]

Menu

[r6099]: / trunk / ethereal / ai.h  Maximize  Restore  History

Download this file

47 lines (44 with data), 1.3 kB

 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
///Generic AI function utilising Newton's First Law
class AI {
public:
///Every AI needs a Clone function
AI * Clone()const;
/** this function can be overwritten by the subclass's function */
virtual void Execute(class Spectre *parent);
virtual ~AI(){}
};
class VirtualSocket {
class Packet {
char data [2048];///< FIXME not quite so simple
};
std::vector<Packet> inputQueue;
public:
void write (const Packet &p);
Packet *read ();//something like this
~VirtualSocket(){}
};
///Networked AI, communicating over a socket,
class NetworkAI:public AI {
protected:
VirtualSocket sockt;///< Allows This to write and read from the server as if it were the only thing listening
public:
NetworkAI (VirtualSocket vs);
AI * Clone ()const {return new NetworkAI(sockt);}
virtual void Execute (class Spectre * parent);
virtual ~NetworkAI(){}
};
///The AI we're used to.. the one that defends flags and blasts people
class ComputerAI: public AI {
int mode;
public:
AI * Clone ()const {return new ComputerAI;}
virtual void Execute (class Spectre * parent);
virtual ~ComputerAI(){}
};
///Extracomputer-AI pilots utilising methods such as keyboard or joystick I/O
class HumanAI: public AI {
public:
AI * Clone ()const {return new HumanAI;}
virtual void Execute (class Spectre * parent);
virtual ~HumanAI(){}
};