equal
deleted
inserted
replaced
1568 |
1568 |
1569 i = 200; |
1569 i = 200; |
1570 for (;;) { |
1570 for (;;) { |
1571 r = (uint16)Random(); |
1571 r = (uint16)Random(); |
1572 |
1572 |
1573 if (_patches.ai_disable_veh_train && |
1573 if (_settings.ai.ai_disable_veh_train && |
1574 _patches.ai_disable_veh_roadveh && |
1574 _settings.ai.ai_disable_veh_roadveh && |
1575 _patches.ai_disable_veh_aircraft && |
1575 _settings.ai.ai_disable_veh_aircraft && |
1576 _patches.ai_disable_veh_ship) { |
1576 _settings.ai.ai_disable_veh_ship) { |
1577 return; |
1577 return; |
1578 } |
1578 } |
1579 |
1579 |
1580 if (r < 0x7626) { |
1580 if (r < 0x7626) { |
1581 if (_patches.ai_disable_veh_train) continue; |
1581 if (_settings.ai.ai_disable_veh_train) continue; |
1582 AiWantTrainRoute(p); |
1582 AiWantTrainRoute(p); |
1583 } else if (r < 0xC4EA) { |
1583 } else if (r < 0xC4EA) { |
1584 if (_patches.ai_disable_veh_roadveh) continue; |
1584 if (_settings.ai.ai_disable_veh_roadveh) continue; |
1585 AiWantRoadRoute(p); |
1585 AiWantRoadRoute(p); |
1586 } else if (r < 0xD89B) { |
1586 } else if (r < 0xD89B) { |
1587 if (_patches.ai_disable_veh_aircraft) continue; |
1587 if (_settings.ai.ai_disable_veh_aircraft) continue; |
1588 AiWantAircraftRoute(p); |
1588 AiWantAircraftRoute(p); |
1589 } else { |
1589 } else { |
1590 /* Ships are not implemented in this (broken) AI */ |
1590 /* Ships are not implemented in this (broken) AI */ |
1591 } |
1591 } |
1592 |
1592 |
1601 } |
1601 } |
1602 } |
1602 } |
1603 |
1603 |
1604 static bool AiCheckTrackResources(TileIndex tile, const AiDefaultBlockData *p, byte cargo) |
1604 static bool AiCheckTrackResources(TileIndex tile, const AiDefaultBlockData *p, byte cargo) |
1605 { |
1605 { |
1606 uint rad = (_patches.modified_catchment) ? CA_TRAIN : CA_UNMODIFIED; |
1606 uint rad = (_settings.station.modified_catchment) ? CA_TRAIN : CA_UNMODIFIED; |
1607 |
1607 |
1608 for (; p->mode != 4; p++) { |
1608 for (; p->mode != 4; p++) { |
1609 AcceptedCargo values; |
1609 AcceptedCargo values; |
1610 TileIndex tile2; |
1610 TileIndex tile2; |
1611 uint w; |
1611 uint w; |
2597 static bool AiCheckRoadResources(TileIndex tile, const AiDefaultBlockData *p, byte cargo) |
2597 static bool AiCheckRoadResources(TileIndex tile, const AiDefaultBlockData *p, byte cargo) |
2598 { |
2598 { |
2599 uint values[NUM_CARGO]; |
2599 uint values[NUM_CARGO]; |
2600 int rad; |
2600 int rad; |
2601 |
2601 |
2602 if (_patches.modified_catchment) { |
2602 if (_settings.station.modified_catchment) { |
2603 rad = CA_TRUCK; // Same as CA_BUS at the moment? |
2603 rad = CA_TRUCK; // Same as CA_BUS at the moment? |
2604 } else { // change that at some point? |
2604 } else { // change that at some point? |
2605 rad = 4; |
2605 rad = 4; |
2606 } |
2606 } |
2607 |
2607 |
3421 for (; p->mode == 0; p++) { |
3421 for (; p->mode == 0; p++) { |
3422 TileIndex tile2 = TILE_ADD(tile, ToTileIndexDiff(p->tileoffs)); |
3422 TileIndex tile2 = TILE_ADD(tile, ToTileIndexDiff(p->tileoffs)); |
3423 const AirportFTAClass* airport = GetAirport(p->attr); |
3423 const AirportFTAClass* airport = GetAirport(p->attr); |
3424 uint w = airport->size_x; |
3424 uint w = airport->size_x; |
3425 uint h = airport->size_y; |
3425 uint h = airport->size_y; |
3426 uint rad = _patches.modified_catchment ? airport->catchment : (uint)CA_UNMODIFIED; |
3426 uint rad = _settings.station.modified_catchment ? airport->catchment : (uint)CA_UNMODIFIED; |
3427 |
3427 |
3428 if (cargo & 0x80) { |
3428 if (cargo & 0x80) { |
3429 GetProductionAroundTiles(values, tile2, w, h, rad); |
3429 GetProductionAroundTiles(values, tile2, w, h, rad); |
3430 return values[cargo & 0x7F] != 0; |
3430 return values[cargo & 0x7F] != 0; |
3431 } else { |
3431 } else { |
3973 |
3973 |
3974 // Ugly hack to make sure the service interval of the AI is good, not looking |
3974 // Ugly hack to make sure the service interval of the AI is good, not looking |
3975 // to the patch-setting |
3975 // to the patch-setting |
3976 // Also, it takes into account the setting if the service-interval is in days |
3976 // Also, it takes into account the setting if the service-interval is in days |
3977 // or in % |
3977 // or in % |
3978 _ai_service_interval = _patches.servint_ispercent ? 80 : 180; |
3978 _ai_service_interval = _settings.vehicle.servint_ispercent ? 80 : 180; |
3979 |
3979 |
3980 if (IsHumanPlayer(_current_player)) return; |
3980 if (IsHumanPlayer(_current_player)) return; |
3981 |
3981 |
3982 AiAdjustLoan(p); |
3982 AiAdjustLoan(p); |
3983 AiBuildCompanyHQ(p); |
3983 AiBuildCompanyHQ(p); |