Skip to content

Commit

Permalink
Fixes: Make GUI asset names case insensitive
Browse files Browse the repository at this point in the history
	Fix tutorial #1 & #3 research defs
  • Loading branch information
m-flak committed May 10, 2021
1 parent 3a99bae commit d32dcee
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion data/tut03.rsi
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
RACE RED
MACHINE RESEARCHED GEO_LOCATOR 1
MACHINE RESEARCHED RESOURCE_CARRIER 1
MACHINE NOT CONSTRUCTOR 1 SUB DOZER
MACHINE NOT CONSTRUCTOR 1 SUB DOZER RESEARCH_COST 1

RACE BLUE

Expand Down
12 changes: 10 additions & 2 deletions src/libdev/gui/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,16 @@ const Gui::Colour& Gui::GREY()
GuiBitmap
Gui::bitmap( const SysPathName& path )
{
ASSERT_FILE_EXISTS( path.pathname().c_str() );
return GuiBitmap::createSharedSurface( path.pathname(), Gui::backBuffer() );
//LO's assets don't keep case. :(
string pathName(path.pathname());

if (not path.existsAsFile())
{
std::transform(pathName.begin(), pathName.end(), pathName.begin(), [](unsigned char c){ return std::tolower(c); });
}
ASSERT_FILE_EXISTS( pathName.c_str() );

return GuiBitmap::createSharedSurface( pathName, Gui::backBuffer() );
}

// static
Expand Down

0 comments on commit d32dcee

Please sign in to comment.