r4260 - in packages/trunk/starfighter/debian: . patches

Jens Seidel jensseidel at users.sf.net
Sat Sep 22 10:22:36 UTC 2007


On Sat, Sep 22, 2007 at 09:28:30AM +0000, Gonéri Le Bouder wrote:
> Author: goneri-guest
> Log:
> Add patch by Brian m. Carlson to fix the build wiith gcc 4.2
> 
> +Index: starfighter-1.1/code/game.cpp
> +===================================================================
> +--- starfighter-1.1.orig/code/game.cpp	2007-09-22 09:51:54.000000000 +0000
> ++++ starfighter-1.1/code/game.cpp	2007-09-22 09:53:16.000000000 +0000
>  @@ -240,6 +240,7 @@
>   			then = SDL_GetTicks();
>   			frames = 0;
> @@ -28,23 +32,27 @@
>  -			// Do nothing. If we were to insert an SDL_Delay(1) in here
>  -			// then we would actually lose around 10 frames per second!!
>  -		}
> -+		SDL_Delay(frameLimit + 16 - SDL_GetTicks() >? 0 <? 16);
> ++		SDL_Delay(frameLimit + 16 - std::max(std::min(SDL_GetTicks(), 0), 16));
>   		frameLimit = SDL_GetTicks();
   
>   		// Limit us to 60 frame a second
>  -		while (SDL_GetTicks() < (frameLimit + 16)){}
> -+		SDL_Delay(frameLimit + 16 - SDL_GetTicks() >? 0 <? 16);
> ++		SDL_Delay(frameLimit + 16 - std::max(std::min(SDL_GetTicks(), 0), 16));
>   		frameLimit = SDL_GetTicks();

>  -		while (SDL_GetTicks() < (frameLimit + 16)){}
> -+		SDL_Delay(frameLimit + 16 - SDL_GetTicks() >? 0 <? 16);
> ++		SDL_Delay(frameLimit + 16 - std::max(std::min(SDL_GetTicks(), 0), 16));
>   		frameLimit = SDL_GetTicks();
   
>  -		while (SDL_GetTicks() < (frameLimit + 16)){}
> -+		SDL_Delay(frameLimit + 16 - SDL_GetTicks() >? 0 <? 16);
> ++		SDL_Delay(frameLimit + 16 - std::max(std::min(SDL_GetTicks(), 0), 16));
>   		frameLimit = SDL_GetTicks();

Are you sure this is right?
SDL_GetTicks() is greater or equal zero if no overflow happened so you
have:
std::max(0, 16) == 16

Probably you want:
std::min(std::max(SDL_GetTicks(), 0), 16));

(more matches dropped)



More information about the Pkg-games-devel mailing list