Skip to content

Commit e0f9f15

Browse files
committedSep 10, 2013
Use engine.is_yes() in mainmenu
1 parent 214da7b commit e0f9f15

File tree

2 files changed

+21
-31
lines changed

2 files changed

+21
-31
lines changed
 

‎builtin/mainmenu.lua

+18-28
Original file line numberDiff line numberDiff line change
@@ -499,8 +499,7 @@ function tabbuilder.handle_multiplayer_buttons(fields)
499499
end
500500

501501
if fields["cb_public_serverlist"] ~= nil then
502-
engine.setting_setbool("public_serverlist",
503-
tabbuilder.tobool(fields["cb_public_serverlist"]))
502+
engine.setting_set("public_serverlist", fields["cb_public_serverlist"])
504503

505504
if engine.setting_getbool("public_serverlist") then
506505
menu.favorites = engine.get_favorites("online")
@@ -571,15 +570,15 @@ function tabbuilder.handle_server_buttons(fields)
571570
menu.handle_key_up_down(fields,"srv_worlds","mainmenu_last_selected_world")
572571

573572
if fields["cb_creative_mode"] then
574-
engine.setting_setbool("creative_mode",tabbuilder.tobool(fields["cb_creative_mode"]))
573+
engine.setting_set("creative_mode", fields["cb_creative_mode"])
575574
end
576575

577576
if fields["cb_enable_damage"] then
578-
engine.setting_setbool("enable_damage",tabbuilder.tobool(fields["cb_enable_damage"]))
577+
engine.setting_set("enable_damage", fields["cb_enable_damage"])
579578
end
580579

581580
if fields["cb_server_announce"] then
582-
engine.setting_setbool("server_announce",tabbuilder.tobool(fields["cb_server_announce"]))
581+
engine.setting_set("server_announce", fields["cb_server_announce"])
583582
end
584583

585584
if fields["start_server"] ~= nil or
@@ -635,54 +634,45 @@ function tabbuilder.handle_server_buttons(fields)
635634
end
636635
end
637636

638-
--------------------------------------------------------------------------------
639-
function tabbuilder.tobool(text)
640-
if text == "true" then
641-
return true
642-
else
643-
return false
644-
end
645-
end
646-
647637
--------------------------------------------------------------------------------
648638
function tabbuilder.handle_settings_buttons(fields)
649639
if fields["cb_fancy_trees"] then
650-
engine.setting_setbool("new_style_leaves",tabbuilder.tobool(fields["cb_fancy_trees"]))
640+
engine.setting_set("new_style_leaves", fields["cb_fancy_trees"])
651641
end
652642
if fields["cb_smooth_lighting"] then
653-
engine.setting_setbool("smooth_lighting",tabbuilder.tobool(fields["cb_smooth_lighting"]))
643+
engine.setting_set("smooth_lighting", fields["cb_smooth_lighting"])
654644
end
655645
if fields["cb_3d_clouds"] then
656-
engine.setting_setbool("enable_3d_clouds",tabbuilder.tobool(fields["cb_3d_clouds"]))
646+
engine.setting_set("enable_3d_clouds", fields["cb_3d_clouds"])
657647
end
658648
if fields["cb_opaque_water"] then
659-
engine.setting_setbool("opaque_water",tabbuilder.tobool(fields["cb_opaque_water"]))
649+
engine.setting_set("opaque_water", fields["cb_opaque_water"])
660650
end
661651

662652
if fields["cb_mipmapping"] then
663-
engine.setting_setbool("mip_map",tabbuilder.tobool(fields["cb_mipmapping"]))
653+
engine.setting_set("mip_map", fields["cb_mipmapping"])
664654
end
665655
if fields["cb_anisotrophic"] then
666-
engine.setting_setbool("anisotropic_filter",tabbuilder.tobool(fields["cb_anisotrophic"]))
656+
engine.setting_set("anisotropic_filter", fields["cb_anisotrophic"])
667657
end
668658
if fields["cb_bilinear"] then
669-
engine.setting_setbool("bilinear_filter",tabbuilder.tobool(fields["cb_bilinear"]))
659+
engine.setting_set("bilinear_filter", fields["cb_bilinear"])
670660
end
671661
if fields["cb_trilinear"] then
672-
engine.setting_setbool("trilinear_filter",tabbuilder.tobool(fields["cb_trilinear"]))
662+
engine.setting_set("trilinear_filter", fields["cb_trilinear"])
673663
end
674664

675665
if fields["cb_shaders"] then
676-
engine.setting_setbool("enable_shaders",tabbuilder.tobool(fields["cb_shaders"]))
666+
engine.setting_set("enable_shaders", fields["cb_shaders"])
677667
end
678668
if fields["cb_pre_ivis"] then
679-
engine.setting_setbool("preload_item_visuals",tabbuilder.tobool(fields["cb_pre_ivis"]))
669+
engine.setting_set("preload_item_visuals", fields["cb_pre_ivis"])
680670
end
681671
if fields["cb_particles"] then
682-
engine.setting_setbool("enable_particles",tabbuilder.tobool(fields["cb_particles"]))
672+
engine.setting_set("enable_particles", fields["cb_particles"])
683673
end
684674
if fields["cb_finite_liquid"] then
685-
engine.setting_setbool("liquid_finite",tabbuilder.tobool(fields["cb_finite_liquid"]))
675+
engine.setting_set("liquid_finite", fields["cb_finite_liquid"])
686676
end
687677

688678
if fields["btn_change_keys"] ~= nil then
@@ -711,11 +701,11 @@ function tabbuilder.handle_singleplayer_buttons(fields)
711701
menu.handle_key_up_down(fields,"sp_worlds","mainmenu_last_selected_world")
712702

713703
if fields["cb_creative_mode"] then
714-
engine.setting_setbool("creative_mode",tabbuilder.tobool(fields["cb_creative_mode"]))
704+
engine.setting_set("creative_mode", fields["cb_creative_mode"])
715705
end
716706

717707
if fields["cb_enable_damage"] then
718-
engine.setting_setbool("enable_damage",tabbuilder.tobool(fields["cb_enable_damage"]))
708+
engine.setting_set("enable_damage", fields["cb_enable_damage"])
719709
end
720710

721711
if fields["play"] ~= nil or

‎builtin/modmgr.lua

+3-3
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ function modmgr.handle_configure_world_buttons(fields)
658658
end
659659

660660
if fields["cb_mod_enable"] ~= nil then
661-
local toset = (fields["cb_mod_enable"] == "true")
661+
local toset = engine.is_yes(fields["cb_mod_enable"])
662662
modmgr.world_config_enable_mod(toset)
663663
end
664664

@@ -675,7 +675,7 @@ function modmgr.handle_configure_world_buttons(fields)
675675
current = {}
676676
end
677677

678-
if fields["cb_hide_gamemods"] == "true" then
678+
if engine.is_yes(fields["cb_hide_gamemods"]) then
679679
current.hide_game = true
680680
modmgr.hide_gamemods = true
681681
else
@@ -693,7 +693,7 @@ function modmgr.handle_configure_world_buttons(fields)
693693
current = {}
694694
end
695695

696-
if fields["cb_hide_mpcontent"] == "true" then
696+
if engine.is_yes(fields["cb_hide_mpcontent"]) then
697697
current.hide_modpackcontents = true
698698
modmgr.hide_modpackcontents = true
699699
else

0 commit comments

Comments
 (0)
Please sign in to comment.