-
-
Notifications
You must be signed in to change notification settings - Fork 928
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent sounds being produced by inactive industries #7752
Conversation
Hmm, all the regression tests are failing, and the reason must be because the consumption of random numbers has changed. Notice there is a Additionally, the commit checker is rejecting your commit because the commit message does not start with a keyword. (See this about commit messages.) Update the commit message with |
In that case should I let |
Sorry about the merge commit - I cloned the main repository (this) rather than my fork, so the merge took place when I pulled before amending. Still trying to find my way around with git! |
I tried |
El ds. 28 de set. de 2019 15.50, glx22 <notifications@github.com> va
escriure:
… ***@***.**** commented on this pull request.
------------------------------
In src/industry_cmd.cpp
<#7752 (comment)>:
> @@ -1125,7 +1125,7 @@ static void ProduceIndustryGoods(Industry *i)
if ((i->counter & 0x3F) == 0) {
uint32 r;
uint num;
- if (Chance16R(1, 14, r) && (num = indsp->number_of_sounds) != 0 && _settings_client.sound.ambient) {
+ if (Chance16R(1, 14, r) && (num = indsp->number_of_sounds) != 0 && _settings_client.sound.ambient && *i->last_month_production > 0) {
Oh my bad, i->last_month_production is an array (= a pointer) so by
dereferencing you effectively access i->last_month_production[0]
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#7752?email_source=notifications&email_token=AAYBYXUT66KULNFIWSM6K5TQL5OLTA5CNFSM4I3K7KGKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCGH5CII#discussion_r329311028>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAYBYXWF76MDVFMYXJOOVYLQL5OLTANCNFSM4I3K7KGA>
.
|
Is it defined what 'inactive' is for a newgrf industry? :) |
I assume so, but I haven't tested it yet. I take it you have already done so? |
I tried with FIRS Replacement Set 3, however it doesn't seem to have any industry sounds - I didn't hear anything anyway. |
For newgrf industry, there is simply no way to know in advance what behaviour is defined 'inactive'. I don't think industry sounds are particularly important for newgrf, but I am just one opinion. But if this PR is merged, it would be worth noting in the newgrf docs (nfo and nml) that sound effects aren't purely random, and may never trigger for newgrf industries. Potentially a newgrf author could spend a long time investigating why sound effects don't work / no longer work as expected. |
True, I never thought of that - being new to the inner workings of OpenTTD. Where/how would that be documented? Also, surely the definition of inactivity chosen (last month's production) should be fairly ubiquitously applicable? |
Relevant newgrf docs are:
They don't promise more than sound is played 'sometimes', and just need a note explaining the conditions under which sounds won't be played. That wouldn't need doing unless the PR is accepted. I would not mind never hearing the sawmill noise ever again, but maybe that's just me 😃 |
Should that be part of this PR? Also, is there a repo for the wiki or should the editions be done on the wiki itself (I expect this is the correct method)? |
Haha! Funnily enough I've always played without sound since I never could be bothered to take the extra steps of downloading and enabling the sounds. |
Any updates on what else needs to be done to this PR? |
Any follow-up? |
I still fail to understand why the commit checker was successful, but you'll need to use |
Thanks for that. I've applied it and pushed. Hopefully it works this time! |
Changes made to check all of the industry's outputs. |
I can't seem to fix this tab indentation (of all things) despite my efforts. Any ideas? |
You need to fix it in the commit introducing the wrong indentation, as the commit checker checks the diffs individually |
Oh my, may I ask what the easiest way to do that would be? Sorry for my basic questions and thanks for all your help! |
The easiest way is to rebase, but it seems your previous rebase somehow failed. I can force push a rebase on your branch if you want. |
Yes, please! |
fe7d9b0
to
e738181
Compare
Thank you for resolving that problem @glx22! I believe that now the PR should be complete (hopefully!). |
Sorry for tiring you with such trivial problems throughout @glx22. You've been a great help! |
Arg, github commits don't follow our style. But it's easily fixable with |
b4eb561
to
b50aeff
Compare
Done, thanks for the tip. |
I've one question regarding black-hole industries (that is industries which only receive cargo but don't produce anything like power plants): I don't see how they will be able to make sounds with this patch. Do I miss something? |
It doesn't apply to them, since I can hear their sounds despite no cargo being transported to them. I never bothered checking why, but I expect the |
Haha, you made me curious and I couldn't help but check. As was mentioned in the issue, the code for the power station sound is here: Lines 893 to 898 in b50aeff
Whereas the code for the production sounds is in the function Lines 1120 to 1139 in b50aeff
This does raise another question though - are there any NewGRF/extension packs with black-hole industries that play their sounds through the |
ah, right. Looking at the broader context (that is beyond the patch), that function is only called for producing industries. :) And the accepting default industries are handled via the tile loop separately :) Cheers! EDIT: NewGRFs can also make use of the tile loop. or run callback on receiving cargo at which time they can play a sound. But you actually pointed out the place an additional patch might go: making the blackhole industries kinda inactive unless they actually receive something to eat :D (But if so: that's for a separate PR) |
Great, thanks again! |
@planetmaker With regards to the point you added, that'd have to be done by someone with a better idea of how the engine works since I expect that a new attribute will have to be added, unless there is a more obvious way that I don't know? |
Anything else required for this PR? |
Thanks for the approval! What else is remaining? |
Patience :p |
Haha, and I thought it would only require changing one or two lines and be done in a day! |
Have I been patient long enough (wink)? |
Great, thanks a lot! |
Fixes #7703.