void CheckExec(char *argv[]) { char *bufptr; strcpy(oldfilename,argv[execargn]); strcpy(newfilename,argv[execargn]); bufptr=(char *)strchr(newfilename,'.'); if(bufptr!=NULL) strset(bufptr,0); if(bind==TRUE) strcat(newfilename,".exe"); else strcat(newfilename,".lc"); if(CheckIfExists(oldfilename)==TRUE) return; bufptr=(char *)strchr(oldfilename,'.'); if(bufptr!=NULL) return; strcat(oldfilename,".exe"); if(CheckIfExists(oldfilename)==TRUE) return; bufptr=(char *)strchr(oldfilename,'.'); if(bufptr!=NULL) strset(bufptr,0); strcat(oldfilename,".le"); if(CheckIfExists(oldfilename)==TRUE) return; bufptr=(char *)strchr(oldfilename,'.'); if(bufptr!=NULL) strset(bufptr,0); strcat(oldfilename,".lx"); if(CheckIfExists(oldfilename)==TRUE) return; strcpy(oldfilename,argv[execargn]); }
SharedPointer<EmitterData> EmitterFactory::GetEmitterData(const std::string& aEmitterName) { if (CheckIfExists(aEmitterName) == true) { return myEmitterData[aEmitterName]; } else { return nullptr; } }
bool M_PathFinding::CreateSideNode(node* nParent, int x, int y, iPoint end, int amount, bool isDiagonal) { bool ret = false; node* newNode = new node; newNode->parent = nParent; newNode->tile.x = x; newNode->tile.y = y; if (isDiagonal && !allowCorners) { if (!mapData.isWalkable(nParent->tile.x, newNode->tile.y) || !mapData.isWalkable(newNode->tile.x, nParent->tile.y)) { delete newNode; return false; } } //Initial cost from the start newNode->g = nParent->g + amount; //Estimated cost to the end using Manhatan Distance newNode->h = (abs(end.x - x) + abs(end.y - y)) * 10; //Result of f + g newNode->f = newNode->g + newNode->h; //Compare if the current node already exists and it is not closed if (!IsNodeClosed(newNode)) { if (!CheckIfExists(newNode)) { if (newNode->f <= lowestFNode->data->f) { newLowest = true; lowestF = newNode->f; lowestFNode = openList.At(openList.find(newNode)); int i = 0; } ret = CheckIfEnd(newNode, end); } else delete newNode; } else delete newNode; return ret; }