Skip to content

Commit

Permalink
Now color_adjust takes three arguments instead of a config
Browse files Browse the repository at this point in the history
Consider it part of the public API now.
  • Loading branch information
CelticMinstrel committed Feb 15, 2021
1 parent 50239b6 commit f214a67
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
3 changes: 2 additions & 1 deletion data/lua/core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -899,8 +899,9 @@ if wesnoth.kernel_type() == "Game Lua Kernel" then
wesnoth.get_displayed_unit = wesnoth.deprecate_api('wesnoth.get_displayed_unit', 'wesnoth.interface.get_displayed_unit', 1, nil, wesnoth.interface.get_displayed_unit)
wesnoth.zoom = wesnoth.deprecate_api('wesnoth.zoom', 'wesnoth.interface.zoom', 1, nil, wesnoth.interface.zoom)
wesnoth.gamestate_inspector = wesnoth.deprecate_api('wesnoth.gamestate_inspector', 'gui.show_inspector', 1, nil, gui.show_inspector)
-- wesnoth.wml_actions.color_adjust doesn't exist yet at this point, so create a helper function instead.
wesnoth.color_adjust = deprecate_api('wesnoth.color_adjust', 'wesnoth.interface.color_adjust', 1, nil, wesnoth.wml_actions.color_adjust)
-- No deprecation for these since since they're not actually public API yet
wesnoth.color_adjust = wesnoth.interface.color_adjust
wesnoth.set_menu_item = wesnoth.interface.set_menu_item
wesnoth.clear_menu_item = wesnoth.interface.clear_menu_item
-- Units module
Expand Down
2 changes: 1 addition & 1 deletion data/lua/wml-tags.lua
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ function wml_actions.scroll(cfg)
end

function wml_actions.color_adjust(cfg)
wesnoth.interface.color_adjust(cfg)
wesnoth.interface.color_adjust(cfg.red, cfg.green, cfg.blue)
end

function wml_actions.end_turn(cfg)
Expand Down
4 changes: 1 addition & 3 deletions src/scripting/game_lua_kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3408,9 +3408,7 @@ int game_lua_kernel::intf_remove_event(lua_State *L)
int game_lua_kernel::intf_color_adjust(lua_State *L)
{
if (game_display_) {
vconfig cfg(luaW_checkvconfig(L, 1));

game_display_->adjust_color_overlay(cfg["red"], cfg["green"], cfg["blue"]);
game_display_->adjust_color_overlay(luaL_checkinteger(L, 1), luaL_checkinteger(L, 2), luaL_checkinteger(L, 3));
game_display_->invalidate_all();
game_display_->draw(true,true);
}
Expand Down

0 comments on commit f214a67

Please sign in to comment.