Mercurial > hg > openttd
annotate src/autoreplace_base.h @ 13419:ddfb6a69b9c3 draft
(svn r17928) -Codechange: ShowErrorMessage() now takes the summary string before the details string.
Gentlemen, swap your string parameters.
author | alberth <alberth@openttd.org> |
---|---|
date | Sat, 31 Oct 2009 19:46:51 +0000 |
parents | bc7926153e19 |
children | a899d4e5ee1a |
rev | line source |
---|---|
8212
11263ebe590a
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1 /* $Id$ */ |
11263ebe590a
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
2 |
12778
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
11974
diff
changeset
|
3 /* |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
11974
diff
changeset
|
4 * This file is part of OpenTTD. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
11974
diff
changeset
|
5 * OpenTTD 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, version 2. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
11974
diff
changeset
|
6 * OpenTTD 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. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
11974
diff
changeset
|
7 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
11974
diff
changeset
|
8 */ |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
11974
diff
changeset
|
9 |
8212
11263ebe590a
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
10 /** @file autoreplace_base.h Base class for autoreplaces/autorenews. */ |
11263ebe590a
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
11 |
11263ebe590a
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
12 #ifndef AUTOREPLACE_BASE_H |
11263ebe590a
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
13 #define AUTOREPLACE_BASE_H |
11263ebe590a
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
14 |
11974
5328e400636a
(svn r16380) -Codechange: rename pool.hpp to pool_type.hpp
smatz <smatz@openttd.org>
parents:
11972
diff
changeset
|
15 #include "core/pool_type.hpp" |
8212
11263ebe590a
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
16 #include "autoreplace_type.h" |
11263ebe590a
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
17 |
10127
3c3b3d21adf4
(svn r14313) -Codechange: Move functions dealing with the EngineRenew pool to their own file.
frosch <frosch@openttd.org>
parents:
8212
diff
changeset
|
18 typedef uint16 EngineRenewID; |
3c3b3d21adf4
(svn r14313) -Codechange: Move functions dealing with the EngineRenew pool to their own file.
frosch <frosch@openttd.org>
parents:
8212
diff
changeset
|
19 |
8212
11263ebe590a
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
20 /** |
11263ebe590a
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
21 * Memory pool for engine renew elements. DO NOT USE outside of engine.c. Is |
11263ebe590a
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
22 * placed here so the only exception to this rule, the saveload code, can use |
11263ebe590a
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
23 * it. |
11263ebe590a
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
24 */ |
11972
fd10870d74d4
(svn r16378) -Codechange: replace OldPool with simpler Pool. Compilation time, binary size and run time (with asserts disabled) should be improved
smatz <smatz@openttd.org>
parents:
11971
diff
changeset
|
25 typedef Pool<EngineRenew, EngineRenewID, 16, 64000> EngineRenewPool; |
fd10870d74d4
(svn r16378) -Codechange: replace OldPool with simpler Pool. Compilation time, binary size and run time (with asserts disabled) should be improved
smatz <smatz@openttd.org>
parents:
11971
diff
changeset
|
26 extern EngineRenewPool _enginerenew_pool; |
8212
11263ebe590a
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
27 |
11263ebe590a
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
28 /** |
11263ebe590a
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
29 * Struct to store engine replacements. DO NOT USE outside of engine.c. Is |
11263ebe590a
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
30 * placed here so the only exception to this rule, the saveload code, can use |
11263ebe590a
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
31 * it. |
11263ebe590a
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
32 */ |
11972
fd10870d74d4
(svn r16378) -Codechange: replace OldPool with simpler Pool. Compilation time, binary size and run time (with asserts disabled) should be improved
smatz <smatz@openttd.org>
parents:
11971
diff
changeset
|
33 struct EngineRenew : EngineRenewPool::PoolItem<&_enginerenew_pool> { |
8212
11263ebe590a
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
34 EngineID from; |
11263ebe590a
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
35 EngineID to; |
11263ebe590a
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
36 EngineRenew *next; |
11263ebe590a
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
37 GroupID group_id; |
11263ebe590a
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
38 |
11972
fd10870d74d4
(svn r16378) -Codechange: replace OldPool with simpler Pool. Compilation time, binary size and run time (with asserts disabled) should be improved
smatz <smatz@openttd.org>
parents:
11971
diff
changeset
|
39 EngineRenew(EngineID from = INVALID_ENGINE, EngineID to = INVALID_ENGINE) : from(from), to(to) {} |
fd10870d74d4
(svn r16378) -Codechange: replace OldPool with simpler Pool. Compilation time, binary size and run time (with asserts disabled) should be improved
smatz <smatz@openttd.org>
parents:
11971
diff
changeset
|
40 ~EngineRenew() {} |
8212
11263ebe590a
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
41 }; |
11263ebe590a
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
42 |
11971
9daf69237623
(svn r16377) -Codechange: unify FOR_ALL_* macros, use separate index variable instead of var->index
smatz <smatz@openttd.org>
parents:
11923
diff
changeset
|
43 #define FOR_ALL_ENGINE_RENEWS_FROM(var, start) FOR_ALL_ITEMS_FROM(EngineRenew, enginerenew_index, var, start) |
9daf69237623
(svn r16377) -Codechange: unify FOR_ALL_* macros, use separate index variable instead of var->index
smatz <smatz@openttd.org>
parents:
11923
diff
changeset
|
44 #define FOR_ALL_ENGINE_RENEWS(var) FOR_ALL_ENGINE_RENEWS_FROM(var, 0) |
8212
11263ebe590a
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
45 |
11263ebe590a
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
46 #endif /* AUTOREPLACE_BASE_H */ |