-
Notifications
You must be signed in to change notification settings - Fork 52
/
error.cpp
196 lines (188 loc) · 2.84 KB
/
error.cpp
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
/*
* sscanf 2.15.1
*
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the sscanf 2.0 SA:MP plugin.
*
* The Initial Developer of the Original Code is Alex "Y_Less" Cole.
* Portions created by the Initial Developer are Copyright (c) 2022
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Cheaterman
* DEntisT
* Emmet_
* karimcambridge
* kalacsparty
* Kirima
* leHeix
* maddinat0r
* Southclaws
* Y_Less
* ziggi
*
* Special Thanks to:
*
* SA:MP Team past, present, and future.
* maddinat0r, for hosting the repo for a very long time.
* Emmet_, for his efforts in maintaining it for almost a year.
*/
#include "error.h"
int
g_iErrorCode = 0,
g_iErrorSpecifier = 0,
g_iCurrentSpecifier = 0;
int
GetErrorCode()
{
return g_iErrorCode;
}
void
SetErrorCode(int error, int specifier)
{
if (error == 0)
{
g_iErrorCode = 0;
g_iErrorSpecifier = 0;
g_iCurrentSpecifier = specifier;
}
else
{
g_iErrorCode = error;
g_iErrorSpecifier = g_iCurrentSpecifier;
}
}
int
GetErrorSpecifier()
{
return g_iErrorSpecifier;
}
void
IncErrorSpecifier()
{
++g_iCurrentSpecifier;
}
int
GetErrorCategory(int error)
{
switch (error)
{
case 0:
return 0;
case 1:
case 32:
case 33:
case 34:
case 35:
case 36:
case 37:
case 38:
case 39:
case 40:
case 41:
case 42:
case 43:
case 49:
case 68:
case 69:
case 1002:
case 1005:
case 1006:
case 1007:
case 1008:
return 65536;
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:
case 11:
case 12:
case 13:
case 14:
case 15:
case 16:
case 17:
case 18:
case 19:
case 20:
case 21:
case 22:
case 23:
case 24:
case 25:
case 26:
case 27:
case 28:
case 29:
case 30:
case 31:
case 44:
case 45:
case 46:
case 47:
case 48:
case 50:
case 51:
case 52:
case 53:
case 54:
case 55:
case 56:
case 57:
case 58:
case 59:
case 60:
case 61:
case 62:
case 63:
case 64:
case 65:
case 66:
case 67:
case 70:
case 71:
case 72:
case 73:
return 131072;
case 1011:
case 1012:
case 1013:
case 1014:
case 1015:
case 1016:
case 1017:
case 1018:
case 1019:
return 196608;
case 1004:
return 262144;
case 1009:
return 327680;
case 1001:
return 393216;
case 2:
return 458752;
case 1003:
return 524288;
case 1010:
return 589824;
default:
return -1;
}
}