Last change
on this file since 1527 was
495,
checked in by motth, 17 years ago
|
fixed a memory leak, added documentation
|
File size:
2.3 KB
|
Rev | Line | |
---|
[495] | 1 | #ifndef AI_Class |
---|
| 2 | #define AI_Class |
---|
[426] | 3 | |
---|
| 4 | #include <Ogre.h> |
---|
| 5 | #include <OgreVector3.h> |
---|
| 6 | #include <OgreMath.h> |
---|
| 7 | |
---|
| 8 | #include <iostream> |
---|
| 9 | |
---|
| 10 | |
---|
| 11 | #endif |
---|
| 12 | |
---|
| 13 | using namespace std; |
---|
| 14 | using namespace Ogre; |
---|
| 15 | |
---|
| 16 | class AIPilot { |
---|
| 17 | |
---|
| 18 | |
---|
| 19 | /* |
---|
| 20 | TASKS: Requirements: |
---|
| 21 | |
---|
| 22 | - Change actual Speed to required Speed - Speed as Vector3 , spaceship(?) -> pilot attached to it or vice versa (?) |
---|
| 23 | - Open fire, if allowed - Status of the fleet commander -> allowed to fire , fly etc. |
---|
| 24 | - differ friend, ally and enemy - Lists of ships + who controls them |
---|
| 25 | - report ship status to fleet commander - Call own ship status -> ammo, damage etc. |
---|
| 26 | |
---|
| 27 | |
---|
| 28 | |
---|
| 29 | */ |
---|
| 30 | |
---|
| 31 | public: |
---|
| 32 | Vector3 speed; |
---|
| 33 | |
---|
| 34 | |
---|
| 35 | |
---|
| 36 | //default constructor |
---|
| 37 | AIPilot() { |
---|
| 38 | speed = (1,0,0); |
---|
| 39 | } |
---|
| 40 | |
---|
| 41 | Vector3 steer(Vector3 reqSpeed) { |
---|
| 42 | Quaternion sRotation = speed.getRotationTo(reqSpeed); |
---|
| 43 | Radian rollarc = sRotation.getRoll(); |
---|
| 44 | Radian pitcharc = sRotation.getPitch(); |
---|
| 45 | Radian yawarc = sRotation.getYaw(); |
---|
| 46 | return Vector3((float)rollarc.valueRadians(), (float)pitcharc.valueRadians(), (float)yawarc.valueRadians()); |
---|
| 47 | } |
---|
| 48 | |
---|
| 49 | |
---|
| 50 | |
---|
| 51 | }; |
---|
| 52 | |
---|
| 53 | class AIFleetCommander : public AIPilot { |
---|
| 54 | |
---|
| 55 | |
---|
| 56 | /* |
---|
| 57 | TASKS: Requirements: |
---|
| 58 | |
---|
| 59 | - Same tasks as AI_Pilot (only if shipcontrol) - Same as AI_Pilot |
---|
| 60 | - Calculate required Speed for any ship in Fleet - Knows all calculation functions |
---|
| 61 | - Request fleet status and report to commander - Better list of all ships -> more data for fleet ships |
---|
| 62 | |
---|
| 63 | |
---|
| 64 | |
---|
| 65 | */ |
---|
| 66 | |
---|
| 67 | public: |
---|
| 68 | |
---|
| 69 | |
---|
| 70 | //default constructor |
---|
| 71 | AIFleetCommander() { |
---|
| 72 | |
---|
| 73 | } |
---|
| 74 | |
---|
| 75 | |
---|
| 76 | |
---|
| 77 | }; |
---|
| 78 | |
---|
| 79 | class AICommander : public AIFleetCommander { |
---|
| 80 | |
---|
| 81 | |
---|
| 82 | /* |
---|
| 83 | TASKS: Requirements: |
---|
| 84 | |
---|
| 85 | - Decide on general tactics - List of general fleet status + all possible information on enemies |
---|
| 86 | - Save and load tactical data (?) - files with tactical data, e.g. success of strategy etc. |
---|
| 87 | |
---|
| 88 | |
---|
| 89 | |
---|
| 90 | */ |
---|
| 91 | |
---|
| 92 | //default constructor |
---|
| 93 | AICommander() { |
---|
| 94 | |
---|
| 95 | } |
---|
| 96 | |
---|
| 97 | |
---|
| 98 | |
---|
| 99 | }; |
---|
Note: See
TracBrowser
for help on using the repository browser.