SA:MP is beta software written by a small team in their spare time, thus * it has bugs (as does all software). Some of these have been known for a long * time but are low priority due to their minor effects, others go undiscovered * for a long time. Many of these bugs have solutions which can be implemented * in PAWN (and this may be simpler than implementing them in the SA:MP source * code). This include aims to collect fixes for as many of these bugs as * possible from the community (i.e. anyone who has a fix) together in to one * easy to use place for everyone's benefit.
* *To use this, simply include it after the default SA:MP functions, but * before third party includes:
* *
* #include <a_samp>
* // Any default re-definitions should go here.
* //#undef MAX_PLAYERS
* //#define MAX_PLAYERS 10
* #include <fixes>
* #include <other>
*
*
* To disable any fix for whatever reason simply do:
* *#define FIX_<name> 0
*
* For example, to disable all the file.inc fixes if you always correctly * check the file handle, do:
* *
* #include <a_samp>
* #define FIX_file_inc 0
* #include <fixes>
* #include <other>
*
*
* All the names of the fixes are single words, and are all listed with their * fix descriptions below.
* *If you only have one script running on your server (i.e. no * FilterScripts), you can use this define to improve the fixes.inc code:
* *
* #include <a_samp>
* #define FIXES_Single 1
* #include <fixes>
* #include <other>
*
*
* There are a few options for improved execution of this script. Define
* these symbols as
A few fixes are disabled by default, to enable them all do:
* *
* #define GetPlayerDialog 1
* #define file_inc 1
* #define random 1
* #define HideMenuForPlayer_2 1
* #define GameTextStyles 1
* #define GetPlayerWeather 1
* #define GetWeather 1
* #define GetWorldTime 1
*
*
* Or more simply (and future-proof-ly):
* *
* #define FIXES_EnableAll
* #define FIXES_EnableDeprecated
*
*
* The file is fairly well documented, with a list of the currently * (hopefully) fixed bugs at the top. If you know of others, or have solutions * for others, it would be greatly appreciated if you could post them as issues * on this repository. The fixes also need extensive testing to find bugs in * the fixes themselves.
* *Again, this is a community project, merely managed by Y_Less and others - * if anyone has comments, contributions, criticisms etc. please again post them * as issues on the repository. This includes additions to source code, * documentation, presentation, translations (mainly of this documentation - * multiple versions of the include should be avoided to reduce fragmentation), * or any other related area you can think of.
* *There are a few other includes which aim to fix issues too large to be * included here:
* *Originally Posted by Y_Less:
* *[This] is beta software written by a small team in their spare time, * thus it has bugs (as does all software). This software is explicitly * designed to solve bugs, not cause them, but there may still be bugs.
* *The most likely cause of bugs is certain combinations of disabled fixes. * Some fixes are inter-mixed and while they SHOULD work when the fixes they are * combined with are disabled, not every combination has been tested. There are * literally billions of possible combinations - if you find one that doesn't * compile or work, please tell us.
* *
* ///
* /// <remarks>Information about fix here</remarks>
* /// <fixes>NameOfFixHere</fixes>
* ///
*
* #if _FIXES_SAMP && defined _ALS_NameOfFixHere
* #error _ALS_NameOfFixHere defined
* #endif
* native BAD_NameOfFixHere(params) = NameOfFixHere;
*
* ///
* /// <remarks>Information about fix here</remarks>
* /// <fixes>NameOfFixHere</fixes>
* ///
*
* #if FIX_NameOfFixHere
* stock FIXES_NameOfFixHere(params)
* {
* return 0;
* }
*
* // The trailing `(` is VERY important to keep future `native X() = Y;`s working.
* #if _FIXES_SAMP
* #define _ALS_NameOfFixHere
* #define NameOfFixHere( FIXES_NameOfFixHere(
* #endif
* // `__` suffix version for hidden calls to the originals.
* #define _ALS_NameOfFixHere__
* #define NameOfFixHere__( FIXES_NameOfFixHere(
* #endif
*
*
* A copyable version of this pattern is at the end of the file.
* #if !defined FIX_NameOfFixHere
* #if defined NativeInFixRelease
* #if FIXES_EnableDeprecated
* static _FIXES_OPTION FIX_NameOfFixHere = FIXES_EnableDeprecated;
* #else
* _FIXES_CONST_PAWNDOC(FIX_NameOfFixHere = FIXES_EnableDeprecated);
* #endif
* #define FIX_NameOfFixHere FIXES_EnableDeprecated
* #else
* static _FIXES_OPTION FIX_NameOfFixHere = _FIXES_DEFAULT;
* #define FIX_NameOfFixHere _FIXES_DEFAULT
* #endif
* #elseif _FIXES_IS_UNSET(FIX_NameOfFixHere)
* #undef FIX_NameOfFixHere
* static stock FIX_NameOfFixHere = 2;
* #define FIX_NameOfFixHere (2)
* #elseif FIX_NameOfFixHere
* #undef FIX_NameOfFixHere
* static stock FIX_NameOfFixHere = 1;
* #define FIX_NameOfFixHere (1)
* #else
* #undef FIX_NameOfFixHere
* static stock FIX_NameOfFixHere = 0;
* #define FIX_NameOfFixHere (0)
* #endif
*
*
* This only includes this fix if that native doesn't exist. A copyable
* version of this pattern is at the end of the file.The fixes.inc code itself now contains all of the documentation
* in its header, formatted using the compiler's natively supported pawn-doc,
* plus some custom XSL. Previously README.md and the header had to be
* kept in sync manually. Now you can just compile a script with
The descriptions of the fixes all look like:
* *
* <fix name="Short Name" disabled="true" fixed="Optional server version of official fix where applicable">
* <problem>
* Description of problem.
* </problem>
* <solution>
* Description of solution.
* </solution>
* <see>Relevant functions.</see>
* <author href="Optional address of their profile">Person who wrote the fix</author>
* <post href="Optional link to the original post where applicable." />
* </fix>
*
*
*
*
*
* #if defined MACRO_NAME
* // `#define MACRO_NAME` exists previously, don't document it here.
* _FIXES_HIDE_PAWNDOC(SIMILAR_NAME);
* #else
* // Doesn't exist. Document it and define it.
* _FIXES_FUNC_PAWNDOC(MACRO_NAME(parameters));
* #define MACRO_NAME(%0) (%0)
* #endif
*
*
* #if defined MACRO_NAME
* // `#define MACRO_NAME` exists previously, don't document it here.
* _FIXES_HIDE_PAWNDOC(SIMILAR_NAME);
* #else
* // Doesn't exist. Document it and define it.
* _FIXES_CONST_PAWNDOC(MACRO_NAME = 42);
* #define MACRO_NAME (42)
* #endif
*
* Test if something is defined, but without a value. For example:
* *
* #define FIX_AddMenuItem
*
*
* Instead of:
* *
* #define FIX_AddMenuItem 1
*
*
* Exploits the fact that
Conversely, when no value is given this becomes
* error 017: undefined symbol "do_not_use_tabsize_0"
*
*
* There is ZERO reason to use it. There are ocassionally times when an
* indentation reset is required, usually because of macros containing code that
* would otherwise appear correct. For example:
*
*
* #define TEST_MACRO
*
* main()
* {
* new a = 42;
* if (a)
* {
* print("true");
* }
* #if defined TEST_MACRO
* else
* {
* print("false");
* }
* a = 42;
* #endif
* printf("a = %d", a);
* }
*
*
* Even that can be fixed without
* #define TEST_MACRO
*
* main()
* {
* new a = 42;
* if (a)
* {
* print("true");
* }
* #if defined TEST_MACRO
* else
* {
* print("false");
* }
* #pragma tabsize 4
* a = 42;
* #endif
* printf("a = %d", a);
* }
*
*
* There is just no excuse.
*