y_unique_entry.inc 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. /*+
  2. * <library name="y_unique">
  3. * <section>
  4. * Description
  5. * </section>
  6. * Defines a symbol differently every time it is included.
  7. * <section>
  8. * Version
  9. * </section>
  10. * 1.0
  11. * </library>
  12. *//** *//*
  13. Legal:
  14. Version: MPL 1.1
  15. The contents of this file are subject to the Mozilla Public License Version
  16. 1.1 the "License"; you may not use this file except in compliance with
  17. the License. You may obtain a copy of the License at
  18. http://www.mozilla.org/MPL/
  19. Software distributed under the License is distributed on an "AS IS" basis,
  20. WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  21. for the specific language governing rights and limitations under the
  22. License.
  23. The Original Code is the YSI framework.
  24. The Initial Developer of the Original Code is Alex "Y_Less" Cole.
  25. Portions created by the Initial Developer are Copyright C 2011
  26. the Initial Developer. All Rights Reserved.
  27. Contributors:
  28. Y_Less
  29. koolk
  30. JoeBullet/Google63
  31. g_aSlice/Slice
  32. Misiur
  33. samphunter
  34. tianmeta
  35. maddinat0r
  36. spacemud
  37. Crayder
  38. Dayvison
  39. Ahmad45123
  40. Zeex
  41. irinel1996
  42. Yiin-
  43. Chaprnks
  44. Konstantinos
  45. Masterchen09
  46. Southclaws
  47. PatchwerkQWER
  48. m0k1
  49. paulommu
  50. udan111
  51. Thanks:
  52. JoeBullet/Google63 - Handy arbitrary ASM jump code using SCTRL.
  53. ZeeX - Very productive conversations.
  54. koolk - IsPlayerinAreaEx code.
  55. TheAlpha - Danish translation.
  56. breadfish - German translation.
  57. Fireburn - Dutch translation.
  58. yom - French translation.
  59. 50p - Polish translation.
  60. Zamaroht - Spanish translation.
  61. Los - Portuguese translation.
  62. Dracoblue, sintax, mabako, Xtreme, other coders - Producing other modes for
  63. me to strive to better.
  64. Pixels^ - Running XScripters where the idea was born.
  65. Matite - Pestering me to release it and using it.
  66. Very special thanks to:
  67. Thiadmer - PAWN, whose limits continue to amaze me!
  68. Kye/Kalcor - SA:MP.
  69. SA:MP Team past, present and future - SA:MP.
  70. Optional plugins:
  71. Gamer_Z - GPS.
  72. Incognito - Streamer.
  73. Me - sscanf2, fixes2, Whirlpool.
  74. */
  75. #define _Y_UNIQUE_INCLUDED
  76. #if defined _inc_y_unique_entry
  77. #undef _inc_y_unique_entry
  78. #endif
  79. #if defined UNIQUE_FUNCTION
  80. #undef UNIQUE_FUNCTION
  81. #endif
  82. // The "static stock const" values are used for debugging, since they will show
  83. // up in preprocessed dumps ("-l") with the value of "UNIQUE_SYMBOL" at that
  84. // moment, instead of its final value.
  85. #if defined UNIQUE_SYMBOL
  86. #if UNIQUE_SYMBOL < 0 || UNIQUE_SYMBOL >= 1000
  87. static stock const UNIQUE_SYMBOL_TOO_LARGE = UNIQUE_SYMBOL;
  88. #error UNIQUE_SYMBOL out of range.
  89. #endif
  90. #if UNIQUE_SYMBOL < 100
  91. static stock const UNIQUE_SYMBOL_LESS_THAN_100 = UNIQUE_SYMBOL;
  92. #include "y_unique__000_to_099"
  93. #elseif UNIQUE_SYMBOL < 200
  94. static stock const UNIQUE_SYMBOL_LESS_THAN_200 = UNIQUE_SYMBOL;
  95. #include "y_unique__100_to_199"
  96. #elseif UNIQUE_SYMBOL < 300
  97. static stock const UNIQUE_SYMBOL_LESS_THAN_300 = UNIQUE_SYMBOL;
  98. #include "y_unique__200_to_299"
  99. #elseif UNIQUE_SYMBOL < 400
  100. static stock const UNIQUE_SYMBOL_LESS_THAN_400 = UNIQUE_SYMBOL;
  101. #include "y_unique__300_to_399"
  102. #elseif UNIQUE_SYMBOL < 500
  103. static stock const UNIQUE_SYMBOL_LESS_THAN_500 = UNIQUE_SYMBOL;
  104. #include "y_unique__400_to_499"
  105. #elseif UNIQUE_SYMBOL < 600
  106. static stock const UNIQUE_SYMBOL_LESS_THAN_600 = UNIQUE_SYMBOL;
  107. #include "y_unique__500_to_599"
  108. #elseif UNIQUE_SYMBOL < 700
  109. static stock const UNIQUE_SYMBOL_LESS_THAN_700 = UNIQUE_SYMBOL;
  110. #include "y_unique__600_to_699"
  111. #elseif UNIQUE_SYMBOL < 800
  112. static stock const UNIQUE_SYMBOL_LESS_THAN_800 = UNIQUE_SYMBOL;
  113. #include "y_unique__700_to_799"
  114. #elseif UNIQUE_SYMBOL < 900
  115. static stock const UNIQUE_SYMBOL_LESS_THAN_900 = UNIQUE_SYMBOL;
  116. #include "y_unique__800_to_899"
  117. #else
  118. static stock const UNIQUE_SYMBOL_OTHER_VALUE;
  119. #include "y_unique__900_to_999"
  120. #endif
  121. #else
  122. static stock const UNIQUE_SYMBOL_DOESNT_EXIST;
  123. #define UNIQUE_SYMBOL (0)
  124. #define UNIQUE_FUNCTION<%0...%1> %0000%1
  125. #endif
  126. #if !defined Y_UNIQUE_LOCK_CONTRIBUTION
  127. #define Y_UNIQUE_LOCK_CONTRIBUTION 0
  128. #endif
  129. #if defined YSI_LOCK_MODE
  130. #if Y_UNIQUE_LOCK_CONTRIBUTION < 2
  131. forward UNIQUE_FUNCTION<@yH_OnScriptInit@...>();
  132. public UNIQUE_FUNCTION<@yH_OnScriptInit@...>()
  133. {
  134. #if Y_UNIQUE_LOCK_CONTRIBUTION == 0
  135. #undef Y_UNIQUE_LOCK_CONTRIBUTION
  136. #define Y_UNIQUE_LOCK_CONTRIBUTION 1
  137. YSI_gLockData[1] -= 'i' - '.';
  138. #else
  139. #undef Y_UNIQUE_LOCK_CONTRIBUTION
  140. #define Y_UNIQUE_LOCK_CONTRIBUTION 2
  141. YSI_gLockData{11} = 0;
  142. #endif
  143. }
  144. #include "y_unique_entry"
  145. #endif
  146. #endif