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){ else if(CurByte <= NumAGICommands){
ThisCommand = CurByte; ThisCommand = CurByte;
ThisLine = MultStr(" ",BlockDepth); 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{ else{
ThisLine+=(string(AGICommand[ThisCommand].Name) + "("); ThisLine+=(string(AGICommand[ThisCommand].Name) + "(");
ArgsStart = ThisLine.length(); ArgsStart = ThisLine.length();

View File

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