author | skidd13 |
Mon, 26 Nov 2007 17:50:22 +0000 | |
changeset 7971 | 8509d595142a |
parent 7967 | a230c063a672 |
child 8005 | 2318a0547719 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
6111
diff
changeset
|
3 |
/** @file macros.h */ |
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
6111
diff
changeset
|
4 |
|
0 | 5 |
#ifndef MACROS_H |
6 |
#define MACROS_H |
|
7 |
||
7971
8509d595142a
(svn r11527) -Codechange: Split the bitmath functions of to their own files
skidd13
parents:
7967
diff
changeset
|
8 |
#include "core/bitmath_func.hpp" |
7937
1e7a22ea20d4
(svn r11490) -Codechange: Split the math functions to their own header
skidd13
parents:
7932
diff
changeset
|
9 |
#include "core/math_func.hpp" |
1e7a22ea20d4
(svn r11490) -Codechange: Split the math functions to their own header
skidd13
parents:
7932
diff
changeset
|
10 |
|
5668
36b39f4a9032
(svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents:
5605
diff
changeset
|
11 |
#define GENERAL_SPRITE_COLOR(color) ((color) + PALETTE_RECOLOR_START) |
36b39f4a9032
(svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents:
5605
diff
changeset
|
12 |
#define PLAYER_SPRITE_COLOR(owner) (GENERAL_SPRITE_COLOR(_player_colors[owner])) |
0 | 13 |
|
7619
a1cf1e29bb38
(svn r11149) -Fix [FS#1225]: Draw building stages for new house ground sprites.
maedhros
parents:
7516
diff
changeset
|
14 |
/** |
a1cf1e29bb38
(svn r11149) -Fix [FS#1225]: Draw building stages for new house ground sprites.
maedhros
parents:
7516
diff
changeset
|
15 |
* Whether a sprite comes from the original graphics files or a new grf file |
a1cf1e29bb38
(svn r11149) -Fix [FS#1225]: Draw building stages for new house ground sprites.
maedhros
parents:
7516
diff
changeset
|
16 |
* (either supplied by OpenTTD or supplied by the user). |
a1cf1e29bb38
(svn r11149) -Fix [FS#1225]: Draw building stages for new house ground sprites.
maedhros
parents:
7516
diff
changeset
|
17 |
* |
a1cf1e29bb38
(svn r11149) -Fix [FS#1225]: Draw building stages for new house ground sprites.
maedhros
parents:
7516
diff
changeset
|
18 |
* @param sprite The sprite to check |
a1cf1e29bb38
(svn r11149) -Fix [FS#1225]: Draw building stages for new house ground sprites.
maedhros
parents:
7516
diff
changeset
|
19 |
* @return True if it is a new sprite, or false if it is original. |
a1cf1e29bb38
(svn r11149) -Fix [FS#1225]: Draw building stages for new house ground sprites.
maedhros
parents:
7516
diff
changeset
|
20 |
*/ |
a1cf1e29bb38
(svn r11149) -Fix [FS#1225]: Draw building stages for new house ground sprites.
maedhros
parents:
7516
diff
changeset
|
21 |
#define IS_CUSTOM_SPRITE(sprite) ((sprite) >= SPR_SIGNALS_BASE) |
a1cf1e29bb38
(svn r11149) -Fix [FS#1225]: Draw building stages for new house ground sprites.
maedhros
parents:
7516
diff
changeset
|
22 |
|
0 | 23 |
|
2952 | 24 |
#define for_each_bit(_i, _b) \ |
25 |
for (_i = 0; _b != 0; _i++, _b >>= 1) \ |
|
26 |
if (_b & 1) |
|
0 | 27 |
|
28 |
||
2966
661554d683cd
(svn r3529) - Fix: [ 1415782 ] crash in string code with openbsd/zaurus; alignment issues (thanks Tron for the help)
Darkvater
parents:
2952
diff
changeset
|
29 |
static inline uint16 ReadLE16Aligned(const void* x) |
661554d683cd
(svn r3529) - Fix: [ 1415782 ] crash in string code with openbsd/zaurus; alignment issues (thanks Tron for the help)
Darkvater
parents:
2952
diff
changeset
|
30 |
{ |
661554d683cd
(svn r3529) - Fix: [ 1415782 ] crash in string code with openbsd/zaurus; alignment issues (thanks Tron for the help)
Darkvater
parents:
2952
diff
changeset
|
31 |
return FROM_LE16(*(const uint16*)x); |
661554d683cd
(svn r3529) - Fix: [ 1415782 ] crash in string code with openbsd/zaurus; alignment issues (thanks Tron for the help)
Darkvater
parents:
2952
diff
changeset
|
32 |
} |
0 | 33 |
|
2966
661554d683cd
(svn r3529) - Fix: [ 1415782 ] crash in string code with openbsd/zaurus; alignment issues (thanks Tron for the help)
Darkvater
parents:
2952
diff
changeset
|
34 |
static inline uint16 ReadLE16Unaligned(const void* x) |
661554d683cd
(svn r3529) - Fix: [ 1415782 ] crash in string code with openbsd/zaurus; alignment issues (thanks Tron for the help)
Darkvater
parents:
2952
diff
changeset
|
35 |
{ |
661554d683cd
(svn r3529) - Fix: [ 1415782 ] crash in string code with openbsd/zaurus; alignment issues (thanks Tron for the help)
Darkvater
parents:
2952
diff
changeset
|
36 |
#ifdef OTTD_ALIGNMENT |
661554d683cd
(svn r3529) - Fix: [ 1415782 ] crash in string code with openbsd/zaurus; alignment issues (thanks Tron for the help)
Darkvater
parents:
2952
diff
changeset
|
37 |
return ((const byte*)x)[0] | ((const byte*)x)[1] << 8; |
661554d683cd
(svn r3529) - Fix: [ 1415782 ] crash in string code with openbsd/zaurus; alignment issues (thanks Tron for the help)
Darkvater
parents:
2952
diff
changeset
|
38 |
#else |
661554d683cd
(svn r3529) - Fix: [ 1415782 ] crash in string code with openbsd/zaurus; alignment issues (thanks Tron for the help)
Darkvater
parents:
2952
diff
changeset
|
39 |
return FROM_LE16(*(const uint16*)x); |
0 | 40 |
#endif |
2966
661554d683cd
(svn r3529) - Fix: [ 1415782 ] crash in string code with openbsd/zaurus; alignment issues (thanks Tron for the help)
Darkvater
parents:
2952
diff
changeset
|
41 |
} |
661554d683cd
(svn r3529) - Fix: [ 1415782 ] crash in string code with openbsd/zaurus; alignment issues (thanks Tron for the help)
Darkvater
parents:
2952
diff
changeset
|
42 |
|
0 | 43 |
|
4300
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4274
diff
changeset
|
44 |
/** return the largest value that can be entered in a variable. |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4274
diff
changeset
|
45 |
*/ |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4274
diff
changeset
|
46 |
#define MAX_UVALUE(type) ((type)~(type)0) |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4274
diff
changeset
|
47 |
|
0 | 48 |
#endif /* MACROS_H */ |