Improved Build Queue Mod

EmperorFool

Deity
Joined
Mar 2, 2007
Messages
9,633
Location
Mountain View, California
I merged in the queue-handling portion of this mod since it was fairly simple. I made a few alterations along the way:

  • Works in the city screen and map view.
  • Closes once the queue is full (six items).
  • Click to append. CTRL-Click to insert. ALT-Click to replace the whole queue.
  • Removed the "Show Queue" checkbox entirely.
I have not merged in the queue saving/restoring part as I haven't looked in to how you handle saving custom data.

Code:
diff -rupN v131/CiVUP - Civ V Unofficial Patch/Core/Misc UI/CityView.lua installed/CiVUP - Civ V Unofficial Patch/Core/Misc UI/CityView.lua
--- v131/CiVUP - Civ V Unofficial Patch/Core/Misc UI/CityView.lua	2012-02-19 13:21:50.206993600 -0800
+++ installed/CiVUP - Civ V Unofficial Patch/Core/Misc UI/CityView.lua	2012-02-20 17:40:39.860036300 -0800
@@ -243,7 +243,7 @@ local wonderHeadingOpen = true;
 local specialistBuildingHeadingOpen = true;
 local marketplaceBuildingHeadingOpen = true;
 local buildingHeadingOpen = true;
-local productionQueueOpen = false;
+local productionQueueOpen = true;
 
 function OnSlackersSelected()
 	local pCity = UI.GetHeadSelectedCity();
@@ -804,16 +804,6 @@ function OnCityViewUpdate()
 
 		--Update suffix to use correct plurality.
 		Controls.CityPopulationLabelSuffix:LocalizeAndSetText("TXT_KEY_CITYVIEW_CITIZENS_TEXT", cityPopulation);
-
-		-------------------------------------------
-		-- Deal with the production queue buttons
-		-------------------------------------------
-		local qLength = pCity:GetOrderQueueLength();
-		if qLength > 0 then
-			Controls.HideQueueButton:SetHide( false );
-		else
-			Controls.HideQueueButton:SetHide( true );
-		end
 		
 		-- hide the queue buttons
 		Controls.b1number:SetHide( true );
@@ -830,6 +820,7 @@ function OnCityViewUpdate()
 		Controls.ProductionPortraitButton:SetHide( false );
 		
 		local panelSize = Controls.ProdQueueBackground:GetSize();
+		local qLength = pCity:GetOrderQueueLength();
 		if productionQueueOpen and qLength > 0 then
 			panelSize.y = 470;
 			Controls.ProductionButtonLabel:SetText( Locale.ConvertTextKey( "TXT_KEY_CITYVIEW_QUEUE_PROD") );
@@ -2514,15 +2505,6 @@ Controls.ProductionPortraitButton:Regist
 
 
 ----------------------------------------------------------------
-----------------------------------------------------------------
-function OnHideQueue( bIsChecked )
-	productionQueueOpen = bIsChecked;
-	OnCityViewUpdate();
-end
-Controls.HideQueueButton:RegisterCheckHandler( OnHideQueue );
-
-
-----------------------------------------------------------------
 ----------------------------------------------------------------
 
 function FocusChanged( focus )
diff -rupN v131/CiVUP - Civ V Unofficial Patch/Core/Misc UI/CityView.xml installed/CiVUP - Civ V Unofficial Patch/Core/Misc UI/CityView.xml
--- v131/CiVUP - Civ V Unofficial Patch/Core/Misc UI/CityView.xml	2012-02-19 13:21:50.207993700 -0800
+++ installed/CiVUP - Civ V Unofficial Patch/Core/Misc UI/CityView.xml	2012-02-20 17:39:19.711452100 -0800
@@ -179,10 +179,6 @@
                 <Label Anchor="C,C" Offset="0,0" String="TXT_KEY_CITYVIEW_QUEUE_PROD" ColorSet="Beige_Black_Alpha" Font="TwCenMT18" FontStyle="Shadow" ID="ProductionButtonLabel"/>
             </GridButton>
         </Stack>
-        <!-- Queue Button -->
-
-        <Image Anchor="L,B"  Offset="40,76" TextureOffset="30.0" Texture="bar500x2.dds" Size="440.1" Color="White.128" Hidden="0"/>
-        <CheckBox Style="SquareCheck" Anchor="R,B" Offset="44,44" TextAnchor="L,C" Font="TwCenMT18" String="TXT_KEY_CITYVIEW_QUEUE_O" IsChecked="0" ToolTip="TXT_KEY_CITYVIEW_QUEUE_O_TT" ID="HideQueueButton"/>
     </Grid>
 
     <Image Anchor="R,B" Offset="0,28" Texture="assets\UI\Art\WorldView\citytrimright.dds" Size="141.78" Hidden="0"/>
diff -rupN v131/CiVUP - Civ V Unofficial Patch/Core/Misc UI/CityView_small.xml installed/CiVUP - Civ V Unofficial Patch/Core/Misc UI/CityView_small.xml
--- v131/CiVUP - Civ V Unofficial Patch/Core/Misc UI/CityView_small.xml	2012-02-19 13:21:50.208993800 -0800
+++ installed/CiVUP - Civ V Unofficial Patch/Core/Misc UI/CityView_small.xml	2012-02-20 17:38:56.136103600 -0800
@@ -181,9 +181,6 @@
                 <Button Anchor="R,B" Size="18,18" Offset="0.2" TextureOffset="0,0" Texture="assets\UI\Art\Controls\9 Grids\NewX.dds"  ToolTip="TXT_KEY_CITYVIEW_Q_X_TEXT" ID="b6remove"/>
             </Box>
         </Stack>
-        <!-- Queue Button -->
-        <!--<Box Anchor="L,B" Color="27.53.64.255" Offset="20,74" Size="362,1"/>-->
-        <CheckBox Style="SquareCheck" Anchor="R,B" Offset="44,44" TextAnchor="L,C" Font="TwCenMT18" String="TXT_KEY_CITYVIEW_QUEUE_O" IsChecked="0" ToolTip="TXT_KEY_CITYVIEW_QUEUE_O_TT" ID="HideQueueButton"/>
     </Grid>
     <!-- BUILDINGS -->
 	<Instance Name="BuildingInstance">
diff -rupN v131/CiVUP - Civ V Unofficial Patch/Core/Misc UI/ProductionPopup.lua installed/CiVUP - Civ V Unofficial Patch/Core/Misc UI/ProductionPopup.lua
--- v131/CiVUP - Civ V Unofficial Patch/Core/Misc UI/ProductionPopup.lua	2012-02-19 13:21:50.216994200 -0800
+++ installed/CiVUP - Civ V Unofficial Patch/Core/Misc UI/ProductionPopup.lua	2012-02-20 17:18:22.870564900 -0800
@@ -184,10 +184,19 @@ function ProductionSelected( eOrder, iDa
 	
     local city = g_currentCity;
 	local player = Players[city:GetOwner()]
-    
-    if g_IsProductionMode then
-		Game.CityPushOrder(city, eOrder, iData, false, not g_append, true);
-    else
+
+	if g_IsProductionMode then
+		-- no modifier to append; ctrl to insert at front; alt to replace full queue
+		if UIManager:GetAlt() then
+			Game.CityPushOrder(city, eOrder, iData, false, true, false);
+		elseif city:GetOrderQueueLength() < 6 then
+			if UIManager:GetControl() then
+				Game.CityPushOrder(city, eOrder, iData, false, false, false);
+			else
+				Game.CityPushOrder(city, eOrder, iData, false, false, true);
+			end
+		end
+	else
 		local bSomethingPurchased = false;
 		if (eOrder == OrderTypes.ORDER_TRAIN) then
 			Game.CityPurchaseUnit(city, iData);
@@ -222,7 +231,7 @@ function ProductionSelected( eOrder, iDa
     Events.SpecificCityInfoDirty( player, cityID, CityUpdateTypes.CITY_UPDATE_TYPE_BANNER);
     Events.SpecificCityInfoDirty( player, cityID, CityUpdateTypes.CITY_UPDATE_TYPE_PRODUCTION);
  
-	if not g_append or not g_IsProductionMode then 
+	if not g_IsProductionMode or city:GetOrderQueueLength() >= 6 then
 		OnClose();
 	end
 end
@@ -276,7 +285,7 @@ function UpdateWindow( city )
 		return;
     end
    
-	local qMode = g_append and g_IsProductionMode;
+	local qMode = g_IsProductionMode;
  
 	if qMode then
 		local qLength = city:GetOrderQueueLength();
@@ -879,7 +888,7 @@ function UpdateWindow( city )
 		end
 		Controls.ProductionQueueBox:SetHide(false);
 	else
-		Controls.ProductionQueueBox:SetHide(true);
+		Controls.ProductionQueueBox:SetHide(false);
 	end
       
 	Controls.UnitButtonStack:CalculateSize();
 
Just out of curiosity, does this make adding to the queue the default as opposed to the current system in which reselection of current project is?
 
Thanks! If this is all in CityView.lua, could you post the modified file? I haven't changed it in this version. :)

It also required modifying ProductionPopup.xml and a couple XML files. I have been posting patch files so you can apply them all at once with "patch". Would you prefer a ZIP of the files until you get git setup?

Just out of curiosity, does this make adding to the queue the default as opposed to the current system in which reselection of current project is?

Yes, clicking an item appends it to the queue by default. If you want it to clear the queue first, hold down ALT. Hold CTRL to insert the item instead of appending.
 
Click to append. CTRL-Click to insert. ALT-Click to replace the whole queue.

If it isn't already provided, then a tooltip or header in the queue of this would be helpful for newbs until we get used to it.
 
Good idea. I can put it in the same spot where the checkbox used to be.

Hmm, it fits there but isn't visible once you click the ADD TO QUEUE button. I could put it in the hover of the ADD button (same problem) or at the bottom of the list of unit/building attributes in its hover. I don't really like any of those either. The last one makes the most sense for the UI but I'm afraid people won't notice it. And once you do notice it and learn the keys, it's always in the way taking up space.

Any thoughts?
 
Good idea.
.... And once you do notice it and learn the keys, it's always in the way taking up space.

Any thoughts?

It's a dummy building always at the top of the queue.

Or, it's almost a real building, which you click to remove from the queue. Somehow, it doesn't have any attributes and doesn't show in the building list. Ideally, it would be a national wonder, perhaps even if it isn't at the top.
 
Top Bottom