Wing Commander II
Reconstructed Win32 source (1996)
Toggle main menu visibility
Loading...
Searching...
No Matches
parsenum.c
Go to the documentation of this file.
1
/*
2
* Number parser.
3
*
4
* Retail object 0x453BD0-0x453C7F (link order; see docs/ORDER.md).
5
*/
6
#include "
game.h
"
7
8
/* Function start: 0x453BD0 */
9
/* Nothing in the shipped executable calls this. Converts "0x...", "$..."
10
* (hexadecimal) or decimal text of up to nine characters. */
11
short
ParseNumber
(
char
*text)
12
{
13
char
buffer[12];
14
short
value;
15
16
if
((
short
)
DosStrlen
(text) > 9)
17
return
0;
18
if
(toupper(text[1]) ==
'X'
) {
19
value =
ParseHexNumber
(text + 2);
20
}
else
if
(text[0] ==
'$'
) {
21
value =
ParseHexNumber
(text + 1);
22
}
else
{
23
DosStrcpy
(buffer, text);
24
value = (short)atoi(buffer);
25
}
26
return
value;
27
}
DosStrlen
short DosStrlen(const char *s)
Definition
eventmgr.c:479
DosStrcpy
char * DosStrcpy(char *dst, const char *src)
Definition
eventmgr.c:465
ParseHexNumber
short ParseHexNumber(char *text)
Definition
hexnum.c:14
game.h
Shared Win32 declarations, types and library interfaces.
ParseNumber
short ParseNumber(char *text)
Definition
parsenum.c:11
src
parsenum.c
Generated by
1.18.0