Skip to content

Commit 86a4518

Browse files
author
Alex Cole
committed
Use the correct version of __pawn_build, and DO NOT define __PawnBuild.
Some libraries rely on `#if defined __PawnBuild` to quickly detect newer compilers. Using `#define __PawnBuild 0` breaks this. Instead UNDEFINE it when it is detected and use `#define __pawn_build 0` as a more consistent definition.
1 parent da900aa commit 86a4518

1 file changed

Lines changed: 16 additions & 9 deletions

File tree

open.mp.inc

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,23 @@ public const __SAMP_INCLUDES_VERSION = 0x037030;
101101
public const __OPEN_MP_VERSION = 0;
102102
#pragma unused __OPEN_MP_VERSION
103103

104-
#if !defined __PawnBuild
105-
#define __PawnBuild 0
104+
#if defined __PawnBuild
105+
#if __PawnBuild == 0
106+
#undef __PawnBuild
107+
#define __pawn_build 0
108+
#else
109+
#define __pawn_build __PawnBuild
110+
#endif
111+
#else
112+
#define __pawn_build 0
106113
#endif
107114

108115
// Optionally stricter tags.
109116
#if defined NO_TAGS
110117
#define __TAG(%0) _
111118
#elseif defined STRONG_TAGS
112119
#define __TAG(%0) T_%0
113-
#if __PawnBuild >= 11
120+
#if __pawn_build >= 11
114121
#define OPEN_MP_TAGS {LANDING_GEAR_STATE, T_CONNECTION_STATUS, T_CP_TYPE, T_WEAPON, T_PLAYER_MARKERS_MODE, T_DIALOG_STYLE, T_HTTP_METHOD, T_HTTP_ERROR, T_DOWNLOAD_REQUEST, T_SELECT_OBJECT, T_OBJECT_MATERIAL_SIZE, T_OBJECT_MATERIAL_TEXT_ALIGN, T_EDIT_RESPONSE, T_PLAYER_STATE, T_SPECIAL_ACTION, T_FIGHT_STYLE, T_WEAPONSKILL, T_WEAPONSTATE, T_KEY, T_CAM_MODE, T_MAPICON, T_SPECTATE_MODE, T_PLAYER_RECORDING_TYPE, T_FORCE_SYNC, T_CLICK_SOURCE, T_BULLET_HIT_TYPE, T_TEXT_DRAW_FONT, T_TEXT_DRAW_ALIGN, T_VARTYPE, T_CARMODTYPE, T_VEHICLE_MODEL_INFO, T_VEHICLE_PANEL_STATUS, T_VEHICLE_DOOR_STATUS, T_VEHICLE_LIGHT_STATUS, T_VEHICLE_TYRE_STATUS, T_WEAPON_SLOT, Bit, Bitmap, XML, XMLEntry, Group, INI, Language, Style, DB, DBResult, Menu, Text, PlayerText, Text3D, PlayerText3D, File, Float, CUSTOM_TAG_TYPES, _}
115122
#else
116123
#define OPEN_MP_TAGS {T_WEAPON, Text, PlayerText, Text3D, PlayerText3D, File, Float, CUSTOM_TAG_TYPES, _}
@@ -121,7 +128,7 @@ public const __OPEN_MP_VERSION = 0;
121128
#endif
122129

123130
#if defined OPEN_MP_TAGS
124-
#elseif __PawnBuild >= 11
131+
#elseif __pawn_build >= 11
125132
// Why does this contain YSI tags? `Bit` - `Style`? People have been
126133
// trained to use `CUSTOM_TAG_TYPES` to add tags to various call checks,
127134
// but not for YSI internal tags. Not having them here would be a change
@@ -222,7 +229,7 @@ public const __OPEN_MP_VERSION = 0;
222229
* The maximum length of symbol names, excluding any NULLs.
223230
* </summary>
224231
*/
225-
#if __PawnBuild == 0
232+
#if __pawn_build == 0
226233
const __namemax = 31;
227234
#else
228235
// Disable the symbol length warning.
@@ -244,8 +251,8 @@ public const __OPEN_MP_VERSION = 0;
244251
#if defined __OPEN_MP_LONG_SYMBOL_NAME_TEST@
245252
const __namemax = 31;
246253
#else
247-
#define __OPEN_MP_LONG_SYMBOL_NAME_TEST_________padding_________padding
248-
#if defined __OPEN_MP_LONG_SYMBOL_NAME_TEST_________padding_________padding@
254+
#define __OPEN_MP_LONG_SYMBOL_NAME_TEST_____padding_________padding____
255+
#if defined __OPEN_MP_LONG_SYMBOL_NAME_TEST_____padding_________padding____@
249256
const __namemax = 63;
250257
#else
251258
#error Unknown compiler max symbol length.
@@ -438,7 +445,7 @@ const bool:undefined = bool:-1;
438445
#pragma warning pop
439446
#endif
440447

441-
#if __PawnBuild > 4
448+
#if __pawn_build > 4
442449
// Disable the deprecation warning. There's a bug on some compiler versions
443450
// where using a deprecated function shows two warnings - one at the call
444451
// site and one at the declaration site. There's no point having the
@@ -494,7 +501,7 @@ stock GetActorPoolSize()
494501
return MAX_ACTORS - 1;
495502
}
496503

497-
#if __PawnBuild > 4
504+
#if __pawn_build > 4
498505
// Maybe re-enable the deprecation warning.
499506
#pragma warning pop
500507
#endif

0 commit comments

Comments
 (0)