author | rubidium |
Fri, 21 Dec 2007 22:50:51 +0000 | |
changeset 8119 | 52b48108425a |
parent 8083 | ad22eade501f |
child 8140 | 0d0d8c94f84b |
permissions | -rw-r--r-- |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
1 |
/* $Id$ */ |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
2 |
|
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
3 |
#ifndef YAPF_HPP |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
4 |
#define YAPF_HPP |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
5 |
|
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
6 |
|
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
7 |
|
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
8 |
#include "track_dir.hpp" |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
9 |
|
6638
09c5d7bf69a5
(svn r9869) -Codechange: replace some bytes with VehicleType, i.e. more type strictness.
rubidium
parents:
6453
diff
changeset
|
10 |
#include "../vehicle.h" |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
11 |
#include "../depot.h" |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
12 |
#include "../road_map.h" |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
13 |
#include "../tunnel_map.h" |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
14 |
#include "../bridge_map.h" |
8083
ad22eade501f
(svn r11644) -Codechange: merge some functions from tunnel_map.h and bridge_map.h into tunnelbridge_map.h
smatz
parents:
7122
diff
changeset
|
15 |
#include "../tunnelbridge_map.h" |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
16 |
#include "../bridge.h" |
3931
b946fc6e7188
(svn r5066) -Feature: [YAPF] Train selects the best station platform by length
KUDr
parents:
3904
diff
changeset
|
17 |
#include "../station.h" |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
18 |
#include "../station_map.h" |
4261
28670f743746
(svn r5887) -Cleanup: move date related functions, defines and variables to date.[ch]
rubidium
parents:
3931
diff
changeset
|
19 |
#include "../date.h" |
8119
52b48108425a
(svn r11680) -Codechange: refactor more out of openttd.h and functions.h.
rubidium
parents:
8083
diff
changeset
|
20 |
#include "../tile_cmd.h" |
6453
226bcddeba32
(svn r9609) -Codechange: Move some function prototypes out of functions.h and into landscape.h, and add a few where they didn't exist.
maedhros
parents:
6247
diff
changeset
|
21 |
#include "../landscape.h" |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
22 |
#include "yapf.h" |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
23 |
#include "../pathfind.h" |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
24 |
#include "../waypoint.h" |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
25 |
#include "../debug.h" |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
26 |
|
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5475
diff
changeset
|
27 |
extern Patches _patches_newgame; |
6247 | 28 |
extern uint64 _rdtsc(); |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
29 |
|
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
30 |
#include <limits.h> |
3904
4b0372645db4
(svn r4992) - Fix: [YAPF] error "too many arguments to function `void * operator new(unsigned int)'" on MorphOS
KUDr
parents:
3900
diff
changeset
|
31 |
#include <new> |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
32 |
|
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
33 |
#if defined(_WIN32) || defined(_WIN64) |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
34 |
# include <windows.h> |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
35 |
#else |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
36 |
# include <time.h> |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
37 |
#endif |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
38 |
|
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
39 |
struct CPerformanceTimer |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
40 |
{ |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
41 |
int64 m_start; |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
42 |
int64 m_acc; |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
43 |
|
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
44 |
CPerformanceTimer() : m_start(0), m_acc(0) {} |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
45 |
|
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
46 |
FORCEINLINE void Start() {m_start = QueryTime();} |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
47 |
FORCEINLINE void Stop() {m_acc += QueryTime() - m_start;} |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
48 |
FORCEINLINE int Get(int64 coef) {return (int)(m_acc * coef / QueryFrequency());} |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
49 |
|
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
50 |
FORCEINLINE int64 QueryTime() {return _rdtsc();} |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
51 |
FORCEINLINE int64 QueryFrequency() {return ((int64)2200 * 1000000);} |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
52 |
}; |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
53 |
|
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
54 |
struct CPerfStartReal |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
55 |
{ |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
56 |
CPerformanceTimer* m_pperf; |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
57 |
|
4434
a08cb4b5c179
(svn r6204) -Cleanup: replace non-indentation with spaces; like '}<TAB>else {' -> '} else {', tabs between code and comment, etc.
rubidium
parents:
4261
diff
changeset
|
58 |
FORCEINLINE CPerfStartReal(CPerformanceTimer& perf) : m_pperf(&perf) {if (m_pperf != NULL) m_pperf->Start();} |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
59 |
FORCEINLINE ~CPerfStartReal() {Stop();} |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
60 |
FORCEINLINE void Stop() {if (m_pperf != NULL) {m_pperf->Stop(); m_pperf = NULL;}} |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
61 |
}; |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
62 |
|
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
63 |
struct CPerfStartFake |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
64 |
{ |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
65 |
FORCEINLINE CPerfStartFake(CPerformanceTimer& perf) {} |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
66 |
FORCEINLINE ~CPerfStartFake() {} |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
67 |
FORCEINLINE void Stop() {} |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
68 |
}; |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
69 |
|
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
70 |
typedef CPerfStartFake CPerfStart; |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
71 |
|
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
72 |
|
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
73 |
//#undef FORCEINLINE |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
74 |
//#define FORCEINLINE inline |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
75 |
|
5633
e1905dacc378
(svn r8092) -Codechange: header files with miscellaneous template classes (smart pointers, blob, array, hashtable, etc.) moved from src/yapf to src/misc as they can now be used anywhere.
KUDr
parents:
5587
diff
changeset
|
76 |
#include "../misc/crc32.hpp" |
e1905dacc378
(svn r8092) -Codechange: header files with miscellaneous template classes (smart pointers, blob, array, hashtable, etc.) moved from src/yapf to src/misc as they can now be used anywhere.
KUDr
parents:
5587
diff
changeset
|
77 |
#include "../misc/blob.hpp" |
7122
444ddcad8909
(svn r10395) -Fix [YAPF]: missing include + some signed/unsigned comparison warnings
KUDr
parents:
7119
diff
changeset
|
78 |
#include "../misc/str.hpp" |
5633
e1905dacc378
(svn r8092) -Codechange: header files with miscellaneous template classes (smart pointers, blob, array, hashtable, etc.) moved from src/yapf to src/misc as they can now be used anywhere.
KUDr
parents:
5587
diff
changeset
|
79 |
#include "../misc/fixedsizearray.hpp" |
e1905dacc378
(svn r8092) -Codechange: header files with miscellaneous template classes (smart pointers, blob, array, hashtable, etc.) moved from src/yapf to src/misc as they can now be used anywhere.
KUDr
parents:
5587
diff
changeset
|
80 |
#include "../misc/array.hpp" |
e1905dacc378
(svn r8092) -Codechange: header files with miscellaneous template classes (smart pointers, blob, array, hashtable, etc.) moved from src/yapf to src/misc as they can now be used anywhere.
KUDr
parents:
5587
diff
changeset
|
81 |
#include "../misc/hashtable.hpp" |
e1905dacc378
(svn r8092) -Codechange: header files with miscellaneous template classes (smart pointers, blob, array, hashtable, etc.) moved from src/yapf to src/misc as they can now be used anywhere.
KUDr
parents:
5587
diff
changeset
|
82 |
#include "../misc/binaryheap.hpp" |
7119
afb9000a598e
(svn r10392) -Add [YAPF]: added structured dump support into some essential YAPF classes (node-list, nodes, keys, etc.) and CArrayT
KUDr
parents:
6638
diff
changeset
|
83 |
#include "../misc/dbg_helpers.h" |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
84 |
#include "nodelist.hpp" |
6132
8b4edf37c5ff
(svn r8869) [YAPF] -Fix: Large Train Stations/Trains makes OpenTTD crash (Jigsaw_Psyche)
KUDr
parents:
5633
diff
changeset
|
85 |
#include "follow_track.hpp" |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
86 |
#include "yapf_base.hpp" |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
87 |
#include "yapf_node.hpp" |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
88 |
#include "yapf_common.hpp" |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
89 |
#include "yapf_costbase.hpp" |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
90 |
#include "yapf_costcache.hpp" |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
91 |
|
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
92 |
|
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
93 |
#endif /* YAPF_HPP */ |