equal
deleted
inserted
replaced
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 |