Latest Posts

Topic: add-on versions for specific widelands versions

kaputtnik
Avatar
Topic Opener
Joined: 2013-02-18, 20:48
Posts: 2546
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2024-08-25, 12:33

I am unsure how to handle add-on versions which are working only for specific widelands versions.

Since the change in the development version to use other window borders i need to adapt the minimalistic theme to work with the upcoming release of widelands 1.3. The problem i see is that e.g. debian related distros will probably not provide the new widelands version for a long time. So i need to provide two different add-ons, one for widelands version 1.2 and another one for widelands version 1.3 and later.

The current version of the minimalistic theme is 1.7 (which will not work for the upcoming widelands version 1.3). Should i increase the version number of the add-on for widelands version 1.3 although it will be a new add-on?


Top Quote
Nordfriese
Avatar
Joined: 2017-01-17, 18:07
Posts: 2053
OS: Debian Testing
Version: Latest master
Ranking
One Elder of Players
Location: 0x55555d3a34c0
Posted at: 2024-08-25, 17:34

The best practice would be to adapt your add-on to detect the Widelands version and adapt itself accordingly. So you might include border graphics for both the old and new style and then use Lua scripting in the init.lua to decide which keys to include in the returned table and which not. The Widelands version can be determined as get_build_id(), then just do a simple string search to check whether it starts with '1.2':

uses_new_style_borders = (get_build_id():find("1.2") ~= 1)

If you really want to maintain two separate versions of the add-on instead, keep them completely separate and use max_wl_version in the addon file. The add-ons versioning scheme is up to you; you can choose whatever is most logical and practical for you.


Top Quote
kaputtnik
Avatar
Topic Opener
Joined: 2013-02-18, 20:48
Posts: 2546
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2024-08-25, 18:18

Nordfriese wrote:

The best practice would be to adapt your add-on to detect the Widelands version and adapt itself accordingly. So you might include border graphics for both the old and new style and then use Lua scripting in the init.lua to decide which keys to include in the returned table and which not. The Widelands version can be determined as get_build_id(), then just do a simple string search to check whether it starts with '1.2':

uses_new_style_borders = (get_build_id():find("1.2") ~= 1)

Oh yeah, very good idea!

Many thanks for this hint!


Top Quote