Skip to content

Commit

Permalink
Editor tile converter "author" field
Browse files Browse the repository at this point in the history
Adds an "author" field for the "data.stcd" file, which allows specifying a converter's author.

Additionally renames the "0.5.x Crystal Tiles" converter to "Pre-0.6.3 Crystal Tiles" for better accuracy.
  • Loading branch information
Vankata453 committed Dec 11, 2023
1 parent 5341491 commit be6850f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
10 changes: 6 additions & 4 deletions data/images/converters/data.stcd
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
(supertux-converter-data
(nightly_all_tiles.sttc
(title (_ "Nightly Tiles"))
(description (_ "Levels, created in previous Nightly builds, have their tiles broken. Use this converter to restore all tiles in the level to their proper state!"))
(author "SuperTux Team")
(description (_ "For levels, created in previous Nightly builds."))
)
(051_crystal_tiles.sttc
(title (_ "0.5.x Crystal Tiles"))
(description (_ "Levels, created in pre-0.6.3 versions, which use crystal tiles, have their crystal tiles broken. Use this converter to restore all crystal tiles in the level to their proper state!"))
(pre-0.6.3_crystal_tiles.sttc
(title (_ "Pre-0.6.3 Crystal Tiles"))
(author "tylerandari12")
(description (_ "For levels, created in pre-0.6.3 versions, which use crystal tiles."))
)
)
6 changes: 5 additions & 1 deletion src/supertux/menu/editor_converters_menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

#include "supertux/menu/editor_converters_menu.hpp"

#include <fmt/format.h>

#include "editor/editor.hpp"
#include "gui/dialog.hpp"
#include "gui/item_action.hpp"
Expand Down Expand Up @@ -44,6 +46,7 @@ EditorConvertersMenu::EditorConvertersMenu() :

auto mapping = iter.as_mapping();
mapping.get("title", converter.title);
mapping.get("author", converter.author);
mapping.get("description", converter.description);

m_converters.insert({ iter.get_key(), std::move(converter) });
Expand All @@ -65,7 +68,8 @@ EditorConvertersMenu::EditorConvertersMenu() :
return;

item.set_text("\"" + it->second.title + "\"");
item.set_help(it->second.description);
item.set_help(it->second.description + (it->second.author.empty() ? "" :
"\n \n" + fmt::format(fmt::runtime(_("By: {}")), it->second.author)));
});

add_entry(MNID_CONVERT_TILES, _("Convert Tiles By File"))
Expand Down
5 changes: 4 additions & 1 deletion src/supertux/menu/editor_converters_menu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,12 @@ class EditorConvertersMenu final : public Menu

struct Converter
{
Converter() : title(), description() {}
Converter() :
title(), author(), description()
{}

std::string title;
std::string author;
std::string description;
};

Expand Down

0 comments on commit be6850f

Please sign in to comment.