Loading

Paste #pu89rivhz

  1. function MainClass::SetTownEffectGoals() {
  2.     local cargoList = GSCargoList();
  3.     cargoList.Sort(GSList.SORT_BY_ITEM, GSList.SORT_ASCENDING);
  4.    
  5.     local passengers = false;
  6.     local mail = false;
  7.     local goods = false;
  8.     local water = false;
  9.     local food = false;
  10.     for (local cargo_type = cargoList.Begin(); !cargoList.IsEnd(); cargo_type = cargoList.Next()) {
  11.         local town_effect = GSCargo.GetTownEffect(cargo_type);
  12.         if (town_effect != GSCargo.TE_NONE) {
  13.             switch(town_effect) {
  14.                 case GSCargo.TE_PASSENGERS: passengers = true; break;
  15.                 case GSCargo.TE_MAIL:             mail = true; break;
  16.                 case GSCargo.TE_GOODS:           goods = true; break;
  17.                 case GSCargo.TE_WATER:           water = true; break;
  18.                 case GSCargo.TE_FOOD:             food = true; break;
  19.             }
  20.         }
  21.     }
  22.     local townList = GSTownList();
  23.     local landscape = GSGame.GetLandscape();
  24.     for (local town = townList.Begin(); !townList.IsEnd(); town = townList.Next()) {
  25.         if (passengers) {
  26.             switch(landscape) {
  27.                 case GSGame.LT_ARCTIC: GSTown.SetCargoGoal(town, GSCargo.TE_PASSENGERS, 0xFFFFFFFE); break;
  28.                 case GSGame.LT_TROPIC: GSTown.SetCargoGoal(town, GSCargo.TE_PASSENGERS, 0xFFFFFFFF); break;
  29.                 default: GSTown.SetCargoGoal(town, GSCargo.TE_PASSENGERS, 1); break;
  30.             }
  31.         }
  32.         if (mail) {
  33.             switch(landscape) {
  34.                 case GSGame.LT_ARCTIC: GSTown.SetCargoGoal(town, GSCargo.TE_MAIL, 0xFFFFFFFE); break;
  35.                 case GSGame.LT_TROPIC: GSTown.SetCargoGoal(town, GSCargo.TE_MAIL, 0xFFFFFFFF); break;
  36.                 default: GSTown.SetCargoGoal(town, GSCargo.TE_MAIL, 1); break;
  37.             }
  38.         }
  39.         if (goods) {
  40.             switch(landscape) {
  41.                 case GSGame.LT_ARCTIC: GSTown.SetCargoGoal(town, GSCargo.TE_GOODS, 0xFFFFFFFE); break;
  42.                 case GSGame.LT_TROPIC: GSTown.SetCargoGoal(town, GSCargo.TE_GOODS, 0xFFFFFFFF); break;
  43.                 default: GSTown.SetCargoGoal(town, GSCargo.TE_GOODS, 1); break;
  44.             }
  45.         }
  46.         if (water) {
  47.             switch(landscape) {
  48.                 case GSGame.LT_ARCTIC: GSTown.SetCargoGoal(town, GSCargo.TE_WATER, 0xFFFFFFFE); break;
  49.                 case GSGame.LT_TROPIC: GSTown.SetCargoGoal(town, GSCargo.TE_WATER, 0xFFFFFFFF); break;
  50.                 default: GSTown.SetCargoGoal(town, GSCargo.TE_WATER, 1); break;
  51.             }
  52.         }
  53.         if (food) {
  54.             switch(landscape) {
  55.                 case GSGame.LT_ARCTIC: GSTown.SetCargoGoal(town, GSCargo.TE_FOOD, 0xFFFFFFFE); break;
  56.                 case GSGame.LT_TROPIC: GSTown.SetCargoGoal(town, GSCargo.TE_FOOD, 0xFFFFFFFF); break;
  57.                 default: GSTown.SetCargoGoal(town, GSCargo.TE_FOOD, 1); break;
  58.             }
  59.         }
  60.     }
  61. }

Comments