mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-12 10:30:28 +00:00
(svn r23724) -Codechange: split of the check to see if ambient sounds are enabled to a header file allowing compilers to inline that check
This commit is contained in:
parent
b9e19cc6c1
commit
5f79b4c5d1
@ -259,7 +259,7 @@ static void TileLoop_Clear(TileIndex tile)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AmbientSoundEffectCallback(tile);
|
AmbientSoundEffect(tile);
|
||||||
|
|
||||||
switch (_settings_game.game_creation.landscape) {
|
switch (_settings_game.game_creation.landscape) {
|
||||||
case LT_TROPIC: TileLoopClearDesert(tile); break;
|
case LT_TROPIC: TileLoopClearDesert(tile); break;
|
||||||
|
@ -235,8 +235,6 @@ void AmbientSoundEffectCallback(TileIndex tile)
|
|||||||
{
|
{
|
||||||
assert(IsTileType(tile, MP_CLEAR) || IsTileType(tile, MP_TREES) || IsTileType(tile, MP_WATER));
|
assert(IsTileType(tile, MP_CLEAR) || IsTileType(tile, MP_TREES) || IsTileType(tile, MP_WATER));
|
||||||
|
|
||||||
/* Only run callback if enabled. */
|
|
||||||
if (!HasGrfMiscBit(GMB_AMBIENT_SOUND_CALLBACK)) return;
|
|
||||||
/* Only run every 1/200-th time. */
|
/* Only run every 1/200-th time. */
|
||||||
uint32 r; // Save for later
|
uint32 r; // Save for later
|
||||||
if (!Chance16R(1, 200, r)) return;
|
if (!Chance16R(1, 200, r)) return;
|
||||||
|
@ -51,6 +51,15 @@ void ResetGenericCallbacks();
|
|||||||
void AddGenericCallback(uint8 feature, const GRFFile *file, const SpriteGroup *group);
|
void AddGenericCallback(uint8 feature, const GRFFile *file, const SpriteGroup *group);
|
||||||
|
|
||||||
uint16 GetAiPurchaseCallbackResult(uint8 feature, CargoID cargo_type, uint8 default_selection, IndustryType src_industry, IndustryType dst_industry, uint8 distance, AIConstructionEvent event, uint8 count, uint8 station_size, const GRFFile **file);
|
uint16 GetAiPurchaseCallbackResult(uint8 feature, CargoID cargo_type, uint8 default_selection, IndustryType src_industry, IndustryType dst_industry, uint8 distance, AIConstructionEvent event, uint8 count, uint8 station_size, const GRFFile **file);
|
||||||
void AmbientSoundEffectCallback(TileIndex tile);
|
|
||||||
|
/** Play an ambient sound effect for an empty tile. */
|
||||||
|
static inline void AmbientSoundEffect(TileIndex tile)
|
||||||
|
{
|
||||||
|
/* Only run callback if enabled. */
|
||||||
|
if (!HasGrfMiscBit(GMB_AMBIENT_SOUND_CALLBACK)) return;
|
||||||
|
|
||||||
|
extern void AmbientSoundEffectCallback(TileIndex tile);
|
||||||
|
AmbientSoundEffectCallback(tile);
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* NEWGRF_GENERIC_H */
|
#endif /* NEWGRF_GENERIC_H */
|
||||||
|
@ -627,7 +627,7 @@ static void TileLoop_Trees(TileIndex tile)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AmbientSoundEffectCallback(tile);
|
AmbientSoundEffect(tile);
|
||||||
|
|
||||||
uint treeCounter = GetTreeCounter(tile);
|
uint treeCounter = GetTreeCounter(tile);
|
||||||
|
|
||||||
|
@ -1143,7 +1143,7 @@ static void DoDryUp(TileIndex tile)
|
|||||||
*/
|
*/
|
||||||
void TileLoop_Water(TileIndex tile)
|
void TileLoop_Water(TileIndex tile)
|
||||||
{
|
{
|
||||||
if (IsTileType(tile, MP_WATER)) AmbientSoundEffectCallback(tile);
|
if (IsTileType(tile, MP_WATER)) AmbientSoundEffect(tile);
|
||||||
|
|
||||||
switch (GetFloodingBehaviour(tile)) {
|
switch (GetFloodingBehaviour(tile)) {
|
||||||
case FLOOD_ACTIVE:
|
case FLOOD_ACTIVE:
|
||||||
|
Loading…
Reference in New Issue
Block a user