PushMission's 'bAppend'

bane_

Howardianism High-Priest
Joined
Nov 27, 2013
Messages
1,559
I was under the impression that bAppend was used to put the mission in the END of the queue, but these apparently aren't working as intended:

Code:
if bThisTurn then
	pUnit:PushMission(MissionTypes.MISSION_BUILD, buildType, -1, 0, [B][COLOR="SeaGreen"]true[/COLOR][/B], 1, MissionAITypes.MISSIONAI_BUILD, pPlot, pUnit)
else
	pUnit:PushMission(MissionTypes.MISSION_BUILD, buildType, -1, 0, [B][COLOR="Red"]false[/COLOR][/B], 1, MissionAITypes.MISSIONAI_BUILD, pPlot, pUnit)
end

This is part of the Lua code I have to instruct the AI on when to build the Civ's UI, but from what I am seeing, it apparently isn't completing the 'move' and starts (unsuccessfully) to build the UI on the spot.

The full function (which is only part of another function) is here:
Spoiler :
Code:
function LookForSuitableGardens(iUnit, pPlot, bThisTurn)
	local iPlotOwner = pPlot:GetOwner()
	local pUnit = Players[iCraneClan]:GetUnitByID(iUnit)
	for idX = -2, 2, 1 do
		for idY = -2, 2, 1 do
			local pTargetPlot = Map.PlotXYWithRangeCheck(pPlot:GetX(), pPlot:GetY(), idX, idY, 2)
			if pTargetPlot and pTargetPlot:GetOwner() == iPlotOwner and pTargetPlot:CanHaveImprovement(GameInfoTypes["IMPROVEMENT_FANTASTIC_GARDENS"], NO_TEAM) then
				local buildType = GameInfoTypes["BUILD_FANTASTIC_GARDENS"]
				[B]if bThisTurn then
					pUnit:PushMission(MissionTypes.MISSION_BUILD, buildType, -1, 0, true, 1, MissionAITypes.MISSIONAI_BUILD, pPlot, pUnit)
				else
					pUnit:PushMission(MissionTypes.MISSION_BUILD, buildType, -1, 0, false, 1, MissionAITypes.MISSIONAI_BUILD, pPlot, pUnit)
				end[/B]
				return
			end
		end
	end
end

Is this something to do with bManual? I have no idea what it does (or why it is always an integer instead of a boolean in every example I got on the Internet).

I'm a rookie with C++, so I may have misunderstood that line of code, or even reading barely related or unused stuff.


(I use bAppend as the third variable in the function, but changed to bThisTurn here to avoid confusion with the method's argument)
 
The C++ code is expecting ints, so 0 and 1 not false and true
 
Top Bottom