Make use of the new -[OFString intValue]
FossilOrigin-Name: 09eb96f3397daee11cfda5cbbbcc5caa6d3d9fb9ff3eeb07971e8e3773b65dd6
This commit is contained in:
parent
5a033ec827
commit
f1968ce5af
10 changed files with 35 additions and 36 deletions
|
@ -38,34 +38,34 @@ padArguments(OFArray<OFString *> *arguments, size_t count)
|
|||
if (isDown) {
|
||||
arguments = padArguments(arguments, 2);
|
||||
((void(__cdecl *)(int))_function)(
|
||||
(int)[arguments[1] longLongValueWithBase:0]);
|
||||
[arguments[1] intValueWithBase:0]);
|
||||
}
|
||||
break;
|
||||
case ARG_2INT:
|
||||
if (isDown) {
|
||||
arguments = padArguments(arguments, 3);
|
||||
((void(__cdecl *)(int, int))_function)(
|
||||
(int)[arguments[1] longLongValueWithBase:0],
|
||||
(int)[arguments[2] longLongValueWithBase:0]);
|
||||
[arguments[1] intValueWithBase:0],
|
||||
[arguments[2] intValueWithBase:0]);
|
||||
}
|
||||
break;
|
||||
case ARG_3INT:
|
||||
if (isDown) {
|
||||
arguments = padArguments(arguments, 4);
|
||||
((void(__cdecl *)(int, int, int))_function)(
|
||||
(int)[arguments[1] longLongValueWithBase:0],
|
||||
(int)[arguments[2] longLongValueWithBase:0],
|
||||
(int)[arguments[3] longLongValueWithBase:0]);
|
||||
[arguments[1] intValueWithBase:0],
|
||||
[arguments[2] intValueWithBase:0],
|
||||
[arguments[3] intValueWithBase:0]);
|
||||
}
|
||||
break;
|
||||
case ARG_4INT:
|
||||
if (isDown) {
|
||||
arguments = padArguments(arguments, 5);
|
||||
((void(__cdecl *)(int, int, int, int))_function)(
|
||||
(int)[arguments[1] longLongValueWithBase:0],
|
||||
(int)[arguments[2] longLongValueWithBase:0],
|
||||
(int)[arguments[3] longLongValueWithBase:0],
|
||||
(int)[arguments[4] longLongValueWithBase:0]);
|
||||
[arguments[1] intValueWithBase:0],
|
||||
[arguments[2] intValueWithBase:0],
|
||||
[arguments[3] intValueWithBase:0],
|
||||
[arguments[4] intValueWithBase:0]);
|
||||
}
|
||||
break;
|
||||
case ARG_NONE:
|
||||
|
|
|
@ -49,16 +49,16 @@ VARP(minmillis, 0, 5, 1000);
|
|||
while ((option = [optionsParser nextOption]) != '\0') {
|
||||
switch (option) {
|
||||
case 'w':
|
||||
_width = (int)optionsParser.argument.longLongValue;
|
||||
_width = optionsParser.argument.intValue;
|
||||
break;
|
||||
case 'h':
|
||||
_height = (int)optionsParser.argument.longLongValue;
|
||||
_height = optionsParser.argument.intValue;
|
||||
break;
|
||||
case 'u':
|
||||
uprate = (int)optionsParser.argument.longLongValue;
|
||||
uprate = optionsParser.argument.intValue;
|
||||
break;
|
||||
case 'c':
|
||||
maxcl = (int)optionsParser.argument.longLongValue;
|
||||
maxcl = optionsParser.argument.intValue;
|
||||
break;
|
||||
case ':':
|
||||
case '=':
|
||||
|
|
|
@ -20,12 +20,13 @@
|
|||
|
||||
int x, y;
|
||||
@try {
|
||||
x = (int)_text.longLongValue;
|
||||
x = _text.intValue;
|
||||
} @catch (OFInvalidFormatException *e) {
|
||||
x = 0;
|
||||
}
|
||||
|
||||
@try {
|
||||
y = (int)otherItem.text.longLongValue;
|
||||
y = otherItem.text.intValue;
|
||||
} @catch (OFInvalidFormatException *e) {
|
||||
y = 0;
|
||||
}
|
||||
|
|
|
@ -238,7 +238,7 @@ static OFString *sleepcmd = nil;
|
|||
void
|
||||
sleepf(OFString *msec, OFString *cmd)
|
||||
{
|
||||
sleepwait = (int)msec.longLongValue + lastmillis;
|
||||
sleepwait = msec.intValue + lastmillis;
|
||||
sleepcmd = cmd;
|
||||
}
|
||||
COMMANDN(sleep, sleepf, ARG_2STR)
|
||||
|
|
|
@ -233,7 +233,7 @@ execute(OFString *string, bool isDown)
|
|||
__kindof Identifier *identifier = identifiers[c];
|
||||
if (identifier == nil) {
|
||||
@try {
|
||||
val = (int)[c longLongValueWithBase:0];
|
||||
val = [c intValueWithBase:0];
|
||||
} @catch (OFInvalidFormatException *e) {
|
||||
conoutf(@"unknown command: %@", c);
|
||||
}
|
||||
|
@ -258,8 +258,8 @@ execute(OFString *string, bool isDown)
|
|||
else
|
||||
[identifier
|
||||
setValue:
|
||||
(int)[w[1]
|
||||
longLongValueWithBase:
|
||||
[w[1]
|
||||
intValueWithBase:
|
||||
0]];
|
||||
}
|
||||
} else if ([identifier
|
||||
|
@ -439,7 +439,7 @@ void
|
|||
loopa(OFString *times, OFString *body)
|
||||
{
|
||||
@autoreleasepool {
|
||||
int t = (int)times.longLongValue;
|
||||
int t = times.intValue;
|
||||
|
||||
loopi(t)
|
||||
{
|
||||
|
@ -497,7 +497,7 @@ void
|
|||
at(OFString *s_, OFString *pos)
|
||||
{
|
||||
@autoreleasepool {
|
||||
int n = (int)pos.longLongValue;
|
||||
int n = pos.intValue;
|
||||
std::unique_ptr<char> copy(strdup(s_.UTF8String));
|
||||
char *s = copy.get();
|
||||
|
||||
|
|
|
@ -106,8 +106,8 @@ keymap(OFString *code, OFString *key, OFString *action)
|
|||
if (keyMappings == nil)
|
||||
keyMappings = [[OFMutableArray alloc] init];
|
||||
|
||||
KeyMapping *mapping =
|
||||
[[KeyMapping alloc] initWithCode:(int)code.longLongValue name:key];
|
||||
KeyMapping *mapping = [[KeyMapping alloc] initWithCode:code.intValue
|
||||
name:key];
|
||||
mapping.action = action;
|
||||
[keyMappings addObject:mapping];
|
||||
}
|
||||
|
|
|
@ -605,10 +605,8 @@ newent(OFString *what, OFString *a1, OFString *a2, OFString *a3, OFString *a4)
|
|||
EDITSEL;
|
||||
@autoreleasepool {
|
||||
newentity(sel.x, sel.y, (int)player1.o.z, what,
|
||||
(int)[a1 longLongValueWithBase:0],
|
||||
(int)[a2 longLongValueWithBase:0],
|
||||
(int)[a3 longLongValueWithBase:0],
|
||||
(int)[a4 longLongValueWithBase:0]);
|
||||
[a1 intValueWithBase:0], [a2 intValueWithBase:0],
|
||||
[a3 intValueWithBase:0], [a4 intValueWithBase:0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -197,7 +197,7 @@ void
|
|||
texture(OFString *aframe, OFString *name)
|
||||
{
|
||||
@autoreleasepool {
|
||||
int num = curtexnum++, frame = (int)aframe.longLongValue;
|
||||
int num = curtexnum++, frame = aframe.intValue;
|
||||
if (num < 0 || num >= 256 || frame < 0 || frame >= MAXFRAMES)
|
||||
return;
|
||||
mapping[num][frame] = 1;
|
||||
|
|
|
@ -68,10 +68,10 @@ mapmodel(
|
|||
OFString *rad, OFString *h, OFString *zoff, OFString *snap, OFString *name)
|
||||
{
|
||||
MD2 *m = loadmodel(name);
|
||||
m.mmi = [[MapModelInfo alloc] initWithRad:(int)rad.longLongValue
|
||||
h:(int)h.longLongValue
|
||||
zoff:(int)zoff.longLongValue
|
||||
snap:(int)snap.longLongValue
|
||||
m.mmi = [[MapModelInfo alloc] initWithRad:rad.intValue
|
||||
h:h.intValue
|
||||
zoff:zoff.intValue
|
||||
snap:snap.intValue
|
||||
name:m.loadname];
|
||||
|
||||
if (mapmodels == nil)
|
||||
|
|
|
@ -63,9 +63,9 @@ reloadtime(int gun)
|
|||
void
|
||||
weapon(OFString *a1, OFString *a2, OFString *a3)
|
||||
{
|
||||
selectgun((a1.length > 0 ? (int)a1.longLongValue : -1),
|
||||
(a2.length > 0 ? (int)a2.longLongValue : -1),
|
||||
(a3.length > 0 ? (int)a3.longLongValue : -1));
|
||||
selectgun((a1.length > 0 ? a1.intValue : -1),
|
||||
(a2.length > 0 ? a2.intValue : -1),
|
||||
(a3.length > 0 ? a3.intValue : -1));
|
||||
}
|
||||
COMMAND(weapon, ARG_3STR)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue