fix missing parenthesis around logic

This commit is contained in:
Chris Cromer 2019-05-01 20:31:24 -04:00
parent 8bef23d24f
commit 42c5576595
Signed by: cromer
GPG Key ID: 39CC813FF3C8708A
2 changed files with 14 additions and 14 deletions

View File

@ -662,7 +662,7 @@ int Logic::decode(int ResNum)
else if(CurByte <= NumAGICommands){
ThisCommand = CurByte;
ThisLine = MultStr(" ",BlockDepth);
if (game->show_special_syntax && (ThisCommand>=0x01 && ThisCommand<=0x0B)||(ThisCommand>=0xA5&&ThisCommand<=0xA8))AddSpecialSyntaxCommand();
if (game->show_special_syntax && ((ThisCommand>=0x01 && ThisCommand<=0x0B)||(ThisCommand>=0xA5&&ThisCommand<=0xA8)))AddSpecialSyntaxCommand();
else{
ThisLine+=(string(AGICommand[ThisCommand].Name) + "(");
ArgsStart = ThisLine.length();

View File

@ -1,9 +1,9 @@
/*
* QT AGI Studio :: Copyright (C) 2000 Helen Zommer
*
* Almost all of this code was adapted from the Windows AGI Studio
* Almost all of this code was adapted from the Windows AGI Studio
* developed by Peter Kelly.
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
@ -55,7 +55,7 @@ bool ObjList::GetItems()
do{
lsbyte = ResourceData.Data[3+CurrentItem*3];
msbyte = ResourceData.Data[3+CurrentItem*3+1];
ThisNameStart = (msbyte<<8)|lsbyte + 3;
ThisNameStart = (msbyte<<8)| (lsbyte + 3);
RoomNum[CurrentItem] = ResourceData.Data[3+CurrentItem*3+2];
NamePos = ThisNameStart;
if (NamePos > ResourceData.Size)return false; //object name past end of file
@ -90,7 +90,7 @@ int ObjList::read(char *filename,bool FileIsEncrypted)
menu->errmes("Error opening file %s",filename);
return 1;
}
struct stat buf;
fstat(fileno(fptr),&buf);
int size=buf.st_size;
@ -102,11 +102,11 @@ int ObjList::read(char *filename,bool FileIsEncrypted)
ItemNames.lfree();
ResourceData.Size = size;
fread( ResourceData.Data, ResourceData.Size, 1, fptr);
fclose(fptr);
fclose(fptr);
if (FileIsEncrypted) {
XORData();
}
if(!GetItems()){
if(!GetItems()){
XORData();
FileIsEncrypted = !FileIsEncrypted;
if(!GetItems()){
@ -116,10 +116,10 @@ int ObjList::read(char *filename,bool FileIsEncrypted)
}
if (ItemNames.num == 0){
menu->errmes("Error! 0 objects in file.");
return 1;
return 1;
}
return 0;
return 0;
}
//********************************************
@ -130,13 +130,13 @@ int ObjList::save(char *filename,bool FileIsEncrypted)
int CurrentItem,CurrentChar;
FILE *fptr;
ResourceData.Size = ItemNames.num*3 + 5;
ResourceData.Size = ItemNames.num*3 + 5;
//3 bytes for each index entry, 3 bytes for header, 2 for '?' object
for (CurrentItem = 1;CurrentItem<=ItemNames.num;CurrentItem++){
if(ItemNames.at(CurrentItem-1) != "?")
ResourceData.Size+=ItemNames.at(CurrentItem-1).length()+1;
}
//create data
ItemNamesStart = ItemNames.num*3 + 3;
msbyte = (ItemNamesStart-3) / 256;
@ -150,12 +150,12 @@ int ObjList::save(char *filename,bool FileIsEncrypted)
ResourceData.Data[ItemNamesStart] = '?';
ResourceData.Data[ItemNamesStart + 1] = 0;
ObjectFilePos = ItemNamesStart + 2;
for (CurrentItem = 1;CurrentItem<=ItemNames.num;CurrentItem++){
for (CurrentItem = 1;CurrentItem<=ItemNames.num;CurrentItem++){
if (ItemNames.at(CurrentItem-1) == "?"){
ResourceData.Data[CurrentItem*3] = ResourceData.Data[0];
ResourceData.Data[CurrentItem*3+1] = ResourceData.Data[1];
ResourceData.Data[CurrentItem*3+2] = RoomNum[CurrentItem-1];
}
}
else{
msbyte = (ObjectFilePos-3) / 256;
lsbyte = (ObjectFilePos-3) % 256;
@ -175,7 +175,7 @@ int ObjList::save(char *filename,bool FileIsEncrypted)
menu->errmes("Error opening file %s !",filename);
return 1;
}
if(FileIsEncrypted)XORData();
if(FileIsEncrypted)XORData();
fwrite(ResourceData.Data,ResourceData.Size,1,fptr);
fclose(fptr);