yapf.hpp

Go to the documentation of this file.
00001 /* $Id: yapf.hpp 14949 2009-01-10 00:31:47Z rubidium $ */
00002 
00005 #ifndef  YAPF_HPP
00006 #define  YAPF_HPP
00007 
00008 #include "../openttd.h"
00009 #include "../vehicle_base.h"
00010 #include "../road_map.h"
00011 #include "../tunnel_map.h"
00012 #include "../bridge_map.h"
00013 #include "../tunnelbridge_map.h"
00014 #include "../bridge.h"
00015 #include "../station_base.h"
00016 #include "../station_map.h"
00017 #include "../tile_cmd.h"
00018 #include "../landscape.h"
00019 #include "yapf.h"
00020 #include "../pathfind.h"
00021 #include "../waypoint.h"
00022 #include "../debug.h"
00023 #include "../settings_type.h"
00024 #include "../tunnelbridge.h"
00025 
00026 extern uint64 ottd_rdtsc();
00027 
00028 #include <limits.h>
00029 #include <new>
00030 
00031 #if defined(_WIN32) || defined(_WIN64)
00032 #  include <windows.h>
00033 #else
00034 #  include <time.h>
00035 #endif
00036 
00037 struct CPerformanceTimer
00038 {
00039   int64    m_start;
00040   int64    m_acc;
00041 
00042   CPerformanceTimer() : m_start(0), m_acc(0) {}
00043 
00044   FORCEINLINE void Start() {m_start = QueryTime();}
00045   FORCEINLINE void Stop() {m_acc += QueryTime() - m_start;}
00046   FORCEINLINE int Get(int64 coef) {return (int)(m_acc * coef / QueryFrequency());}
00047 
00048   FORCEINLINE int64 QueryTime() {return ottd_rdtsc();}
00049   FORCEINLINE int64 QueryFrequency() {return ((int64)2200 * 1000000);}
00050 };
00051 
00052 struct CPerfStartReal
00053 {
00054   CPerformanceTimer *m_pperf;
00055 
00056   FORCEINLINE CPerfStartReal(CPerformanceTimer& perf) : m_pperf(&perf) {if (m_pperf != NULL) m_pperf->Start();}
00057   FORCEINLINE ~CPerfStartReal() {Stop();}
00058   FORCEINLINE void Stop() {if (m_pperf != NULL) {m_pperf->Stop(); m_pperf = NULL;}}
00059 };
00060 
00061 struct CPerfStartFake
00062 {
00063   FORCEINLINE CPerfStartFake(CPerformanceTimer& perf) {}
00064   FORCEINLINE ~CPerfStartFake() {}
00065   FORCEINLINE void Stop() {}
00066 };
00067 
00068 typedef CPerfStartFake CPerfStart;
00069 
00070 
00071 //#undef FORCEINLINE
00072 //#define FORCEINLINE inline
00073 
00074 #include "../misc/crc32.hpp"
00075 #include "../misc/blob.hpp"
00076 #include "../misc/str.hpp"
00077 #include "../misc/fixedsizearray.hpp"
00078 #include "../misc/array.hpp"
00079 #include "../misc/hashtable.hpp"
00080 #include "../misc/binaryheap.hpp"
00081 #include "../misc/dbg_helpers.h"
00082 #include "nodelist.hpp"
00083 #include "follow_track.hpp"
00084 #include "yapf_base.hpp"
00085 #include "yapf_node.hpp"
00086 #include "yapf_common.hpp"
00087 #include "yapf_costbase.hpp"
00088 #include "yapf_costcache.hpp"
00089 
00090 
00091 #endif /* YAPF_HPP */

Generated on Mon Feb 16 23:12:13 2009 for openttd by  doxygen 1.5.6