public static SmartEntity FindLeastFullStarport() { float num = 0f; int num2 = 0; SmartEntity smartEntity = null; NodeList <StarportNode> starportNodeList = Service.BuildingLookupController.StarportNodeList; for (StarportNode starportNode = starportNodeList.Head; starportNode != null; starportNode = starportNode.Next) { BuildingComponent buildingComp = starportNode.BuildingComp; SmartEntity smartEntity2 = (SmartEntity)buildingComp.Entity; if (!ContractUtils.IsBuildingConstructing(smartEntity2)) { int starportFillSize = StorageSpreadUtils.GetStarportFillSize(smartEntity2); int storage = buildingComp.BuildingType.Storage; if (smartEntity == null || (float)starportFillSize < num || ((float)starportFillSize == num && storage < num2)) { num = (float)starportFillSize; num2 = storage; smartEntity = smartEntity2; } } } return(smartEntity); }
public static void AddTroopToStarportReserve(SmartEntity starport, TroopTypeVO troop) { if (starport != null) { int num = StorageSpreadUtils.GetStarportFillSize(starport); num += troop.Size; StorageSpreadUtils.SetStarportFillSize(starport, num); } }
public unsafe static long $Invoke8(long instance, long *args) { return(GCHandledObjects.ObjectToGCHandle(StorageSpreadUtils.GetStarportFillSize((Entity)GCHandledObjects.GCHandleToObject(*args)))); }