summaryrefslogtreecommitdiff
path: root/src/company_cmd.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-10-03 17:24:31 +0000
committerfrosch <frosch@openttd.org>2011-10-03 17:24:31 +0000
commit1a12008fcf0808d2426158c25e579158c47d94d0 (patch)
treea0275bc05f4092ce27dddb639355d8354a4a8442 /src/company_cmd.cpp
parentdd74536bef66a4e1d214caab38805d0c70acb075 (diff)
downloadopenttd-1a12008fcf0808d2426158c25e579158c47d94d0.tar.xz
(svn r22982) -Cleanup: Remove CountCompanyVehicles() and use ALL_GROUP statistics instead.
Diffstat (limited to 'src/company_cmd.cpp')
-rw-r--r--src/company_cmd.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/company_cmd.cpp b/src/company_cmd.cpp
index f72d131e0..df08fff00 100644
--- a/src/company_cmd.cpp
+++ b/src/company_cmd.cpp
@@ -610,15 +610,14 @@ void InitializeCompanies()
*/
bool MayCompanyTakeOver(CompanyID cbig, CompanyID csmall)
{
- uint big_counts[4], small_counts[4];
- CountCompanyVehicles(cbig, big_counts);
- CountCompanyVehicles(csmall, small_counts);
+ const Company *c1 = Company::Get(cbig);
+ const Company *c2 = Company::Get(csmall);
/* Do the combined vehicle counts stay within the limits? */
- return big_counts[VEH_TRAIN] + small_counts[VEH_TRAIN] <= _settings_game.vehicle.max_trains &&
- big_counts[VEH_ROAD] + small_counts[VEH_ROAD] <= _settings_game.vehicle.max_roadveh &&
- big_counts[VEH_SHIP] + small_counts[VEH_SHIP] <= _settings_game.vehicle.max_ships &&
- big_counts[VEH_AIRCRAFT] + small_counts[VEH_AIRCRAFT] <= _settings_game.vehicle.max_aircraft;
+ return c1->group_all[VEH_TRAIN].num_vehicle + c2->group_all[VEH_TRAIN].num_vehicle <= _settings_game.vehicle.max_trains &&
+ c1->group_all[VEH_ROAD].num_vehicle + c2->group_all[VEH_ROAD].num_vehicle <= _settings_game.vehicle.max_roadveh &&
+ c1->group_all[VEH_SHIP].num_vehicle + c2->group_all[VEH_SHIP].num_vehicle <= _settings_game.vehicle.max_ships &&
+ c1->group_all[VEH_AIRCRAFT].num_vehicle + c2->group_all[VEH_AIRCRAFT].num_vehicle <= _settings_game.vehicle.max_aircraft;
}
/**