IsoRTS icon indicating copy to clipboard operation
IsoRTS copied to clipboard

Two potential issues

Open Ruckamongus opened this issue 5 years ago • 1 comments

In "randomMapGenerator.cpp" the while loop on line 120 might never break if the return statement condition is never met I think?

	bool foodFound = false;

	while (!foodFound) {
		int possibleFood = roll(0, static_cast<int>(listOfObjects.size()));
		if (listOfObjects[possibleFood].getTypeOfResource() == 1) {
			bool foodSourceOccupied = false;
			for (const int& foodOwned : occupiedFoodSources)
			{
				if (foodOwned == possibleFood) {
					foodSourceOccupied = true;
				}
			}
			if (!foodSourceOccupied) {
				return  listOfObjects[possibleFood].getLocation();
			}
		}
	}

In "main.cpp" line 111 I think this is meant to be a comparison and not assignment operator? if (endProjectile = listOfProjectiles.size()) { ... }

Ruckamongus avatar Aug 04 '21 21:08 Ruckamongus

adressed the first issue in: https://github.com/switchboy/IsoRTS/commit/69aeb535b1ee0289ea9f3e5c8315cdd6339202c9

The second one in: https://github.com/switchboy/IsoRTS/commit/d3d6f4b9f7543eb6316de9f34d40d7d2ed61d8fe

switchboy avatar Aug 05 '21 09:08 switchboy