Skip to content
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

Advanced settings: Noise window reads “eased” value incorrectly #8076

Closed
Wuzzy2 opened this issue Jan 8, 2019 · 8 comments
Closed

Advanced settings: Noise window reads “eased” value incorrectly #8076

Wuzzy2 opened this issue Jan 8, 2019 · 8 comments
Labels
Bug Issues that were confirmed to be a bug @ Startup / Config / Util

Comments

@Wuzzy2
Copy link
Contributor

Wuzzy2 commented Jan 8, 2019

Issue type
  • Bug report
Minetest version

95d4ff6

Summary

Sometimes, when you edit a noise setting in advanced settings, the checkbox “eased” gets checked even if its not in the setting value.

Steps to reproduce
  1. Open Minetest
  2. In advanced settings, reset mgv5_np_factor to default. The word “eased” should not appear in the value
  3. Click the “Edit” button to open the noise window
  4. Look at the checkboxes

Expected: “eased” is not checked, because this word does not appear in the string
Actual: “eased” IS checked

@SmallJoker SmallJoker added Bug Issues that were confirmed to be a bug @ Startup / Config / Util labels Jan 8, 2019
@paramat
Copy link
Contributor

paramat commented Jan 9, 2019

Confirmed.

Note this noise has 'eased' as the default.
When i open the advanced settings tree the word 'eased' does not appear ('restore default' does not need to be clicked).
If i 'edit' then 'save' (not 'cancel') the word does appear in the advanced settings tree.
'Restore default' then makes the word disappear.

Entries in .conf don't seem broken though so seems a display issue only. Not a blocker.

Also, after changing this back and forth, look what appears at the end of my .conf:

}
}
}
}
}

When a noise table is removed from .conf the last '}' is not removed.
@srifqi

@nerzhul
Copy link
Member

nerzhul commented Jan 9, 2019

Same as previous PR, not blocking release but can be fixed for 5.0.0

@srifqi
Copy link
Member

srifqi commented Jan 9, 2019

I found something on dlg_settings_advanced.lua:

index = default:find("[^, ]", index)
local flags = ""
if index then
flags = default:sub(index)
default = default:sub(1, index - 3) -- Make sure no flags in single-line format
end
table.insert(values, flags)

Why should the flag be removed from default? Note that I just revived an old PR and didn't even know the reason behind it.


About the forgotten closed curly bracket, I think these lines of code makes it (}) marked as invalid and just leave as it is.

minetest/src/settings.cpp

Lines 971 to 973 in 0acdf93

size_t pos = trimmed_line.find('=');
if (pos == std::string::npos)
return SPE_INVALID;

Maybe, we should create a stack for the settings' parent and create special case for closed curly bracket (})? I don't know for now.

minetest/src/settings.cpp

Lines 246 to 248 in 0acdf93

sanity_check(it->second.group != NULL);
was_modified |= it->second.group->updateConfigObject(is, os,
"}", tab_depth + 1);

@paramat
Copy link
Contributor

paramat commented Jan 19, 2019

#8089 merged, fixes the '}'s.

@p-ouellette
Copy link
Contributor

Omitting the flags was intentional, probably because the single line format does not support flags. Still, I think it would be better to show them so that the current value can be seen without opening the edit window.

@srifqi
Copy link
Member

srifqi commented Jul 31, 2019

Single flag format is removed already from minetest.conf.example.

I found that the flags' place is used for lacunarity (as optional value). Should we make lacunarity a required value?

minetest/src/settings.cpp

Lines 541 to 543 in 245e628

std::string optional_params = f.next("");
if (!optional_params.empty())
np.lacunarity = stof(optional_params);

@Wuzzy2
Copy link
Contributor Author

Wuzzy2 commented Dec 28, 2019

I can no longer reproduce this bug in 4445889 (5.2.0-dev).

Should I close it?

@SmallJoker
Copy link
Member

#8089

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Issues that were confirmed to be a bug @ Startup / Config / Util
Projects
None yet
Development

No branches or pull requests

6 participants