namegen.c
changeset 2484 0e45d70ae908
parent 2431 447292e83ab3
child 2549 5587f9a38563
equal deleted inserted replaced
2483:e2d5f55daf63 2484:0e45d70ae908
     1 /* $Id$ */
     1 /* $Id$ */
     2 
     2 
     3 #include "stdafx.h"
     3 #include "stdafx.h"
     4 #include "openttd.h"
     4 #include "openttd.h"
     5 #include "debug.h"
     5 #include "debug.h"
       
     6 #include "macros.h"
     6 #include "namegen.h"
     7 #include "namegen.h"
     7 #include "table/namegen.h"
     8 #include "table/namegen.h"
     8 
     9 
     9 static inline uint32 SeedChance(int shift_by, int max, uint32 seed)
    10 static inline uint32 SeedChance(int shift_by, int max, uint32 seed)
    10 {
    11 {
    11 	return ((uint16)(seed >> shift_by) * max) >> 16;
    12 	return (GB(seed, shift_by, 16) * max) >> 16;
    12 }
    13 }
    13 
    14 
    14 static inline uint32 SeedModChance(int shift_by, int max, uint32 seed)
    15 static inline uint32 SeedModChance(int shift_by, int max, uint32 seed)
    15 {
    16 {
    16 	/* This actually gives *MUCH* more even distribution of the values
    17 	/* This actually gives *MUCH* more even distribution of the values