forked from sdeering/Sublime3-Theme-NotepadPlusPlus
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_syntax.sma
412 lines (327 loc) · 12.6 KB
/
test_syntax.sma
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
/*
* This version number must be synced with "githooks/GALILEO_SMA_VERSION.txt" for manual edition.
* To update them automatically, use: ./githooks/updateVersion.sh [major | minor | patch | build]
*/
new const PLUGIN_NAME[] = "Galileo";
new const PLUGIN_AUTHOR[] = "Brad Jones/Addons zz";
new const bool:g_dummy_value = false;
static formated_message[ MAX_BIG_BOSS_STRING ];
const formated_message;
stock nominationAttemptWithNamePart( player_id = 5, partialNameAttempt[] )
{}
stock test_loadVoteChoices_check( test_id, mapToCheck[], bool:isToBePresent = "asdfadsf" )
{}
#define INSERT_COLOR_TAGS(%1) \
{ \
replace_all( %1, /*charsmax( %1 )*/, "!g", "^4" ); \
replace_all( %1, charsmax( %1 ), "!t", "^3" ); \
\ replace_all( %1, charsmax( %1 ), "!n", "^1" ); \
replace_all( %1, charsmax( %1 ), "!y", "^1" ); \
}
#define IS_TO_USE_BLACKLIST_INSTEAD_OF_WHITELIST 01+50
/**
* Change this value from 0 to 1, to use the Whitelist feature as a Blacklist feature.
*/
#define IS_TO_USE_BLACKLIST_INSTEAD_OF_WHITELIST 01
not match this
not match this
#define DEBUG a
not match
not match
#define DEBUG
not match
not match
// If the line contains only 'define+word' it only match the macro ending at the next line.
// Opened a issue for this bad match on: https://github.com/SublimeTextIssues/Core/issues/1377
#define DEBUG
not match
not match
/**
* Convert colored strings codes '!g for green', '!y for yellow', '!t for team'.
*
* @param string[] a string pointer to be converted.
*/
#define INSERT_COLOR_TAGS(%1) \
{ \
replace_all( %1, charsmax( %1 ), "!g", "^4" ); \
replace_all( %1, charsmax( %1 ), "!t", "^3" ); \
replace_all( %1, charsmax( %1 ), "!n", "^1" ); \
replace_all( %1, charsmax( %1 ), "!y", "^1" ); \
}
not match this
stock hi()
{
colored_menus();
if( colored_menus() )
{
copy( COLOR_RED, 2, "\r" );
copy( COLOR_WHITE, 2, "\w" );
copy( COLOR_YELLOW, 2, "\y" );
copy( COLOR_GREY, 2, "\d" );
}
color_print( 0, "%Lggggg %L",
LANG_PLAYER, "GAL_CHANGE_TIMEEXPIRED", LANG_PLAYER, "GAL_NEXTMAP", g_nextMap );
{
color_print( 0, "%Lggggg %L",
LANG_PLAYER, "GAL_CHANGE_TIMEEXPIRED", LANG_PLAYER, "GAL_NEXTMAP", g_nextMap );
}
colored_menus();
if( colored_menus() )
{
copy( COLOR_RED, 2, "\r" );
copy( COLOR_WHITE, 2, "\w" );
copy( COLOR_YELLOW, 2, "\y" );
copy( COLOR_GREY, 2, "\d" );
}
}
#define IS_NOMINATION_MININUM_PLAYERS_CONTROL_ENABLED() \
( get_realplayersnum() < get_pcvar_num( cvar_voteMinPlayers ) \
&& get_pcvar_num( cvar_nomMinPlayersControl ) \
&& get_pcvar_num( cvar_nomMinPlayersControl ) \
&& get_pcvar_num( cvar_nomMinPlayersControl ) )
not match this
#include <amxmodx>
#if AMXX_VERSION_NUM < 183 /* */ //
#include <colorchat>
#endif
stock hiddddddddddddddddddddd()
color_print( 0, "%L %L",
LANG_PLAYER, "GAL_CHANGE_TIMEEXPIRED", LANG_PLAYER, "GAL_NEXTMAP", g_nextMap );
// not match this
/**
* Dummy value used on conditional statements to allow statements as always true or false.
*/
new const bool:g_dummy_value = false;
new const PLUGIN_VERSION[] = "v3.2.2-259";
#define GET_USER_NAME(%1,%2) \
{ \
if( is_user_connected( %1 ) ) \
{ \
get_user_name( %1, %2, charsmax( %2 ) ); \
} \
else \
{ \
copy( %2, charsmax( %2 ), "Unknown Dude" ); \
} \
}
not match this
/**
* Setup the debugging tools when they are used/necessary.
*/
#if DEBUG_LEVEL & DEBUG_LEVEL_UNIT_TEST_NORMAL
not match this
/**
* Contains all imediates unit tests to execute.
*/
stock normalTestsToExecute()
{
test_registerTest();
test_isInEmptyCycle();
test_mapGetNext_cases();
test_loadCurrentBlackList_cases();
test_resetRoundsScores_cases();
test_loadVoteChoices_cases( DEBUGGER_OUTPUT_LOG_FILE_NAME[], formated_message );
}
#define DEBUG
#define LOGGER(%1) debugMesssageLogger( %1 );
#else
/**
* The file on the './addons/amxmodx/logs' folder, to save the debugging text output.
*/
new const DEBUGGER_OUTPUT_LOG_FILE_NAME[] = "_galileo.log";
/**
* Write messages to the debug log file on 'addons/amxmodx/logs'.
*
* @param log_file the log file name.
* @param formated_message the formatted message to write down to the debug log file.
*/
stock print_logger( const message[] = "", any:... )
{
static formated_message[ MAX_BIG_BOSS_STRING ];
vformat( formated_message, charsmax( formated_message ), message, 2 );
writeToTheDebugFile( DEBUGGER_OUTPUT_LOG_FILE_NAME, formated_message );
}
#endif
/**
* Necessary modules.
*/
#include <amxmodx>
#include <amxmisc>
// Unit Tests Main Definitions
/// ###############################################################################################
/// ###############################################################################################
/// ###############################################################################################
/// ###############################################################################################
/**
* Force the use of semicolons on every statements.
*/
#pragma semicolon 1
#if IS_TO_ENABLE_SVEN_COOP_SUPPPORT > 0
#include <hamsandwich>
#endif
// Global Macro Expansions
// ###############################################################################################
/**
* Task ids are 100000 apart.
*/
enum (+= 100000)
{
TASKID_RTV_REMINDER = 100000, // start with 100000
TASKID_SHOW_LAST_ROUND_HUD,
TASKID_FINISH_GAME_TIME_BY_HALF,
}
public plugin_init()
{
#if DEBUG_LEVEL & DEBUG_LEVEL_CRITICAL_MODE
g_debug_level = 1048575;
#endif
var = 50; // when anything start without indentation, it breaks other things, so just indent your code.
register_plugin( PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR );
LOGGER( 1, "^n^n^n^n%s PLUGIN VERSION %s INITIATING...", PLUGIN_NAME, PLUGIN_VERSION )
register_cvar( "amx_extendmap_max", "90" );
cvar_extendmapAllowStayType = register_cvar( "amx_extendmap_allow_stay_type", "0" );
cvar_disabledValuePointer = register_cvar( "gal_disabled_value_pointer", "0", FCVAR_SPONLY );
cvar_isFirstServerStart = register_cvar
( "gal_server_starting", "1", FCVAR_SPONLY );
}
#define GET_USER_NAME(%1,%2)
not match this
/**
* Setup the debugging tools when they are used/necessary.
*/
#if DEBUG_LEVEL & DEBUG_LEVEL_UNIT_TEST_NORMAL
not match this
// This below is not matched as a function call because function calls
// are only matched inside blocks. Now I thinking better, I may create
// a new rule to match it as a function definition.
configureServerStart(%1,%2, var = 80, str[] = "kjlçkj" )
{
LOGGER( 128, "I AM ENTERING ON configureServerStart(0)" )
}
configureServerStartt( )
// However this function call bellow could match as a function definition also
// but it would just pollute a little the symbols list.
LOGGER( 128, "I AM ENTERING ON configureServerStart(0)" )
stock configureServerStartt
(
)
{
LOGGER
( 128, "I AM ENTERING ON configureServerStart(0)" )
LOGGER( 128, "I AM ENTERING ON configureServerStart(0)" )
if( __get_pcvar_num
( __cvar_gameCrashRecreationAction, get_pcvar_num( cvar_isFirstServerStart) ) )
{
g_isToCreateGameCrashFlag = true;
}
if( get_pcvar_num( cvar_isFirstServerStart) )
{
new backupMapsFilePath[ MAX_FILE_PATH_LENGHT ];
formatex( backupMapsFilePath, charsmax( backupMapsFilePath ), "%s/%s", g_dataDirPath, CURRENT_AND_NEXTMAP_FILE_NAME );
if( file_exists( backupMapsFilePath ) )
{
handleServerStart( backupMapsFilePath );
}
else
{
saveCurrentAndNextMapNames( g_nextMap );
}
}
else // update the current and next map names every server start
{
saveCurrentAndNextMapNames( g_nextMap );
}
// Handle the action to take immediately after half of the time-left or rounds-left passed
// when using the 'Game Server Crash Recreation' Feature.
if( g_isToCreateGameCrashFlag
&& ( g_timeLimitNumber / SERVER_GAME_CRASH_ACTION_RATIO_DIVISOR < g_timeLimitNumber - secondsLeft / 60
|| g_fragLimitNumber / SERVER_GAME_CRASH_ACTION_RATIO_DIVISOR < g_greatestKillerFrags
|| g_maxRoundsNumber / SERVER_GAME_CRASH_ACTION_RATIO_DIVISOR < g_roundsPlayedNumber + 1
|| g_winLimitInteger / SERVER_GAME_CRASH_ACTION_RATIO_DIVISOR < g_totalTerroristsWins + g_totalCtWins ) )
{
new gameCrashActionFilePath[ MAX_FILE_PATH_LENGHT ];
g_isToCreateGameCrashFlag = false; // stop creating this file unnecessarily
LOGGER( 1, "( vote_manageEnd ) %d/%d < %d: %d", \
g_winLimitInteger, SERVER_GAME_CRASH_ACTION_RATIO_DIVISOR, g_totalTerroristsWins + g_totalCtWins, \
g_winLimitInteger / SERVER_GAME_CRASH_ACTION_RATIO_DIVISOR < g_totalTerroristsWins + g_totalCtWins )
generateGameCrashActionFilePath( gameCrashActionFilePath, charsmax( gameCrashActionFilePath ) );
write_file( gameCrashActionFilePath, "Game Crash Action Flag File^n^nSee the cvar 'gal_game_crash_recreation'.^nDo not delete it." );
}
// load runoff choices
copy( runoffChoice[ 0 ], charsmax( runoffChoice[] ), g_votingMapNames[ g_arrayOfRunOffChoices[ 0 ] ] );
copy( runoffChoice[ 1 ], charsmax( runoffChoice[] ), g_votingMapNames[ g_arrayOfRunOffChoices[ 1 ] ] );
LOGGER( 4, " ( votedisplay ) g_isToRefreshVoteStatus: %i, g_totalVoteOptions: %i, strlen( g_voteStatusClean ): %i", \
g_isToRefreshVoteStatus, g_totalVoteOptions, strlen( g_voteStatusClean ) )
}
stock print_logger( const message[] = "", any:... )
{
static formated_message[ MAX_BIG_BOSS_STRING ];
vformat( formated_message, charsmax( formated_message ), message, 2 );
writeToTheDebugFile( DEBUGGER_OUTPUT_LOG_FILE_NAME, formated_message );
}
new const bool:g_dummy_value = false;
static formated_message[ MAX_BIG_BOSS_STRING ];
const formated_message;
stock nominationAttemptWithNamePart( player_id = 5, partialNameAttempt[], player = 8 )
stock test_loadVoteChoices_check( test_id, mapToCheck[], isToBePresent = "asdfadsf" )
stock test_loadVoteChoices_check( test_id, mapToCheck[], bool:isToBePresent = "asdfadsf" )
{
new const bool:g_dummy_value = false;
static formated_message[ MAX_BIG_BOSS_STRING ];
const formated_message;
new const bool:g_dummy_value = false;
static formated_message[ MAX_BIG_BOSS_STRING ];
const formated_message;
new bool:isMapPresent;
new currentIndex;
new errorMessage[ MAX_LONG_STRING ];
new const bool:g_dummy_value = false;
static formated_message[ MAX_BIG_BOSS_STRING ];
const formated_message;
new bool : isMapPresent ;
new currentIndex ;
new errorMessage [ MAX_LONG_STRING ];
fileDescriptor = fopen( mapFileListPath, "wt", partialNameAttempt );
if( mapToCheck[ 0 ] )
{
for( currentIndex = 0; currentIndex < sizeof g_votingMapNames; ++currentIndex )
{
if( equali( g_votingMapNames[ currentIndex ], mapToCheck ) )
{
isMapPresent = true;
}
}
formatex( errorMessage, charsmax( errorMessage ),
"The map '%s' %s be present on the voting map menu.", mapToCheck, ( isToBePresent? "must to" : "MUST NOT to" ) );
SET_TEST_FAILURE( test_id, isMapPresent != isToBePresent, errorMessage )
}
}
public own_type:on_damage( id )
{
new attacker = own_type: get_user_attacker( id )
// There exists only one thing which can fuck your scopes meta.block, it is the preprocessor.
// I need to find these preprocessor blocks, and deal within them.
#if defined DAMAGE_RECIEVED
// id should be connected if this message is sent, but lets check anyway
if( is_user_connected( id )
&& is_user_connected( attacker ) )
if( get_user_flags( attacker ) & ADMIN_LEVEL_H )
{
new damage = read_data( 2 )
set_hudmessage( 255, 0, 0, 0.45, 0.50, 2, 0.1, 4.0, 0.1, 0.1, -1 )
ShowSyncHudMsg( id, g_MsgSync2, "%i^n", damage )
#else
if( is_user_connected( attacker )
&& ( get_user_flags( attacker ) & ADMIN_LEVEL_H ) )
{
new damage = read_data( 2 )
#endif
set_hudmessage( 0, 100, 200, -1.0, 0.55, 2, 0.1, 4.0, 0.02, 0.02, -1 )
ShowSyncHudMsg( attacker, g_MsgSync, "%i^n", damage )
}
hi_girl()
}
public on_damage( id )
{
get_user_attacker( id )
}