2006-05-27 16:12:16 +00:00
|
|
|
/* $Id$ */
|
|
|
|
|
|
|
|
#ifndef YAPF_HPP
|
|
|
|
#define YAPF_HPP
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "track_dir.hpp"
|
|
|
|
|
2007-12-27 13:35:39 +00:00
|
|
|
#include "../vehicle_base.h"
|
2006-05-27 16:12:16 +00:00
|
|
|
#include "../depot.h"
|
|
|
|
#include "../road_map.h"
|
|
|
|
#include "../tunnel_map.h"
|
|
|
|
#include "../bridge_map.h"
|
2007-12-16 15:38:51 +00:00
|
|
|
#include "../tunnelbridge_map.h"
|
2006-05-27 16:12:16 +00:00
|
|
|
#include "../bridge.h"
|
2006-06-01 21:39:35 +00:00
|
|
|
#include "../station.h"
|
2006-05-27 16:12:16 +00:00
|
|
|
#include "../station_map.h"
|
2007-12-21 22:50:51 +00:00
|
|
|
#include "../tile_cmd.h"
|
2007-04-12 13:07:15 +00:00
|
|
|
#include "../landscape.h"
|
2006-05-27 16:12:16 +00:00
|
|
|
#include "yapf.h"
|
|
|
|
#include "../pathfind.h"
|
|
|
|
#include "../waypoint.h"
|
|
|
|
#include "../debug.h"
|
2008-01-07 00:57:19 +00:00
|
|
|
#include "../settings_type.h"
|
2006-05-27 16:12:16 +00:00
|
|
|
|
2007-03-07 11:47:46 +00:00
|
|
|
extern uint64 _rdtsc();
|
2006-05-27 16:12:16 +00:00
|
|
|
|
|
|
|
#include <limits.h>
|
2006-05-27 18:52:28 +00:00
|
|
|
#include <new>
|
2006-05-27 16:12:16 +00:00
|
|
|
|
|
|
|
#if defined(_WIN32) || defined(_WIN64)
|
|
|
|
# include <windows.h>
|
|
|
|
#else
|
|
|
|
# include <time.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
struct CPerformanceTimer
|
|
|
|
{
|
|
|
|
int64 m_start;
|
|
|
|
int64 m_acc;
|
|
|
|
|
|
|
|
CPerformanceTimer() : m_start(0), m_acc(0) {}
|
|
|
|
|
|
|
|
FORCEINLINE void Start() {m_start = QueryTime();}
|
|
|
|
FORCEINLINE void Stop() {m_acc += QueryTime() - m_start;}
|
|
|
|
FORCEINLINE int Get(int64 coef) {return (int)(m_acc * coef / QueryFrequency());}
|
|
|
|
|
|
|
|
FORCEINLINE int64 QueryTime() {return _rdtsc();}
|
|
|
|
FORCEINLINE int64 QueryFrequency() {return ((int64)2200 * 1000000);}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct CPerfStartReal
|
|
|
|
{
|
|
|
|
CPerformanceTimer* m_pperf;
|
|
|
|
|
2006-08-28 18:53:03 +00:00
|
|
|
FORCEINLINE CPerfStartReal(CPerformanceTimer& perf) : m_pperf(&perf) {if (m_pperf != NULL) m_pperf->Start();}
|
2006-05-27 16:12:16 +00:00
|
|
|
FORCEINLINE ~CPerfStartReal() {Stop();}
|
|
|
|
FORCEINLINE void Stop() {if (m_pperf != NULL) {m_pperf->Stop(); m_pperf = NULL;}}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct CPerfStartFake
|
|
|
|
{
|
|
|
|
FORCEINLINE CPerfStartFake(CPerformanceTimer& perf) {}
|
|
|
|
FORCEINLINE ~CPerfStartFake() {}
|
|
|
|
FORCEINLINE void Stop() {}
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef CPerfStartFake CPerfStart;
|
|
|
|
|
|
|
|
|
|
|
|
//#undef FORCEINLINE
|
|
|
|
//#define FORCEINLINE inline
|
|
|
|
|
2007-01-13 13:33:36 +00:00
|
|
|
#include "../misc/crc32.hpp"
|
|
|
|
#include "../misc/blob.hpp"
|
2007-06-30 00:17:07 +00:00
|
|
|
#include "../misc/str.hpp"
|
2007-01-13 13:33:36 +00:00
|
|
|
#include "../misc/fixedsizearray.hpp"
|
|
|
|
#include "../misc/array.hpp"
|
|
|
|
#include "../misc/hashtable.hpp"
|
|
|
|
#include "../misc/binaryheap.hpp"
|
2007-06-29 23:45:13 +00:00
|
|
|
#include "../misc/dbg_helpers.h"
|
2006-05-27 16:12:16 +00:00
|
|
|
#include "nodelist.hpp"
|
2007-02-24 00:17:46 +00:00
|
|
|
#include "follow_track.hpp"
|
2006-05-27 16:12:16 +00:00
|
|
|
#include "yapf_base.hpp"
|
|
|
|
#include "yapf_node.hpp"
|
|
|
|
#include "yapf_common.hpp"
|
|
|
|
#include "yapf_costbase.hpp"
|
|
|
|
#include "yapf_costcache.hpp"
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* YAPF_HPP */
|