Changeset - r16516:3e651c9d6713
[Not reviewed]
master
0 6 0
rubidium - 14 years ago 2010-11-19 10:35:59
rubidium@openttd.org
(svn r21252) -Codechange: introduce a constant for the number of milliseconds per game tick and use it
6 files changed with 13 insertions and 10 deletions:
0 comments (0 inline, 0 general)
src/gfx_type.h
Show inline comments
 
@@ -259,4 +259,7 @@ enum SpriteType {
 
	ST_INVALID  = 4,      ///< Pseudosprite or other unusable sprite, used only internally
 
};
 

	
 
/** The number of milliseconds per game tick. */
 
static const uint MILLISECONDS_PER_TICK = 30;
 

	
 
#endif /* GFX_TYPE_H */
src/video/allegro_v.cpp
Show inline comments
 
@@ -474,7 +474,7 @@ void VideoDriver_Allegro::MainLoop()
 
{
 
	uint32 cur_ticks = GetTime();
 
	uint32 last_cur_ticks = cur_ticks;
 
	uint32 next_tick = cur_ticks + 30;
 
	uint32 next_tick = cur_ticks + MILLISECONDS_PER_TICK;
 
	uint32 pal_tick = 0;
 

	
 
	for (;;) {
 
@@ -501,7 +501,7 @@ void VideoDriver_Allegro::MainLoop()
 
		if (cur_ticks >= next_tick || (_fast_forward && !_pause_mode) || cur_ticks < prev_cur_ticks) {
 
			_realtime_tick += cur_ticks - last_cur_ticks;
 
			last_cur_ticks = cur_ticks;
 
			next_tick = cur_ticks + 30;
 
			next_tick = cur_ticks + MILLISECONDS_PER_TICK;
 

	
 
			bool old_ctrl_pressed = _ctrl_pressed;
 

	
src/video/cocoa/event.mm
Show inline comments
 
@@ -606,7 +606,7 @@ void QZ_GameLoop()
 
{
 
	uint32 cur_ticks = GetTick();
 
	uint32 last_cur_ticks = cur_ticks;
 
	uint32 next_tick = cur_ticks + 30;
 
	uint32 next_tick = cur_ticks + MILLISECONDS_PER_TICK;
 
	uint32 pal_tick = 0;
 

	
 
#ifdef _DEBUG
 
@@ -655,7 +655,7 @@ void QZ_GameLoop()
 
		if (cur_ticks >= next_tick || (_fast_forward && !_pause_mode) || cur_ticks < prev_cur_ticks) {
 
			_realtime_tick += cur_ticks - last_cur_ticks;
 
			last_cur_ticks = cur_ticks;
 
			next_tick = cur_ticks + 30;
 
			next_tick = cur_ticks + MILLISECONDS_PER_TICK;
 

	
 
			bool old_ctrl_pressed = _ctrl_pressed;
 

	
src/video/dedicated_v.cpp
Show inline comments
 
@@ -256,7 +256,7 @@ static void DedicatedHandleKeyInput()
 
void VideoDriver_Dedicated::MainLoop()
 
{
 
	uint32 cur_ticks = GetTime();
 
	uint32 next_tick = cur_ticks + 30;
 
	uint32 next_tick = cur_ticks + MILLISECONDS_PER_TICK;
 

	
 
	/* Signal handlers */
 
#if defined(UNIX) || defined(PSP)
 
@@ -305,7 +305,7 @@ void VideoDriver_Dedicated::MainLoop()
 
		cur_ticks = GetTime();
 
		_realtime_tick += cur_ticks - prev_cur_ticks;
 
		if (cur_ticks >= next_tick || cur_ticks < prev_cur_ticks || _ddc_fastforward) {
 
			next_tick = cur_ticks + 30;
 
			next_tick = cur_ticks + MILLISECONDS_PER_TICK;
 

	
 
			GameLoop();
 
			UpdateWindows();
src/video/sdl_v.cpp
Show inline comments
 
@@ -497,7 +497,7 @@ void VideoDriver_SDL::MainLoop()
 
{
 
	uint32 cur_ticks = SDL_CALL SDL_GetTicks();
 
	uint32 last_cur_ticks = cur_ticks;
 
	uint32 next_tick = cur_ticks + 30;
 
	uint32 next_tick = cur_ticks + MILLISECONDS_PER_TICK;
 
	uint32 pal_tick = 0;
 
	uint32 mod;
 
	int numkeys;
 
@@ -554,7 +554,7 @@ void VideoDriver_SDL::MainLoop()
 
		if (cur_ticks >= next_tick || (_fast_forward && !_pause_mode) || cur_ticks < prev_cur_ticks) {
 
			_realtime_tick += cur_ticks - last_cur_ticks;
 
			last_cur_ticks = cur_ticks;
 
			next_tick = cur_ticks + 30;
 
			next_tick = cur_ticks + MILLISECONDS_PER_TICK;
 

	
 
			bool old_ctrl_pressed = _ctrl_pressed;
 

	
src/video/win32_v.cpp
Show inline comments
 
@@ -832,7 +832,7 @@ void VideoDriver_Win32::MainLoop()
 
	MSG mesg;
 
	uint32 cur_ticks = GetTickCount();
 
	uint32 last_cur_ticks = cur_ticks;
 
	uint32 next_tick = cur_ticks + 30;
 
	uint32 next_tick = cur_ticks + MILLISECONDS_PER_TICK;
 

	
 
	_wnd.running = true;
 

	
 
@@ -862,7 +862,7 @@ void VideoDriver_Win32::MainLoop()
 
		if (cur_ticks >= next_tick || (_fast_forward && !_pause_mode) || cur_ticks < prev_cur_ticks) {
 
			_realtime_tick += cur_ticks - last_cur_ticks;
 
			last_cur_ticks = cur_ticks;
 
			next_tick = cur_ticks + 30;
 
			next_tick = cur_ticks + MILLISECONDS_PER_TICK;
 

	
 
			bool old_ctrl_pressed = _ctrl_pressed;
 

	
0 comments (0 inline, 0 general)