author | rubidium |
Thu, 18 Dec 2008 12:23:08 +0000 | |
changeset 10436 | 8d3a9fbe8f19 |
parent 10127 | 4f53c1cfcfe9 |
permissions | -rw-r--r-- |
8212
cf3fce5c7464
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium
parents:
diff
changeset
|
1 |
/* $Id$ */ |
cf3fce5c7464
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium
parents:
diff
changeset
|
2 |
|
cf3fce5c7464
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium
parents:
diff
changeset
|
3 |
/** @file autoreplace_base.h Base class for autoreplaces/autorenews. */ |
cf3fce5c7464
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium
parents:
diff
changeset
|
4 |
|
cf3fce5c7464
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium
parents:
diff
changeset
|
5 |
#ifndef AUTOREPLACE_BASE_H |
cf3fce5c7464
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium
parents:
diff
changeset
|
6 |
#define AUTOREPLACE_BASE_H |
cf3fce5c7464
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium
parents:
diff
changeset
|
7 |
|
cf3fce5c7464
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium
parents:
diff
changeset
|
8 |
#include "oldpool.h" |
cf3fce5c7464
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium
parents:
diff
changeset
|
9 |
#include "autoreplace_type.h" |
cf3fce5c7464
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium
parents:
diff
changeset
|
10 |
|
10127
4f53c1cfcfe9
(svn r14313) -Codechange: Move functions dealing with the EngineRenew pool to their own file.
frosch
parents:
8212
diff
changeset
|
11 |
typedef uint16 EngineRenewID; |
4f53c1cfcfe9
(svn r14313) -Codechange: Move functions dealing with the EngineRenew pool to their own file.
frosch
parents:
8212
diff
changeset
|
12 |
|
8212
cf3fce5c7464
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium
parents:
diff
changeset
|
13 |
/** |
cf3fce5c7464
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium
parents:
diff
changeset
|
14 |
* Memory pool for engine renew elements. DO NOT USE outside of engine.c. Is |
cf3fce5c7464
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium
parents:
diff
changeset
|
15 |
* placed here so the only exception to this rule, the saveload code, can use |
cf3fce5c7464
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium
parents:
diff
changeset
|
16 |
* it. |
cf3fce5c7464
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium
parents:
diff
changeset
|
17 |
*/ |
cf3fce5c7464
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium
parents:
diff
changeset
|
18 |
DECLARE_OLD_POOL(EngineRenew, EngineRenew, 3, 8000) |
cf3fce5c7464
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium
parents:
diff
changeset
|
19 |
|
cf3fce5c7464
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium
parents:
diff
changeset
|
20 |
/** |
cf3fce5c7464
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium
parents:
diff
changeset
|
21 |
* Struct to store engine replacements. DO NOT USE outside of engine.c. Is |
cf3fce5c7464
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium
parents:
diff
changeset
|
22 |
* placed here so the only exception to this rule, the saveload code, can use |
cf3fce5c7464
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium
parents:
diff
changeset
|
23 |
* it. |
cf3fce5c7464
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium
parents:
diff
changeset
|
24 |
*/ |
cf3fce5c7464
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium
parents:
diff
changeset
|
25 |
struct EngineRenew : PoolItem<EngineRenew, EngineRenewID, &_EngineRenew_pool> { |
cf3fce5c7464
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium
parents:
diff
changeset
|
26 |
EngineID from; |
cf3fce5c7464
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium
parents:
diff
changeset
|
27 |
EngineID to; |
cf3fce5c7464
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium
parents:
diff
changeset
|
28 |
EngineRenew *next; |
cf3fce5c7464
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium
parents:
diff
changeset
|
29 |
GroupID group_id; |
cf3fce5c7464
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium
parents:
diff
changeset
|
30 |
|
cf3fce5c7464
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium
parents:
diff
changeset
|
31 |
EngineRenew(EngineID from = INVALID_ENGINE, EngineID to = INVALID_ENGINE) : from(from), to(to), next(NULL) {} |
cf3fce5c7464
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium
parents:
diff
changeset
|
32 |
~EngineRenew() { this->from = INVALID_ENGINE; } |
cf3fce5c7464
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium
parents:
diff
changeset
|
33 |
|
cf3fce5c7464
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium
parents:
diff
changeset
|
34 |
inline bool IsValid() const { return this->from != INVALID_ENGINE; } |
cf3fce5c7464
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium
parents:
diff
changeset
|
35 |
}; |
cf3fce5c7464
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium
parents:
diff
changeset
|
36 |
|
cf3fce5c7464
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium
parents:
diff
changeset
|
37 |
#define FOR_ALL_ENGINE_RENEWS_FROM(er, start) for (er = GetEngineRenew(start); er != NULL; er = (er->index + 1U < GetEngineRenewPoolSize()) ? GetEngineRenew(er->index + 1U) : NULL) if (er->IsValid()) |
cf3fce5c7464
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium
parents:
diff
changeset
|
38 |
#define FOR_ALL_ENGINE_RENEWS(er) FOR_ALL_ENGINE_RENEWS_FROM(er, 0) |
cf3fce5c7464
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium
parents:
diff
changeset
|
39 |
|
cf3fce5c7464
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium
parents:
diff
changeset
|
40 |
#endif /* AUTOREPLACE_BASE_H */ |