Changeset - r24638:ddf123f00821
[Not reviewed]
master
0 1 0
SamuXarick - 3 years ago 2021-01-10 18:51:48
43006711+SamuXarick@users.noreply.github.com
Fix 218f40e: Warning about 32-bit shift implicitly converted to 64 bits
1 file changed with 2 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/script/api/script_cargo.cpp
Show inline comments
 
@@ -22,25 +22,25 @@
 
	return (cargo_type < NUM_CARGO && ::CargoSpec::Get(cargo_type)->IsValid());
 
}
 

	
 
/* static */ bool ScriptCargo::IsValidTownEffect(TownEffect towneffect_type)
 
{
 
	return (towneffect_type >= (TownEffect)TE_BEGIN && towneffect_type < (TownEffect)TE_END);
 
}
 

	
 
/* static */ char *ScriptCargo::GetName(CargoID cargo_type)
 
{
 
	if (!IsValidCargo(cargo_type)) return nullptr;
 

	
 
	::SetDParam(0, 1 << cargo_type);
 
	::SetDParam(0, 1ULL << cargo_type);
 
	return GetString(STR_JUST_CARGO_LIST);
 
}
 

	
 
/* static */ char *ScriptCargo::GetCargoLabel(CargoID cargo_type)
 
{
 
	if (!IsValidCargo(cargo_type)) return nullptr;
 
	const CargoSpec *cargo = ::CargoSpec::Get(cargo_type);
 

	
 
	/* cargo->label is a uint32 packing a 4 character non-terminated string,
 
	 * like "PASS", "COAL", "OIL_". New ones can be defined by NewGRFs */
 
	char *cargo_label = MallocT<char>(sizeof(cargo->label) + 1);
 
	for (uint i = 0; i < sizeof(cargo->label); i++) {
 
@@ -71,13 +71,13 @@
 
}
 

	
 
/* static */ Money ScriptCargo::GetCargoIncome(CargoID cargo_type, uint32 distance, uint32 days_in_transit)
 
{
 
	if (!IsValidCargo(cargo_type)) return -1;
 
	return ::GetTransportedGoodsIncome(1, distance, Clamp(days_in_transit * 2 / 5, 0, 255), cargo_type);
 
}
 

	
 
/* static */ ScriptCargo::DistributionType ScriptCargo::GetDistributionType(CargoID cargo_type)
 
{
 
	if (!ScriptCargo::IsValidCargo(cargo_type)) return INVALID_DISTRIBUTION_TYPE;
 
	return (ScriptCargo::DistributionType)_settings_game.linkgraph.GetDistributionType(cargo_type);
 
}
 
\ No newline at end of file
 
}
0 comments (0 inline, 0 general)