Skip to content

Commit

Permalink
Merge pull request #13 from Return-To-The-Roots/fix_cmdline
Browse files Browse the repository at this point in the history
Fix cmdline
  • Loading branch information
Flamefire authored Jan 1, 2020
2 parents 6e6c88f + f343dd4 commit fcccb93
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 23 deletions.
18 changes: 12 additions & 6 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: true
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
BraceWrapping:
AfterClass: true
AfterControlStatement: true
AfterEnum: true
Expand Down Expand Up @@ -55,7 +55,7 @@ DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH, BOOST_REVERSE_FOREACH, RTTR_FOREACH_PT ]
IncludeCategories:
IncludeCategories:
- Regex: '[dD]efines.h'
Priority: -1
- Regex: '^"world/'
Expand All @@ -70,15 +70,21 @@ IncludeCategories:
Priority: 50
- Regex: '^(<|")lib.*/'
Priority: 90
- Regex: '^<boost/'
- Regex: '^(<|")s25util.*/'
Priority: 90
- Regex: '(<|")rttr/'
Priority: 90
- Regex: '<(utf8.h|kaguya|turtle|glad|KHR)'
Priority: 95
- Regex: '<boost/'
Priority: 99
- Regex: '^<windows'
Priority: 100
- Regex: '^<'
Priority: 110
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '(Impl)?$'
IncludeIsMainRegex: '(Impl|_Win32|_Other)?$'
IndentCaseLabels: true
IndentWidth: 4
IndentWrappedFunctionNames: false
Expand Down Expand Up @@ -114,6 +120,6 @@ SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp03
Standard: Cpp11
TabWidth: 4
UseTab: Never
UseTab: Never
2 changes: 1 addition & 1 deletion examples/chTransparentIdx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ include(EnableWarnings)
enable_warnings(chTransparentIdx)

if(ClangFormat_FOUND)
add_clangFormat_files(${_sources})
add_clangFormat_files(chTransparentIdx.cpp)
endif()
11 changes: 6 additions & 5 deletions examples/chTransparentIdx/chTransparentIdx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ int main(int argc, char* argv[])
bpo::options_description desc("Usage:\n"
"unpack: chTransparentIdx <file.lst>\n"
"Optionally pass a color palette file (bbm/act) to use instead of default one");
desc.add_options()("help,h", "Show help")("file,f", bpo::value<std::vector<bfs::path> >()->multitoken(),
"File(s) to repack")("palette,p", bpo::value<bfs::path>(), "Palette to use")(
desc.add_options()("help,h", "Show help")("file,f", bpo::value<std::vector<std::string>>()->multitoken(),
"File(s) to repack")("palette,p", bpo::value<std::string>(), "Palette to use")(
"from", bpo::value<uint8_t>()->default_value(254), "Original transparent color index")("to", bpo::value<uint8_t>()->default_value(0),
"New transparent color index");
bpo::positional_options_description positionalOptions;
Expand All @@ -66,7 +66,7 @@ int main(int argc, char* argv[])

if(options.count("palette"))
{
bfs::path palPath = options["palette"].as<bfs::path>();
const bfs::path palPath = options["palette"].as<std::string>();
if(libsiedler2::Load(palPath.string(), bbm) != 0)
{
bnw::cerr << "Error: Could not load given palette: " << palPath << std::endl;
Expand All @@ -88,9 +88,10 @@ int main(int argc, char* argv[])
}
}

libsiedler2::ArchivItem_Palette* palette = (libsiedler2::ArchivItem_Palette*)bbm[0];
libsiedler2::ArchivItem_Palette* palette = dynamic_cast<libsiedler2::ArchivItem_Palette*>(bbm[0]);

for(const bfs::path& inputPath : options["file"].as<std::vector<bfs::path> >())
const auto inputPaths = options["file"].as<std::vector<std::string>>();
for(const bfs::path inputPath : inputPaths)
{
if(!bfs::exists(inputPath))
{
Expand Down
14 changes: 7 additions & 7 deletions examples/lstpacker/lstpacker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ int main(int argc, char* argv[])
bpo::options_description desc("Usage:\n"
"pack: lstpacker <directory>\n"
"unpack: lstpacker <file.lst> <file.lst> ...\n");
desc.add_options()("help,h", "Show help")("file,f", bpo::value<std::vector<bfs::path> >()->multitoken(),
"File to unpack or directory to pack")("palette,p", bpo::value<bfs::path>(),
desc.add_options()("help,h", "Show help")("file,f", bpo::value<std::vector<std::string>>()->multitoken(),
"File to unpack or directory to pack")("palette,p", bpo::value<std::string>(),
"Palette (bbm/act) to use instead of default one")(
"palAsTxt,t", "Output palettes as human readable txt files")(
"texFmt", bpo::value<std::string>(&texFmt)->default_value("original"),
Expand Down Expand Up @@ -81,8 +81,8 @@ int main(int argc, char* argv[])

if(options.count("palette"))
{
bfs::path palPath = options["palette"].as<bfs::path>();
if(libsiedler2::Load(palPath.string(), bbm) != 0)
const auto palPath = options["palette"].as<std::string>();
if(libsiedler2::Load(palPath, bbm) != 0)
{
bnw::cerr << "Error: Could not load given palette: " << palPath << std::endl;
bnw::cerr << "Retrying with default ones" << std::endl;
Expand All @@ -103,10 +103,10 @@ int main(int argc, char* argv[])
}
}

libsiedler2::ArchivItem_Palette* palette = (libsiedler2::ArchivItem_Palette*)bbm[0];
libsiedler2::ArchivItem_Palette* palette = dynamic_cast<libsiedler2::ArchivItem_Palette*>(bbm[0]);

std::vector<bfs::path> inputPaths(options["file"].as<std::vector<bfs::path> >());
for(const bfs::path& inputPath : inputPaths)
const auto inputPaths = options["file"].as<std::vector<std::string>>();
for(const bfs::path inputPath : inputPaths)
{
if(!bfs::exists(inputPath))
{
Expand Down
2 changes: 1 addition & 1 deletion examples/outline/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ include(EnableWarnings)
enable_warnings(outline)

if(ClangFormat_FOUND)
add_clangFormat_files(${_sources})
add_clangFormat_files(outline.cpp)
endif()
2 changes: 1 addition & 1 deletion include/libsiedler2/Archiv.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class Archiv
ArchivItem* operator[](size_t index) { return get(index); }

private:
std::vector<std::unique_ptr<ArchivItem> > data; /// elements
std::vector<std::unique_ptr<ArchivItem>> data; /// elements
};
} // namespace libsiedler2

Expand Down
2 changes: 1 addition & 1 deletion src/ArchivItem_Bob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ int libsiedler2::ArchivItem_Bob::load(std::istream& file, const ArchivItem_Palet
std::vector<bool> loaded(numGoodImgs, false);

std::vector<uint8_t> heights(numGoodImgs);
std::vector<std::vector<uint16_t> > starts(numGoodImgs);
std::vector<std::vector<uint16_t>> starts(numGoodImgs);
std::vector<uint8_t> ny(numGoodImgs);

for(uint16_t i = 0; i < numGoodImgs; ++i)
Expand Down
2 changes: 1 addition & 1 deletion tests/testClone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ BOOST_AUTO_TEST_CASE(CloneFromBasePtr)
auto f = std::make_unique<Bar>(42, 1337);
auto* basePtr = static_cast<BarBase*>(f.get());
auto f2 = clone(basePtr);
static_assert(std::is_same<decltype(f2), std::unique_ptr<BarBase> >::value, "Must be the same");
static_assert(std::is_same<decltype(f2), std::unique_ptr<BarBase>>::value, "Must be the same");
BOOST_TEST((f && f2 && basePtr));
BOOST_TEST(f->i == 42);
BOOST_TEST(f->j == 1337);
Expand Down

0 comments on commit fcccb93

Please sign in to comment.