openttd updated to 1.5.0-beta2
--HG-- branch : openttd
This commit is contained in:
+12
-10
@@ -1,4 +1,4 @@
|
||||
/* $Id: cargomonitor.cpp 24986 2013-02-10 19:49:04Z zuu $ */
|
||||
/* $Id: cargomonitor.cpp 26685 2014-07-12 17:04:14Z alberth $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -13,15 +13,17 @@
|
||||
#include "cargomonitor.h"
|
||||
#include "station_base.h"
|
||||
|
||||
#include "safeguards.h"
|
||||
|
||||
CargoMonitorMap _cargo_pickups; ///< Map of monitored pick-ups to the amount since last query/activation.
|
||||
CargoMonitorMap _cargo_deliveries; ///< Map of monitored deliveries to the amount since last query/activation.
|
||||
|
||||
/**
|
||||
* Helper method for ClearCargoPickupMonitoring and ClearCargoDeliveryMonitoring.
|
||||
* Clears all monitors that belong to the specified company or all if INVALID_OWNER
|
||||
* Helper method for #ClearCargoPickupMonitoring and #ClearCargoDeliveryMonitoring.
|
||||
* Clears all monitors that belong to the specified company or all if #INVALID_OWNER
|
||||
* is specified as company.
|
||||
* @param cargo_monitor_map reference to the cargo monitor map to operate on.
|
||||
* @param company company to clear cargo monitors for or INVALID_OWNER if all cargo monitors should be cleared.
|
||||
* @param company company to clear cargo monitors for or #INVALID_OWNER if all cargo monitors should be cleared.
|
||||
*/
|
||||
static void ClearCargoMonitoring(CargoMonitorMap &cargo_monitor_map, CompanyID company = INVALID_OWNER)
|
||||
{
|
||||
@@ -42,7 +44,7 @@ static void ClearCargoMonitoring(CargoMonitorMap &cargo_monitor_map, CompanyID c
|
||||
|
||||
/**
|
||||
* Clear all pick-up cargo monitors.
|
||||
* @param company clear all pick-up monitors for this company or if INVALID_OWNER
|
||||
* @param company clear all pick-up monitors for this company or if #INVALID_OWNER
|
||||
* is passed, all pick-up monitors are cleared regardless of company.
|
||||
*/
|
||||
void ClearCargoPickupMonitoring(CompanyID company)
|
||||
@@ -52,7 +54,7 @@ void ClearCargoPickupMonitoring(CompanyID company)
|
||||
|
||||
/**
|
||||
* Clear all delivery cargo monitors.
|
||||
* @param company clear all delivery monitors for this company or if INVALID_OWNER
|
||||
* @param company clear all delivery monitors for this company or if #INVALID_OWNER
|
||||
* is passed, all delivery monitors are cleared regardless of company.
|
||||
*/
|
||||
void ClearCargoDeliveryMonitoring(CompanyID company)
|
||||
@@ -67,7 +69,7 @@ void ClearCargoDeliveryMonitoring(CompanyID company)
|
||||
* @param keep_monitoring After returning from this call, continue monitoring.
|
||||
* @return Amount collected since last query/activation for the monitored combination.
|
||||
*/
|
||||
static uint32 GetAmount(CargoMonitorMap &monitor_map, CargoMonitorID monitor, bool keep_monitoring)
|
||||
static int32 GetAmount(CargoMonitorMap &monitor_map, CargoMonitorID monitor, bool keep_monitoring)
|
||||
{
|
||||
CargoMonitorMap::iterator iter = monitor_map.find(monitor);
|
||||
if (iter == monitor_map.end()) {
|
||||
@@ -77,7 +79,7 @@ static uint32 GetAmount(CargoMonitorMap &monitor_map, CargoMonitorID monitor, bo
|
||||
}
|
||||
return 0;
|
||||
} else {
|
||||
uint32 result = iter->second;
|
||||
int32 result = iter->second;
|
||||
iter->second = 0;
|
||||
if (!keep_monitoring) monitor_map.erase(iter);
|
||||
return result;
|
||||
@@ -90,7 +92,7 @@ static uint32 GetAmount(CargoMonitorMap &monitor_map, CargoMonitorID monitor, bo
|
||||
* @param keep_monitoring After returning from this call, continue monitoring.
|
||||
* @return Amount of delivered cargo for the monitored combination.
|
||||
*/
|
||||
uint32 GetDeliveryAmount(CargoMonitorID monitor, bool keep_monitoring)
|
||||
int32 GetDeliveryAmount(CargoMonitorID monitor, bool keep_monitoring)
|
||||
{
|
||||
return GetAmount(_cargo_deliveries, monitor, keep_monitoring);
|
||||
}
|
||||
@@ -102,7 +104,7 @@ uint32 GetDeliveryAmount(CargoMonitorID monitor, bool keep_monitoring)
|
||||
* @return Amount of picked up cargo for the monitored combination.
|
||||
* @note Cargo pick up is counted on final delivery, to prevent users getting credit for picking up cargo without delivering it.
|
||||
*/
|
||||
uint32 GetPickupAmount(CargoMonitorID monitor, bool keep_monitoring)
|
||||
int32 GetPickupAmount(CargoMonitorID monitor, bool keep_monitoring)
|
||||
{
|
||||
return GetAmount(_cargo_pickups, monitor, keep_monitoring);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user