Loading

Paste #pidxg1mfb

  1.  
  2. function MainClass::IsTownGrowing() {
  3.     local townList = GSTownList();
  4.     for (local town = townList.Begin(); !townList.IsEnd(); town = townList.Next()) {
  5.         local cargoList = GSCargoList();
  6.         cargoList.Sort(GSList.SORT_BY_ITEM, GSList.SORT_ASCENDING);
  7.         local cargoRequired = GSList();
  8.         for (local cargo_type = cargoList.Begin(); !cargoList.IsEnd(); cargo_type = cargoList.Next()) {
  9.             local town_effect = GSCargo.GetTownEffect(cargo_type);
  10.             local class_name = "";
  11.             for (local cc = 0; cc <= 15; cc++) {
  12.                 local cargo_class = 1 << cc;
  13.                 if (GSCargo.HasCargoClass(cargo_type, cargo_class)) {
  14.                     if (class_name != "") class_name += ", ";
  15.                     switch(cargo_class) {
  16.                         case GSCargo.CC_PASSENGERS: class_name += "CC_PASSENGERS"; break;
  17.                         case GSCargo.CC_MAIL: class_name += "CC_MAIL"; break;
  18.                         case GSCargo.CC_EXPRESS: class_name += "CC_EXPRESS"; break;
  19.                         case GSCargo.CC_ARMOURED: class_name += "CC_ARMOURED"; break;
  20.                         case GSCargo.CC_BULK: class_name += "CC_BULK"; break;
  21.                         case GSCargo.CC_PIECE_GOODS: class_name += "CC_PIECE_GOODS"; break;
  22.                         case GSCargo.CC_LIQUID: class_name += "CC_LIQUID"; break;
  23.                         case GSCargo.CC_REFRIGERATED: class_name += "CC_REFRIGERATED"; break;
  24.                         case GSCargo.CC_HAZARDOUS: class_name += "CC_HAZARDOUS"; break;
  25.                         case GSCargo.CC_COVERED: class_name += "CC_COVERED"; break;
  26.                         case 1 << 15: class_name += "CC_SPECIAL"; break;
  27.                         default: class_name += "unknown (" + cargo_class + ")"; break;
  28.                     }
  29.                 }
  30.             }
  31.             GSLog.Info("Cargo " + cargo_type + ": " + GSCargo.GetCargoLabel(cargo_type) + (class_name == "" ? "" : "; CargoClass = " + class_name));
  32.             if (town_effect != GSCargo.TE_NONE) {
  33.                 local effect_name;
  34.                 switch(town_effect) {
  35.                     case GSCargo.TE_PASSENGERS: effect_name = "TE_PASSENGERS"; break;
  36.                     case GSCargo.TE_MAIL: effect_name = "TE_MAIL"; break;
  37.                     case GSCargo.TE_GOODS: effect_name = "TE_GOODS"; break;
  38.                     case GSCargo.TE_WATER: effect_name = "TE_WATER"; break;
  39.                     case GSCargo.TE_FOOD: effect_name = "TE_FOOD"; break;
  40.                 }
  41.                 GSLog.Info(" - Effect of " + GSCargo.GetCargoLabel(cargo_type) + " in " + GSTown.GetName(town) + " is " + effect_name);
  42.                 local cargo_goal = GSTown.GetCargoGoal(town, town_effect);
  43.                 if (cargo_goal != 0) {
  44.                     GSLog.Info(" - An amount of " + cargo_goal + " " + GSCargo.GetCargoLabel(cargo_type) + " is required to grow " + GSTown.GetName(town));
  45.                     cargoRequired.AddItem(cargo_type, cargo_goal);
  46.                 }
  47.             }
  48.         }
  49.         GSLog.Info(" ");

Comments