author | truelight |
Fri, 13 Jul 2007 19:12:43 +0000 | |
branch | noai |
changeset 9652 | c15bf5355b95 |
child 9653 | 50e2eb4abf46 |
permissions | -rw-r--r-- |
9652
c15bf5355b95
(svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents:
diff
changeset
|
1 |
/* $Id$ */ |
c15bf5355b95
(svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents:
diff
changeset
|
2 |
|
c15bf5355b95
(svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents:
diff
changeset
|
3 |
/** @file ai_pathfinder_stupid.hpp A really stupid pathfinder */ |
c15bf5355b95
(svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents:
diff
changeset
|
4 |
|
c15bf5355b95
(svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents:
diff
changeset
|
5 |
#ifndef AI_PATHFINDER_STUPID_HPP |
c15bf5355b95
(svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents:
diff
changeset
|
6 |
#define AI_PATHFINDER_STUPID_HPP |
c15bf5355b95
(svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents:
diff
changeset
|
7 |
|
c15bf5355b95
(svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents:
diff
changeset
|
8 |
#include "ai_pathfinder.hpp" |
c15bf5355b95
(svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents:
diff
changeset
|
9 |
|
c15bf5355b95
(svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents:
diff
changeset
|
10 |
/** |
c15bf5355b95
(svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents:
diff
changeset
|
11 |
* A stupid pathfinder. It first makes a straight line on the X-axis, than |
c15bf5355b95
(svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents:
diff
changeset
|
12 |
* it does the same on the Y-axis. The result is rarely optimal, or connected. |
c15bf5355b95
(svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents:
diff
changeset
|
13 |
*/ |
c15bf5355b95
(svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents:
diff
changeset
|
14 |
class AIPathFinderStupid : public AIPathFinder { |
c15bf5355b95
(svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents:
diff
changeset
|
15 |
public: |
c15bf5355b95
(svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents:
diff
changeset
|
16 |
/** |
c15bf5355b95
(svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents:
diff
changeset
|
17 |
* The name of the class, needed by several sub-processes. |
c15bf5355b95
(svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents:
diff
changeset
|
18 |
*/ |
c15bf5355b95
(svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents:
diff
changeset
|
19 |
static const char *GetClassName() { return "AIPathFinderStupid"; } |
c15bf5355b95
(svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents:
diff
changeset
|
20 |
|
c15bf5355b95
(svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents:
diff
changeset
|
21 |
/** |
c15bf5355b95
(svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents:
diff
changeset
|
22 |
* Custom constructor, to see for which type we are going to be a pathfinder. |
c15bf5355b95
(svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents:
diff
changeset
|
23 |
*/ |
c15bf5355b95
(svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents:
diff
changeset
|
24 |
AIPathFinderStupid(AIPathFinder::PathFinderType type) { this->type = type; } |
c15bf5355b95
(svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents:
diff
changeset
|
25 |
|
c15bf5355b95
(svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents:
diff
changeset
|
26 |
void *FindRoute(AITileList *start, AITileList *end); |
c15bf5355b95
(svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents:
diff
changeset
|
27 |
bool BuildRoute(void *result); |
c15bf5355b95
(svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents:
diff
changeset
|
28 |
void FreeRoute(void *result); |
c15bf5355b95
(svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents:
diff
changeset
|
29 |
|
c15bf5355b95
(svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents:
diff
changeset
|
30 |
private: |
c15bf5355b95
(svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents:
diff
changeset
|
31 |
AIPathFinder::PathFinderType type; |
c15bf5355b95
(svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents:
diff
changeset
|
32 |
|
c15bf5355b95
(svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents:
diff
changeset
|
33 |
/** |
c15bf5355b95
(svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents:
diff
changeset
|
34 |
* Internal storage of the pointer returned by FindRoute which can be given to BuildRoute. |
c15bf5355b95
(svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents:
diff
changeset
|
35 |
*/ |
c15bf5355b95
(svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents:
diff
changeset
|
36 |
struct Path { |
c15bf5355b95
(svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents:
diff
changeset
|
37 |
TileIndex start; |
c15bf5355b95
(svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents:
diff
changeset
|
38 |
TileIndex end; |
c15bf5355b95
(svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents:
diff
changeset
|
39 |
}; |
c15bf5355b95
(svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents:
diff
changeset
|
40 |
|
c15bf5355b95
(svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents:
diff
changeset
|
41 |
/** |
c15bf5355b95
(svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents:
diff
changeset
|
42 |
* Build the real route based on begin and end tile. |
c15bf5355b95
(svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents:
diff
changeset
|
43 |
*/ |
c15bf5355b95
(svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents:
diff
changeset
|
44 |
bool BuildRealRoute(TileIndex start, TileIndex end, bool continue_on_error); |
c15bf5355b95
(svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents:
diff
changeset
|
45 |
}; |
c15bf5355b95
(svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents:
diff
changeset
|
46 |
|
c15bf5355b95
(svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents:
diff
changeset
|
47 |
#endif /* AI_PATHFINDER_HPP */ |