@@ -125,6 +125,7 @@ void GameActivity::Clear()
125
125
m_GameOverPeriod = 5000 ;
126
126
m_WinnerTeam = -1 ;
127
127
m_pOrbitedCraft = 0 ;
128
+ m_pPieMenuActor = 0 ;
128
129
m_DemoTimer.Reset ();
129
130
m_PausedDemoTime = 0 ;
130
131
}
@@ -710,7 +711,23 @@ bool GameActivity::CreateDelivery(int player, int mode, Vector &waypoint, Actor
710
711
nativeCostMult = pMetaPlayer->GetNativeCostMultiplier ();
711
712
}
712
713
// Start with counting the craft
713
- float totalCost = pDeliveryCraft->GetGoldValue (nativeModule, foreignCostMult, nativeCostMult);
714
+ float totalCost = 0 ;
715
+
716
+ if (m_pBuyGUI[player]->GetOnlyShowOwnedItems ())
717
+ {
718
+ if (!m_pBuyGUI[player]->CommitPurchase (pDeliveryCraft->GetModuleAndPresetName ()))
719
+ {
720
+ if (m_pBuyGUI[player]->IsAlwaysAllowedItem (pDeliveryCraft->GetModuleAndPresetName ()))
721
+ totalCost = pDeliveryCraft->GetGoldValue (nativeModule, foreignCostMult, nativeCostMult);
722
+ else
723
+ return false ;
724
+ }
725
+ }
726
+ else
727
+ {
728
+ if (!m_pBuyGUI[player]->CommitPurchase (pDeliveryCraft->GetModuleAndPresetName ()))
729
+ totalCost = pDeliveryCraft->GetGoldValue (nativeModule, foreignCostMult, nativeCostMult);
730
+ }
714
731
715
732
// Go through the list of things ordered, and give any actors all the items that is present after them,
716
733
// until the next actor. Also, the first actor gets all stuff in the list above him.
@@ -734,53 +751,73 @@ bool GameActivity::CreateDelivery(int player, int mode, Vector &waypoint, Actor
734
751
crabCount = -1 ;
735
752
}
736
753
754
+ bool purchaseItem = true ;
755
+
737
756
// Add to the total cost tally
738
- totalCost += (*itr)->GetGoldValue (nativeModule, foreignCostMult, nativeCostMult);
739
- // Make copy of the preset instance in the list
740
- pInventoryObject = dynamic_cast <MovableObject *>((*itr)->Clone ());
741
- // See if it's actually a passenger, as opposed to a regular item
742
- pPassenger = dynamic_cast <Actor *>(pInventoryObject);
743
- // If it's an actor, then set its team and add it to the Craft's inventory!
744
- if (pPassenger)
745
- {
746
- // If this is the first passenger, then give him all the shit found in the list before him
747
- if (!pLastPassenger)
748
- {
749
- for (list<MovableObject *>::iterator iItr = cargoItems.begin (); iItr != cargoItems.end (); ++iItr)
750
- pPassenger->AddInventoryItem (*iItr);
751
- }
752
- // This isn't the first passenger, so give the previous guy all the stuff that was found since processing him
753
- else
754
- {
755
- for (list<MovableObject *>::iterator iItr = cargoItems.begin (); iItr != cargoItems.end (); ++iItr)
756
- pLastPassenger->AddInventoryItem (*iItr);
757
- }
758
- // Clear out the temporary cargo list since we've assign all the stuff in it to a passenger
759
- cargoItems.clear ();
757
+ if (m_pBuyGUI[player]->GetOnlyShowOwnedItems ())
758
+ {
759
+ if (!m_pBuyGUI[player]->CommitPurchase ((*itr)->GetModuleAndPresetName ()))
760
+ {
761
+ if (m_pBuyGUI[player]->IsAlwaysAllowedItem ((*itr)->GetModuleAndPresetName ()))
762
+ totalCost += (*itr)->GetGoldValue (nativeModule, foreignCostMult, nativeCostMult);
763
+ else
764
+ purchaseItem = false ;
765
+ }
766
+ }
767
+ else
768
+ {
769
+ if (!m_pBuyGUI[player]->CommitPurchase ((*itr)->GetModuleAndPresetName ()))
770
+ totalCost += (*itr)->GetGoldValue (nativeModule, foreignCostMult, nativeCostMult);
771
+ }
760
772
761
- // Now set the current passenger as the 'last passenger' so he'll eventually get everything found after him.
762
- pLastPassenger = pPassenger;
763
- // Set the team etc for the current passenger and stuff him into the craft
764
- pPassenger->SetTeam (team);
765
- pPassenger->SetControllerMode (Controller::CIM_AI);
766
- pPassenger->SetAIMode ((Actor::AIMode)mode);
773
+ if (purchaseItem)
774
+ {
775
+ // Make copy of the preset instance in the list
776
+ pInventoryObject = dynamic_cast <MovableObject *>((*itr)->Clone ());
777
+ // See if it's actually a passenger, as opposed to a regular item
778
+ pPassenger = dynamic_cast <Actor *>(pInventoryObject);
779
+ // If it's an actor, then set its team and add it to the Craft's inventory!
780
+ if (pPassenger)
781
+ {
782
+ // If this is the first passenger, then give him all the shit found in the list before him
783
+ if (!pLastPassenger)
784
+ {
785
+ for (list<MovableObject *>::iterator iItr = cargoItems.begin (); iItr != cargoItems.end (); ++iItr)
786
+ pPassenger->AddInventoryItem (*iItr);
787
+ }
788
+ // This isn't the first passenger, so give the previous guy all the stuff that was found since processing him
789
+ else
790
+ {
791
+ for (list<MovableObject *>::iterator iItr = cargoItems.begin (); iItr != cargoItems.end (); ++iItr)
792
+ pLastPassenger->AddInventoryItem (*iItr);
793
+ }
794
+ // Clear out the temporary cargo list since we've assign all the stuff in it to a passenger
795
+ cargoItems.clear ();
767
796
768
- if (pTargetMO != NULL )
769
- {
770
- Actor * pTarget = dynamic_cast <Actor *>(pTargetMO);
771
- if (pTarget)
772
- pPassenger->AddAIMOWaypoint (pTarget);
773
- }
774
- else if (waypoint.m_X > 0 && waypoint.m_Y > 0 )
775
- {
776
- pPassenger->AddAISceneWaypoint (waypoint);
777
- }
797
+ // Now set the current passenger as the 'last passenger' so he'll eventually get everything found after him.
798
+ pLastPassenger = pPassenger;
799
+ // Set the team etc for the current passenger and stuff him into the craft
800
+ pPassenger->SetTeam (team);
801
+ pPassenger->SetControllerMode (Controller::CIM_AI);
802
+ pPassenger->SetAIMode ((Actor::AIMode)mode);
778
803
779
- pDeliveryCraft->AddInventoryItem (pPassenger);
780
- }
781
- // If not, then add it to the temp list of items which will be added to the last passenger's inventory
782
- else
783
- cargoItems.push_back (pInventoryObject);
804
+ if (pTargetMO != NULL )
805
+ {
806
+ Actor * pTarget = dynamic_cast <Actor *>(pTargetMO);
807
+ if (pTarget)
808
+ pPassenger->AddAIMOWaypoint (pTarget);
809
+ }
810
+ else if (waypoint.m_X > 0 && waypoint.m_Y > 0 )
811
+ {
812
+ pPassenger->AddAISceneWaypoint (waypoint);
813
+ }
814
+
815
+ pDeliveryCraft->AddInventoryItem (pPassenger);
816
+ }
817
+ // If not, then add it to the temp list of items which will be added to the last passenger's inventory
818
+ else
819
+ cargoItems.push_back (pInventoryObject);
820
+ }
784
821
}
785
822
786
823
if (crabCount == 500 )
@@ -1936,7 +1973,15 @@ void GameActivity::Update()
1936
1973
// PieMenuGUI::Slice ceaseFireSlice("Propose Cease Fire", PieMenuGUI::PSI_CEASEFIRE, PieMenuGUI::Slice::RIGHT, false);
1937
1974
// m_pPieMenu[player]->AddSlice(ceaseFireSlice, true);
1938
1975
}
1939
- // Init the new slice positions and sizes
1976
+
1977
+ // Init the new slice positions and sizes, build the list of slices in menu
1978
+ m_pPieMenu[player]->RealignSlices ();
1979
+ m_CurrentPieMenuPlayer = player;
1980
+ m_CurrentPieMenuSlices = GetCurrentPieMenuSlices (player);
1981
+
1982
+ OnPieMenu (m_pControlledActor[player]);
1983
+
1984
+ // Realigns slices after possible external pie-menu changes
1940
1985
m_pPieMenu[player]->RealignSlices ();
1941
1986
// Enable the pie menu
1942
1987
m_pPieMenu[player]->SetEnabled (true );
0 commit comments