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