Skip to content

Commit 6744005

Browse files
SmallJokernerzhul
authored andcommittedMay 19, 2017
Mainmenu: Fix issues while trying to enable all mods (#5770)
1 parent e25a38e commit 6744005

File tree

5 files changed

+19
-15
lines changed

5 files changed

+19
-15
lines changed
 

Diff for: ‎builtin/mainmenu/dlg_config_world.lua

+13-11
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ local function get_formspec(data)
4949
"button[3.25,7;2.5,0.5;btn_config_world_save;" .. fgettext("Save") .. "]" ..
5050
"button[5.75,7;2.5,0.5;btn_config_world_cancel;" .. fgettext("Cancel") .. "]"
5151

52-
if mod and mod.name ~= "" and mod.typ ~= "game_mod" then
52+
if mod and mod.name ~= "" and not mod.is_game_content then
5353
if mod.is_modpack then
5454
local rawlist = data.list:get_raw_list()
5555

@@ -97,7 +97,7 @@ end
9797
local function enable_mod(this, toset)
9898
local mod = this.data.list:get_list()[this.data.selected_mod]
9999

100-
if mod.typ == "game_mod" then
100+
if mod.is_game_content then
101101
-- game mods can't be enabled or disabled
102102
elseif not mod.is_modpack then
103103
if toset == nil then
@@ -162,7 +162,7 @@ local function handle_buttons(this, fields)
162162
local i,mod
163163
for i,mod in ipairs(rawlist) do
164164
if not mod.is_modpack and
165-
mod.typ ~= "game_mod" then
165+
not mod.is_game_content then
166166
if modname_valid(mod.name) then
167167
worldfile:set("load_mod_"..mod.name, tostring(mod.enabled))
168168
else
@@ -198,7 +198,8 @@ local function handle_buttons(this, fields)
198198
local list = this.data.list:get_raw_list()
199199

200200
for i = 1, #list do
201-
if list[i].typ ~= "game_mod" and not list[i].is_modpack then
201+
if not list[i].is_game_content
202+
and not list[i].is_modpack then
202203
list[i].enabled = true
203204
end
204205
end
@@ -210,7 +211,8 @@ local function handle_buttons(this, fields)
210211
local list = this.data.list:get_raw_list()
211212

212213
for i = 1, #list do
213-
if list[i].typ ~= "game_mod" and not list[i].is_modpack then
214+
if not list[i].is_game_content
215+
and not list[i].is_modpack then
214216
list[i].enabled = false
215217
end
216218
end
@@ -252,16 +254,16 @@ function create_configure_world_dlg(worldidx)
252254
return true
253255
end
254256
end,
255-
function(element,criteria)
257+
function(element, criteria)
256258
if criteria.hide_game and
257-
element.typ == "game_mod" then
258-
return false
259+
element.is_game_content then
260+
return false
259261
end
260262

261263
if criteria.hide_modpackcontents and
262-
element.modpack ~= nil then
263-
return false
264-
end
264+
element.modpack ~= nil then
265+
return false
266+
end
265267
return true
266268
end, --filter
267269
{ worldpath= dlg.data.worldspec.path,

Diff for: ‎builtin/mainmenu/modmgr.lua

+3-1
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ function modmgr.render_modlist(render_list)
252252
break
253253
end
254254
end
255-
elseif v.typ == "game_mod" or v.typ == "game" then
255+
elseif v.is_game_content then
256256
color = mt_color_blue
257257
elseif v.enabled then
258258
color = mt_color_green
@@ -417,12 +417,14 @@ function modmgr.preparemodlist(data)
417417
-- Add title
418418
retval[#retval + 1] = {
419419
typ = "game",
420+
is_game_content = true,
420421
name = fgettext("Subgame Mods")
421422
}
422423
end
423424

424425
for i=1,#game_mods,1 do
425426
game_mods[i].typ = "game_mod"
427+
game_mods[i].is_game_content = true
426428
retval[#retval + 1] = game_mods[i]
427429
end
428430

Diff for: ‎src/client.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ void Client::initMods()
171171
if (!string_allowed(mod.name, MODNAME_ALLOWED_CHARS)) {
172172
throw ModError("Error loading mod \"" + mod.name +
173173
"\": Mod name does not follow naming conventions: "
174-
"Only chararacters [a-z0-9_] are allowed.");
174+
"Only characters [a-z0-9_] are allowed.");
175175
}
176176
std::string script_path = mod.path + DIR_DELIM + "init.lua";
177177
infostream << " [" << padStringRight(mod.name, 12) << "] [\""

Diff for: ‎src/server.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ Server::Server(
283283
if (!string_allowed(mod.name, MODNAME_ALLOWED_CHARS)) {
284284
throw ModError("Error loading mod \"" + mod.name +
285285
"\": Mod name does not follow naming conventions: "
286-
"Only chararacters [a-z0-9_] are allowed.");
286+
"Only characters [a-z0-9_] are allowed.");
287287
}
288288
std::string script_path = mod.path + DIR_DELIM + "init.lua";
289289
infostream << " [" << padStringRight(mod.name, 12) << "] [\""

Diff for: ‎src/serverenvironment.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ void LBMManager::addLBMDef(LoadingBlockModifierDef *lbm_def)
141141
if (!string_allowed(lbm_def->name, LBM_NAME_ALLOWED_CHARS)) {
142142
throw ModError("Error adding LBM \"" + lbm_def->name +
143143
"\": Does not follow naming conventions: "
144-
"Only chararacters [a-z0-9_:] are allowed.");
144+
"Only characters [a-z0-9_:] are allowed.");
145145
}
146146

147147
m_lbm_defs[lbm_def->name] = lbm_def;

0 commit comments

Comments
 (0)
Please sign in to comment.