(svn r16416) -Fix [FS#2912]: Rework deleting of news when referenced vehicles/stations/industries are deleted.

This commit is contained in:
frosch
2009-05-24 16:52:42 +00:00
parent b86ab81030
commit eeb3f75cfe
20 changed files with 216 additions and 162 deletions

View File

@@ -8,8 +8,25 @@
#include "news_type.h"
#include "vehicle_type.h"
#include "station_type.h"
#include "industry_type.h"
void AddNewsItem(StringID string, NewsSubtype subtype, NewsReferenceType reftype1 = NR_NONE, uint32 ref1 = UINT32_MAX, NewsReferenceType reftype2 = NR_NONE, uint32 ref2 = UINT32_MAX, void *free_data = NULL);
static inline void AddCompanyNewsItem(StringID string, NewsSubtype subtype, CompanyNewsInformation *cni)
{
AddNewsItem(string, subtype, NR_NONE, UINT32_MAX, NR_NONE, UINT32_MAX, cni);
}
static inline void AddVehicleNewsItem(StringID string, NewsSubtype subtype, VehicleID vehicle, StationID station = INVALID_STATION)
{
AddNewsItem(string, subtype, NR_VEHICLE, vehicle, station == INVALID_STATION ? NR_NONE : NR_STATION, station);
}
static inline void AddIndustryNewsItem(StringID string, NewsSubtype subtype, IndustryID industry)
{
AddNewsItem(string, subtype, NR_INDUSTRY, industry);
}
void AddNewsItem(StringID string, NewsSubtype subtype, uint data_a, uint data_b, void *free_data = NULL);
void NewsLoop();
void InitNewsItemStructs();
@@ -23,9 +40,12 @@ extern NewsTypeData _news_type_data[];
* if the news item type is INVALID_STRING_ID all news about the vehicle get
* deleted
*/
void DeleteVehicleNews(VehicleID, StringID news);
void DeleteVehicleNews(VehicleID vid, StringID news);
/** Delete news associated with given station */
void DeleteStationNews(StationID);
void DeleteStationNews(StationID sid);
/** Delete news associated with given station */
void DeleteIndustryNews(IndustryID iid);
#endif /* NEWS_FUNC_H */