Hi,
Im currently working on rebuilding a old game which I have the source code for, but Im getting errors.
These are the errors:
Code:
netinfo.c<149> Undeclared name ntInfGetNetworkInfo
net.cpp<326> Ambigious overloaded function call
net.cpp<330> Undeclared name ntInfGetNetworkInfo
net.cpp<348> Ambigious overloaded function call
net.cpp<349> Ambigious overloaded function call
I have copied out some of the code because of the size of these files.
however, I have marked the line numbers giving errors.
There were more errors but these have been sorted out.
Whole Netinfo.c:
Code:
#include "netinfo.h"
#include <string.h>
#define PACKET_SIZE 60
#define NETINFUS_START 128
#define PRIVATE static
/*
* Version string
*/
const char * const ntgInfUSBuild = "\nntInfUS Ver 1.00 Build:" __DATE__ " " __TIME__ "\n";
static const char* PLANET_WEB_SIGNATURE = "PWBrowser";
PRIVATE bool
wait_flash(void)
{
Sint32 err;
while (true){
err = fmMngExecServer();
if (err == FMD_STAT_ERR)
return false;
if (err == FMD_STAT_COMPLETE)
return true;
}
}
PRIVATE Sint32
read_NetInfUS(NetInfUS *inf)
{
int size;
int num_blocks;
int remainder;
int block;
Sint32 status;
char buffer[PACKET_SIZE];
size = sizeof(NetInfUS);
num_blocks = size/PACKET_SIZE;
remainder = size % PACKET_SIZE;
if (remainder != 0) {
num_blocks++;
}
for (block = 0; block < num_blocks; block++) {
status = fmMngRead(NETINFUS_START + block, buffer);
if (!wait_flash())
return FMD_STAT_ERR;
if ( block == num_blocks - 1) {
/* Last block */
memcpy((char*)inf + (block*PACKET_SIZE), buffer, remainder);
} else {
memcpy((char*)inf + (block*PACKET_SIZE), buffer, PACKET_SIZE);
}
}
return FMD_OK;
}
Sint32
ntInfUSGetNetInfUS(NetInfUS *inf)
{
Sint32 rc;
rc = read_NetInfUS(inf);
if (rc != FMD_OK) {
return (NTD_ERR_NOINFO);
} else {
return (NTD_OK);
}
}
void copyPhoneNumber(const char* isp_number, const NetInfUS* net_info_us, char* buffer) {
const char* area_code_start;
const char* area_code_end;
int area_code_length;
const char* phone_start;
Bool use_area_code;
if (buffer == NULL || isp_number == NULL) {
return;
}
if (strlen(isp_number) == 0) {
buffer[0] = '\0';
return;
}
area_code_start = strchr(isp_number, '(');
if (area_code_start != NULL) {
area_code_end = strchr(area_code_start, ')');
} else {
area_code_end = NULL;
}
if (area_code_end != NULL) {
area_code_end++;
phone_start = area_code_end;
} else {
phone_start = isp_number;
area_code_start = NULL;
}
area_code_length = area_code_end - area_code_start;
use_area_code = ( area_code_start != NULL &&
( strncmp((char*)net_info_us->areaCode, area_code_start+1, area_code_length-2) != 0 || net_info_us->dialArea )
);
strcpy(buffer, (char*)net_info_us->callWait);
strcat(buffer, (char*)net_info_us->outLine);
if (use_area_code) {
strcat(buffer, (char*)net_info_us->longDst);
strncat(buffer, area_code_start, area_code_length);
}
strcat(buffer, phone_start);
}
void CheckNetInfUSData(NetInfUS *usinf);
Sint32
ntInfUSGetPhoneNumber(char *num1, char *num2, char *num3)
{
Sint32 rc;
NetworkInfo *netinfo;
NetworkAccessInfo *isp;
NetInfUS usinf;
rc = ntInfInit(NULL, NULL);
if (rc != NTD_OK)
return (rc);
149: rc = ntInfGetNetworkInfo(&netinfo);
if (rc != NTD_OK)
{
ntInfExit();
return (rc);
}
if (((netinfo->flag)&ISP_USE2) == ISP_USE2)
isp = &(netinfo->isp_info2);
else
isp = &(netinfo->isp_info1);
rc = ntInfUSGetNetInfUS(&usinf);
if (rc != FMD_OK)
{
ntInfExit();
return (NTD_ERR_NOINFO);
}
CheckNetInfUSData(&usinf);
copyPhoneNumber((char*)isp->accessPointNumber[0], &usinf, num1);
copyPhoneNumber((char*)isp->accessPointNumber[1], &usinf, num2);
copyPhoneNumber((char*)isp->accessPointNumber[2], &usinf, num3);
ntInfExit();
return (NTD_OK);
}
From net.cpp:
Code:
extern "C"
{
#include <netinfo.c>
}
..lots of other stuff
int NetworkClass::MakeNetworkInformation()
{
NetworkInfo *netinfoptr;
NetworkAccessInfo *ispinfoptr;
NetInfUS netinfous;
int retval = FALSE;
strcpy(net_info.HostName, "somegameserver");
326: init_error = ntInfInit(&gNetInfo, &gNetInfoWork);
if (init_error == NTD_OK)
{
330: init_error = ntInfGetNetworkInfo(&netinfoptr);
if (init_error == NTD_OK)
{
ntInfGetNetworkAccessInfo(ISP_NUM, &ispinfoptr);
init_error = ntInfUSGetNetInfUS(&netinfous);
if (init_error == NTD_OK)
{
unsigned char login_id[64];
unsigned char password[64];
for (int i = 0; i < 64; i++) {
login_id[i] = 0;
password[i] = 0;
}
if (netinfoptr->flag & DIAL_PULSE)
net_info.DialTone = 1;
else
net_info.DialTone = 0;
348: ntInfGetLoginId(ISP_NUM, login_id);
349: ntInfGetLoginPasswd(ISP_NUM, password);
// strcpy(net_info.LoginName, (char*)ispinfoptr->loginId);
// strcpy(net_info.PassWord, (char*)ispinfoptr->loginPasswd);
strcpy(net_info.LoginName, (char*)login_id);
strcpy(net_info.PassWord, (char*)password);
char buf1[64],buf2[64];
ntInfUSGetPhoneNumber((char*)net_info.TelPhone, buf1, buf2);
retval = TRUE;
CheckNetInfUSData(&netinfous);
strcpy( base_phone_info.outLine, (char*)netinfous.outLine );
strcpy( base_phone_info.callWait, (char*)netinfous.callWait );
strcpy( base_phone_info.areaCode, (char*)netinfous.areaCode );
strcpy( base_phone_info.longDst, (char*)netinfous.longDst );
strcpy( base_phone_info.number, (char*)ispinfoptr->accessPointNumber[0] );
}
}
}
ntInfExit();
return retval;
}