Skip to content
Snippets Groups Projects
Commit 35f27941 authored by deuce's avatar deuce
Browse files

Start killing _INT16 usage... fixes bugs with file_copy() and file_append().

parent f7bbb484
No related branches found
No related tags found
No related merge requests found
......@@ -59,8 +59,8 @@ extern struct clan *PClan;
void RemoveFromAlliance(struct Alliance *Alliance)
{
_INT16 iTemp;
_INT16 WhichMember = 0, ClanID[2];
int iTemp, WhichMember = 0;
_INT16 ClanID[2];
char szName[40], /*cKey,*/ szString[128];
struct clan *TmpClan;
......@@ -127,8 +127,8 @@ void RemoveFromAlliance(struct Alliance *Alliance)
void SeeMemberStats(struct Alliance *Alliance)
{
/* char szName[30];*/
_INT16 ClanID[2], iTemp;
_INT16 ClanID[2];
int iTemp;
struct clan *TmpClan;
// ask for member name
......@@ -161,9 +161,9 @@ void SeeMemberStats(struct Alliance *Alliance)
void ShowAllianceItems(struct Alliance *Alliance)
{
_INT16 iTemp, iTemp2, Length, LastItem = 0, FoundItem = FALSE;
_INT16 CurItem;
char szString[100];
int iTemp, iTemp2, Length, LastItem = 0, FoundItem = FALSE;
int CurItem;
char szString[100];
rputs("|0B # Name ");
rputs("|0B # Name \n");
......@@ -212,9 +212,9 @@ void ShowAllianceItems(struct Alliance *Alliance)
void DonationRoom(struct Alliance *Alliance)
{
/* modify item stats, assume it's the player */
_INT16 ItemIndex, /*OneItemFound,*/ RoomItemIndex, EmptySlot;
_INT16 DefaultItemIndex, iTemp/*, WhoEquip*/;
char /*szKeys[10],*/ szString[100]/*, szTemp[60]*/;
int ItemIndex, RoomItemIndex, EmptySlot;
int DefaultItemIndex, iTemp;
char szString[100];
/* options available
......@@ -272,7 +272,7 @@ void DonationRoom(struct Alliance *Alliance)
else
DefaultItemIndex = iTemp+1;
ItemIndex = (_INT16) GetLong(ST_ISTATS3, DefaultItemIndex, MAX_ALLIANCEITEMS);
ItemIndex = GetLong(ST_ISTATS3, DefaultItemIndex, MAX_ALLIANCEITEMS);
if (ItemIndex == 0)
break;
ItemIndex--;
......@@ -315,7 +315,7 @@ void DonationRoom(struct Alliance *Alliance)
DefaultItemIndex = iTemp+1;
ItemIndex = (_INT16) GetLong(ST_ISTATS7, DefaultItemIndex, MAX_ITEMS_HELD);
ItemIndex = GetLong(ST_ISTATS7, DefaultItemIndex, MAX_ITEMS_HELD);
if (ItemIndex == 0)
break;
ItemIndex--;
......@@ -365,8 +365,8 @@ void DonationRoom(struct Alliance *Alliance)
else
DefaultItemIndex = iTemp+1;
ItemIndex = (_INT16) GetLong("Which item to destroy? (0=abort)",
DefaultItemIndex, MAX_ALLIANCEITEMS);
ItemIndex = GetLong("Which item to destroy? (0=abort)",
DefaultItemIndex, MAX_ALLIANCEITEMS);
if (ItemIndex == 0)
break;
ItemIndex--;
......@@ -422,8 +422,8 @@ void DonationRoom(struct Alliance *Alliance)
else
DefaultItemIndex = iTemp+1;
ItemIndex = (_INT16) GetLong("|0STake which item from the room? (0=abort)",
DefaultItemIndex, MAX_ALLIANCEITEMS);
ItemIndex = GetLong("|0STake which item from the room? (0=abort)",
DefaultItemIndex, MAX_ALLIANCEITEMS);
if (ItemIndex == 0)
break;
ItemIndex--;
......@@ -451,8 +451,8 @@ void DonationRoom(struct Alliance *Alliance)
void GetAlliances(struct Alliance *Alliances[MAX_ALLIANCES])
{
FILE *fp;
_INT16 iTemp;
FILE *fp;
int iTemp;
// init alliances as NULLs
for (iTemp = 0; iTemp < MAX_ALLIANCES; iTemp++)
......@@ -479,7 +479,7 @@ void GetAlliances(struct Alliance *Alliances[MAX_ALLIANCES])
void UpdateAlliances(struct Alliance *Alliances[MAX_ALLIANCES])
{
FILE *fp;
_INT16 iTemp;
int iTemp;
fp = fopen("ally.dat", "wb");
if (fp) {
......@@ -495,7 +495,7 @@ void UpdateAlliances(struct Alliance *Alliances[MAX_ALLIANCES])
void CreateAlliance(struct Alliance *Alliance, struct Alliance *Alliances[MAX_ALLIANCES])
{
_INT16 iTemp;
int iTemp;
char szName[30], szString[128];
BOOL AllianceNameInUse;
......@@ -573,7 +573,7 @@ void CreateAlliance(struct Alliance *Alliance, struct Alliance *Alliances[MAX_AL
void ShowAlliances(struct clan *Clan)
{
_INT16 iTemp, NumAlliances = 0, CurAlliance;
int iTemp, NumAlliances = 0, CurAlliance;
char /*szName[25],*/ szString[50];
struct Alliance *Alliances[MAX_ALLIANCES];
......@@ -615,7 +615,7 @@ BOOL EnterAlliance(struct Alliance *Alliance)
{
char *szTheOptions[13], *szString, szName[25];
char szFileName[13];
_INT16 iTemp;
int iTemp;
// show stats
......@@ -730,8 +730,7 @@ BOOL EnterAlliance(struct Alliance *Alliance)
}
}
void KillAlliance(_INT16 AllianceID)
void KillAlliance(int AllianceID)
{
// go through player file
// skip user online
......@@ -740,7 +739,7 @@ void KillAlliance(_INT16 AllianceID)
struct clan *TmpClan;
FILE *fpPlayerFile;
_INT16 CurClan, CurAlliance;
int CurClan, CurAlliance;
long Offset;
TmpClan = malloc(sizeof(struct clan));
......@@ -795,7 +794,7 @@ void KillAlliance(_INT16 AllianceID)
void Alliance_Maint(void)
{
struct Alliance *Alliances[MAX_ALLIANCES];
_INT16 iTemp;
int iTemp;
GetAlliances(Alliances);
......@@ -819,9 +818,9 @@ void Alliance_Maint(void)
}
void FormAlliance(_INT16 AllyID)
void FormAlliance(int AllyID)
{
_INT16 iTemp, UserAllianceSlot, WhichAlliance;
int iTemp, UserAllianceSlot, WhichAlliance;
struct Alliance *Alliances[MAX_ALLIANCES];
// see if this guy can ally any more
......
......@@ -4,7 +4,7 @@ void UpdateAlliances(struct Alliance *Alliances[MAX_ALLIANCES]);
void CreateAlliance(struct Alliance *Alliance, struct Alliance *Alliances[MAX_ALLIANCES]);
void ShowAlliances(struct clan *Clan);
BOOL EnterAlliance(struct Alliance *Alliance);
void KillAlliance(_INT16 AllianceID);
void KillAlliance(int AllianceID);
void Alliance_Maint(void);
void FormAlliance(_INT16 AllyID);
void FormAlliance(int AllyID);
......@@ -47,12 +47,12 @@ void DisplayStr(char *);
void ClansIni_Init(void)
{
/* read in quests file and allocate memory for quest names */
_INT16 iTemp;
int iTemp;
FILE *fp;
char szLine[128], *pcCurrentPos;
char szToken[MAX_TOKEN_CHARS + 1];
_INT16 iKeyWord;
_INT16 CurNPCFile, CurItemFile, CurRaceFile, CurClassFile, CurSpellFile;
int iKeyWord;
int CurNPCFile, CurItemFile, CurRaceFile, CurClassFile, CurSpellFile;
if (Verbose) {
DisplayStr("> ClansIni_Init()\n");
......@@ -192,7 +192,7 @@ void ClansIni_Init(void)
void ClansIni_Close(void)
{
_INT16 iTemp;
int iTemp;
if (IniFile.Initialized == FALSE) return;
......
......@@ -54,7 +54,8 @@ void Load_PClasses(struct PClass *PClass[MAX_PCLASSES], __BOOL GetPClasses)
* PRE: GetPClasses = TRUE if we're get classes, FALSE if getting races.
*/
{
_INT16 iTemp, NumClasses, CurFile, CurClass = 0, MaxFiles;
int iTemp, CurFile, CurClass = 0, MaxFiles;
_INT16 NumClasses;
struct FileHeader ClassFile;
if (GetPClasses)
......@@ -80,7 +81,7 @@ void Load_PClasses(struct PClass *PClass[MAX_PCLASSES], __BOOL GetPClasses)
// read in data
/* get num classes */
fread(&NumClasses, sizeof(_INT16), 1, ClassFile.fp);
fread(&NumClasses, sizeof(NumClasses), 1, ClassFile.fp);
/* read them in */
for (iTemp = 0; iTemp < NumClasses; iTemp++) {
......@@ -105,7 +106,7 @@ void Free_PClasses(struct PClass *PClass[MAX_PCLASSES])
* This function will free the classes loaded by Load_PClasses
*/
{
_INT16 iTemp;
int iTemp;
for (iTemp = 0; iTemp < MAX_PCLASSES; iTemp++) {
if (PClass[iTemp]) {
......
......@@ -4,7 +4,7 @@
#include "defines.h"
long CRCValue(void *Data, _INT16 DataSize)
long CRCValue(void *Data, int DataSize)
{
char *p;
long CRC = 0;
......@@ -19,7 +19,7 @@ long CRCValue(void *Data, _INT16 DataSize)
return CRC;
}
_INT16 CheckCRC(void *Data, _INT16 Size, long CRC)
int CheckCRC(void *Data, int Size, long CRC)
{
return (CRCValue(Data, Size) == CRC);
}
long CRCValue(void *Data, _INT16 DataSize);
long CRCValue(void *Data, int DataSize);
_INT16 CheckCRC(void *Data, _INT16 Size, long CRC);
int CheckCRC(void *Data, int Size, long CRC);
......@@ -70,7 +70,7 @@ extern struct Language *Language;
extern struct clan *PClan;
extern char Spells_szCastDestination[25];
extern char Spells_szCastSource[25];
extern _INT16 Spells_CastValue;
extern int Spells_CastValue;
extern struct village Village;
extern struct game Game;
extern BOOL Verbose;
......
......@@ -47,7 +47,7 @@ extern struct village Village;
char Spells_szCastDestination[25];
char Spells_szCastSource[25];
_INT16 Spells_CastValue;
int Spells_CastValue;
extern BOOL Verbose;
......
......@@ -28,10 +28,10 @@
#include <sys/stat.h>
#include "snipfile.h"
_INT16 file_append(char *from, char *to)
int file_append(char *from, char *to)
{
_INT16 fdfrom,fdto;
_INT16 bufsiz;
int fdfrom,fdto;
int bufsiz;
fdfrom = open(from,O_RDONLY|O_BINARY,0);
if (fdfrom < 0)
......@@ -55,7 +55,7 @@ _INT16 file_append(char *from, char *to)
buffer = (char *) malloc(bufsiz);
if (buffer) {
while (1) {
register _INT16 n;
register int n;
n = read(fdfrom,buffer,bufsiz);
if (n == -1) /* if error */
......@@ -80,10 +80,10 @@ err:
return 1;
}
_INT16 file_copy(char *from, char *to)
int file_copy(char *from, char *to)
{
_INT16 fdfrom,fdto;
_INT16 bufsiz;
int fdfrom,fdto;
int bufsiz;
fdfrom = open(from,O_RDONLY|O_BINARY,0);
if (fdfrom < 0)
......@@ -107,7 +107,7 @@ _INT16 file_copy(char *from, char *to)
buffer = (char *) malloc(bufsiz);
if (buffer) {
while (1) {
register _INT16 n;
register int n;
n = read(fdfrom,buffer,bufsiz);
if (n == -1) /* if error */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment