Remove the usage of '//', which isn't properly supported by Irrlicht's CFileList

("a/b" and "a//b" on a file archive are not equal) and is not necessary.


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@12402 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2013-01-21 05:37:33 +00:00
parent cb3a4afec2
commit 4410101721
10 changed files with 50 additions and 83 deletions

View File

@ -58,7 +58,7 @@ ModalDialog::ModalDialog(const float percentWidth, const float percentHeight,
void ModalDialog::loadFromFile(const char* xmlFile)
{
IXMLReader* xml = file_manager->createXMLReader( (file_manager->getGUIDir() + "/" + xmlFile).c_str() );
IXMLReader* xml = file_manager->createXMLReader( (file_manager->getGUIDir() + xmlFile).c_str() );
if (xml == NULL)
{
fprintf(stderr, "Cannot open file %s\n", xmlFile);

View File

@ -117,7 +117,7 @@ void Screen::loadFromFile()
{
assert(m_magic_number == 0xCAFEC001);
IXMLReader* xml = file_manager->createXMLReader( (file_manager->getGUIDir() + "/" + m_filename).c_str() );
IXMLReader* xml = file_manager->createXMLReader( (file_manager->getGUIDir() + m_filename).c_str() );
if (xml == NULL)
{
fprintf(stderr, "Cannot open file %s\n", m_filename.c_str());

View File

@ -30,6 +30,7 @@
#include "guiengine/widgets.hpp"
#include "io/file_manager.hpp"
#include "states_screens/state_manager.hpp"
#include "utils/log.hpp"
using namespace GUIEngine;
using namespace irr;
@ -61,14 +62,14 @@ namespace SkinConfig
if (node->get("type", &type) == 0)
{
std::cerr << "Error in skin : All elements must have a type\n";
Log::error("skin", "All elements must have a type\n");
return;
}
node->get("state", &state);
if (node->get("image", &image) == 0)
{
std::cerr << "Error in skin : All elements must have an image\n";
Log::error("skin", "All elements must have an image\n");
return;
}
@ -96,7 +97,7 @@ namespace SkinConfig
// call last since it calculates coords considering all other
// parameters
std:: string full_path = file_manager->getGUIDir() + "/skins/" + image;
std:: string full_path = file_manager->getGUIDir() + "skins/" + image;
new_param.setTexture( irr_driver->getTexture(full_path) );
if (areas.size() > 0)
@ -126,7 +127,7 @@ namespace SkinConfig
if(node->get("type", &type) == 0)
{
std::cerr << "Error in skin : All elements must have a type\n";
Log::error("skin", "All elements must have a type\n");
return;
}
node->get("state", &state);
@ -152,8 +153,8 @@ namespace SkinConfig
XMLNode* root = file_manager->createXMLTree(file);
if(!root)
{
std::cerr << "Could not read XML file " << file.c_str()
<< std::endl;
Log::error("skin", "Could not read XML file '%s'.",
file.c_str());
throw std::runtime_error("Invalid skin file");
}
@ -172,8 +173,8 @@ namespace SkinConfig
}
else
{
std::cerr << "Unknown node in XML file : " << node->getName()
<< std::endl;
Log::error("skin", "Unknown node in XML file '%s'.",
node->getName().c_str());
}
}// nend for
@ -208,7 +209,7 @@ void BoxRenderParams::setTexture(ITexture* image)
{
if (image == NULL)
{
fprintf(stderr, "/!\\ WARNING: missing image in skin\n");
Log::error("skin", "/!\\ WARNING: missing image in skin\n");
return;
}
@ -288,7 +289,7 @@ X##_yflip.LowerRightCorner.Y = y1;}
Skin::Skin(IGUISkin* fallback_skin)
{
std::string skin_name = file_manager->getGUIDir();
skin_name += "/skins/";
skin_name += "skins/";
skin_name += UserConfigParams::m_skin_file.c_str();
try
@ -302,7 +303,7 @@ Skin::Skin(IGUISkin* fallback_skin)
UserConfigParams::m_skin_file.revertToDefaults();
skin_name = file_manager->getGUIDir();
skin_name += "/skins/";
skin_name += "skins/";
skin_name += UserConfigParams::m_skin_file.c_str();
SkinConfig::loadFromFile( skin_name );
}
@ -392,7 +393,6 @@ void Skin::drawBoxFromStretchableTexture(SkinWidgetContainer* w,
w->m_skin_y = dest.UpperLeftCorner.Y;
w->m_skin_w = dest.getWidth();
w->m_skin_h = dest.getHeight();
//std::cout << "widget moved, calculating again\n";
}
const ITexture* source = params.getImage();
@ -1207,11 +1207,6 @@ void Skin::drawSpinnerBody(const core::recti &rect, Widget* widget,
center.Y + (int)(((int)rect.UpperLeftCorner.Y
- (int)center.Y)*texture_size);
//std::cout << "y is " << center.Y << " + (" << rect.UpperLeftCorner.Y
// << " - " << center.Y << ")*" << texture_size << " = "
// << center.Y + (int)((rect.UpperLeftCorner.Y - center.Y)*
// texture_size) << std::endl;
sized_rect.LowerRightCorner.X =
center.X + (int)(((int)rect.LowerRightCorner.X
- (int)center.X)*texture_size);
@ -1277,9 +1272,6 @@ void Skin::drawSpinnerChild(const core::recti &rect, Widget* widget,
Widget* spinner = widget->m_event_handler;
int areas = 0;
//std::cout << "drawing spinner child "
// << widget->m_properties[PROP_ID].c_str() << std::endl;
if (widget->m_properties[PROP_ID] == "left")
areas = BoxRenderParams::LEFT;
else if (widget->m_properties[PROP_ID] == "right")
@ -1365,28 +1357,12 @@ void Skin::drawIconButton(const core::recti &rect, Widget* widget,
center.Y + (int)(((int)rect.UpperLeftCorner.Y
- (int)center.Y)*texture_size);
//std::cout << "y is " << center.Y << " + (" << rect.UpperLeftCorner.Y
// << " - " << center.Y << ")*" << texture_size << " = "
// << center.Y + (int)((rect.UpperLeftCorner.Y - center.Y)
// *texture_size) << std::endl;
sized_rect.LowerRightCorner.X =
center.X + (int)(((int)rect.LowerRightCorner.X
- (int)center.X)*texture_size);
sized_rect.LowerRightCorner.Y =
center.Y + (int)(((int)rect.LowerRightCorner.Y
- (int)center.Y)*texture_size);
/*
std::cout << texture_size << " : " << rect.UpperLeftCorner.X
<< ", " << rect.UpperLeftCorner.Y << " : " <<
rect.LowerRightCorner.X << ", " << rect.LowerRightCorner.Y
<< " ---> " <<
sized_rect.UpperLeftCorner.X << ", "
<< sized_rect.UpperLeftCorner.Y << " : " <<
sized_rect.LowerRightCorner.X << ", "
<< sized_rect.LowerRightCorner.Y << std::endl;
*/
}
IconButtonWidget* icon_widget = (IconButtonWidget*) widget;
@ -1775,17 +1751,6 @@ void Skin::process3DPane(IGUIElement *element, const core::recti &rect,
const bool focused =
GUIEngine::isFocusedForPlayer(widget, PLAYER_ID_GAME_MASTER);
/*
std::cout << "Skin (3D Pane) : " << (widget == NULL ? "NULL!!" :
widget->m_properties[PROP_ID].c_str())
<< std::endl;
if (widget == NULL) std::cout << "Null widget: ID=" << id << " type="
<< element->getTypeName() <<
" x=" << rect.UpperLeftCorner.X <<
" y=" << rect.UpperLeftCorner.Y <<
" w=" << rect.getWidth() << " h=" << rect.getHeight() << std::endl;
*/
if (widget == NULL) return;
@ -2157,7 +2122,6 @@ core::recti Skin::draw3DWindowBackground(IGUIElement *element,
void Skin::draw3DMenuPane (IGUIElement *element, const core::recti &rect,
const core::recti *clip)
{
//printf("draw menu pane\n");
} // draw3DMenuPane
// -----------------------------------------------------------------------------
@ -2166,7 +2130,6 @@ void Skin::draw3DTabBody (IGUIElement *element, bool border, bool background,
const core::recti &rect, const core::recti *clip,
s32 tabHeight, gui::EGUI_ALIGNMENT alignment)
{
//printf("draw tab body\n");
} // draw3DTabBody
// -----------------------------------------------------------------------------
@ -2175,7 +2138,6 @@ void Skin::draw3DTabButton (IGUIElement *element, bool active,
const core::recti &rect, const core::recti *clip,
gui::EGUI_ALIGNMENT alignment)
{
//printf("draw tab button\n");
} // draw3DTabButton
// -----------------------------------------------------------------------------
@ -2336,14 +2298,11 @@ void Skin::setIcon (EGUI_DEFAULT_ICON icon, u32 index)
void Skin::setSize (EGUI_DEFAULT_SIZE which, s32 texture_size)
{
m_fallback_skin->setSize(which, texture_size);
//printf("setting size\n");
} // setSize
// -----------------------------------------------------------------------------
void Skin::setSpriteBank (IGUISpriteBank *bank)
{
//printf("setting sprite bank\n");
m_fallback_skin->setSpriteBank(bank);
//this->m_bank = bank;
} // setSpriteBank

View File

@ -193,11 +193,11 @@ void FileManager::reInit()
{
m_file_system = irr_driver->getDevice()->getFileSystem();
m_file_system->grab();
TrackManager::addTrackSearchDir(m_root_dir+"data/tracks");
KartPropertiesManager::addKartSearchDir(m_root_dir+"data/karts");
TrackManager::addTrackSearchDir(m_root_dir+"data/tracks/");
KartPropertiesManager::addKartSearchDir(m_root_dir+"data/karts/");
pushTextureSearchPath(getTextureDir());
pushTextureSearchPath(getTextureDir()+"/deprecated");
pushTextureSearchPath(m_root_dir+"data/gui");
pushTextureSearchPath(getTextureDir()+"/deprecated/");
pushTextureSearchPath(m_root_dir+"data/gui/");
pushModelSearchPath (m_root_dir+"data/models/" );
pushMusicSearchPath (m_root_dir+"data/music/" );
@ -397,7 +397,7 @@ bool FileManager::findFile(std::string& full_path,
i = search_path.rbegin();
i != search_path.rend(); ++i)
{
full_path = *i + "/" + file_name;
full_path = *i + file_name;
if(m_file_system->existFile(full_path.c_str())) return true;
}
full_path="";
@ -459,7 +459,7 @@ std::string FileManager::getTextureDir() const
*/
std::string FileManager::getTranslationDir() const
{
return m_root_dir+"data/po";
return m_root_dir+"data/po/";
} // getTranslationDir
//-----------------------------------------------------------------------------
@ -849,8 +849,12 @@ std::string FileManager::getTutorialFile(const std::string &file_name) const
bool FileManager::isDirectory(const std::string &path) const
{
struct stat mystat;
if(stat(path.c_str(), &mystat) < 0) return false;
std::string s(path);
// At least on windows stat returns an error if there is
// a '/' at the end of the path.
if(s[s.size()-1]=='/')
s.erase(s.end()-1, s.end());
if(stat(s.c_str(), &mystat) < 0) return false;
return S_ISDIR(mystat.st_mode);
} // isDirectory
@ -875,7 +879,10 @@ void FileManager::listFiles(std::set<std::string>& result,
std::string path = is_full_path ? dir + "/" : m_root_dir+"/"+dir + "/";
#endif
if(!isDirectory(path)) return;
#ifndef ANDROID
if(!isDirectory(path))
return;
#endif
io::path previous_cwd = m_file_system->getWorkingDirectory();

View File

@ -1135,9 +1135,9 @@ void initRest()
highscore_manager = new HighscoreManager ();
network_manager = new NetworkManager ();
KartPropertiesManager::addKartSearchDir(
file_manager->getAddonsFile("karts"));
file_manager->getAddonsFile("karts/"));
track_manager->addTrackSearchDir(
file_manager->getAddonsFile("tracks"));
file_manager->getAddonsFile("tracks/"));
track_manager->loadTrackList();
music_manager->addMusicToTracks();
@ -1270,7 +1270,7 @@ int main(int argc, char *argv[] )
main_loop = new MainLoop();
material_manager -> loadMaterial ();
GUIEngine::addLoadingIcon( irr_driver->getTexture(
file_manager->getGUIDir() + "/options_video.png") );
file_manager->getGUIDir() + "options_video.png") );
kart_properties_manager -> loadAllKarts ();
unlock_manager = new UnlockManager();
//m_tutorial_manager = new TutorialManager();
@ -1298,14 +1298,14 @@ int main(int argc, char *argv[] )
ItemManager::loadDefaultItemMeshes();
GUIEngine::addLoadingIcon( irr_driver->getTexture(
file_manager->getGUIDir() + "/gift.png") );
file_manager->getGUIDir() + "gift.png") );
file_manager->popTextureSearchPath();
attachment_manager -> loadModels ();
GUIEngine::addLoadingIcon( irr_driver->getTexture(
file_manager->getGUIDir() + "/banana.png") );
file_manager->getGUIDir() + "banana.png") );
//handleCmdLine() needs InitTuxkart() so it can't be called first
if(!handleCmdLine(argc, argv)) exit(0);

View File

@ -226,7 +226,7 @@ void TrackInfoDialog::updateHighScores()
line = _("(Empty)");
ITexture* no_kart_texture = irr_driver->getTexture(
(file_manager->getGUIDir() + "/random_kart.png").c_str() ) ;
(file_manager->getGUIDir() + "random_kart.png").c_str() ) ;
m_kart_icons[n]->setImage(no_kart_texture);
}

View File

@ -227,7 +227,7 @@ void FeatureUnlockedCutScene::addUnlockedPicture(irr::video::ITexture* picture,
{
std::cerr << "[FeatureUnlockedCutScene::addUnlockedPicture] WARNING: unlockable has no picture : "
<< core::stringc(msg.c_str()).c_str() << "\n";
picture = irr_driver->getTexture(file_manager->getGUIDir() + "/main_help.png");
picture = irr_driver->getTexture(file_manager->getGUIDir() + "main_help.png");
}
@ -619,7 +619,7 @@ void FeatureUnlockedCutScene::addUnlockedGP(const GrandPrixData* gp)
if (gp == NULL)
{
std::cerr << "ERROR: Unlocked GP does not exist???\n";
video::ITexture* WTF_image = irr_driver->getTexture( file_manager->getGUIDir() + "/main_help.png");
video::ITexture* WTF_image = irr_driver->getTexture( file_manager->getGUIDir() + "main_help.png");
images.push_back(WTF_image);
}
else
@ -630,7 +630,7 @@ void FeatureUnlockedCutScene::addUnlockedGP(const GrandPrixData* gp)
if (trackAmount == 0)
{
std::cerr << "ERROR: Unlocked GP is empty???\n";
video::ITexture* WTF_image = irr_driver->getTexture( file_manager->getGUIDir() + "/main_help.png");
video::ITexture* WTF_image = irr_driver->getTexture( file_manager->getGUIDir() + "main_help.png");
images.push_back(WTF_image);
}
@ -681,7 +681,7 @@ void FeatureUnlockedCutScene::addUnlockedThings(const std::vector<const Challeng
if (gp == NULL)
{
std::cerr << "ERROR: Unlocked GP does not exist???\n";
video::ITexture* WTF_image = irr_driver->getTexture( file_manager->getGUIDir() + "/main_help.png");
video::ITexture* WTF_image = irr_driver->getTexture( file_manager->getGUIDir() + "main_help.png");
images.push_back(WTF_image);
}
else
@ -692,7 +692,7 @@ void FeatureUnlockedCutScene::addUnlockedThings(const std::vector<const Challeng
if (trackAmount == 0)
{
std::cerr << "ERROR: Unlocked GP is empty???\n";
video::ITexture* WTF_image = irr_driver->getTexture( file_manager->getGUIDir() + "/main_help.png");
video::ITexture* WTF_image = irr_driver->getTexture( file_manager->getGUIDir() + "main_help.png");
images.push_back(WTF_image);
}
@ -732,7 +732,7 @@ void FeatureUnlockedCutScene::addUnlockedThings(const std::vector<const Challeng
video::ITexture* tex =
irr_driver->getTexture(file_manager->getGUIDir() +
"/main_help.png" );
"main_help.png" );
addUnlockedPicture(tex, 1.0f, 0.75f,
L"???" );
}
@ -751,7 +751,7 @@ void FeatureUnlockedCutScene::addUnlockedThings(const std::vector<const Challeng
//TODO : implement difficulty reward
std::cerr << "OK, I see you unlocked a difficulty, but this is not supported yet\n";
video::ITexture* tex = irr_driver->getTexture( file_manager->getGUIDir() + "/main_help.png");
video::ITexture* tex = irr_driver->getTexture( file_manager->getGUIDir() + "main_help.png");
addUnlockedPicture( tex, 1.0f, 0.75f,
unlockedFeatures[i].getUnlockedMessage() );
break;
@ -830,3 +830,4 @@ MusicInformation* FeatureUnlockedCutScene::getInGameMenuMusic() const
MusicInformation* mi = music_manager->getMusicInformation("win_theme.music");
return mi;
}

View File

@ -55,9 +55,9 @@ OptionsScreenInput::OptionsScreenInput() : Screen("options_input.stkgui")
void OptionsScreenInput::loadedFromFile()
{
video::ITexture* icon1 = irr_driver->getTexture( file_manager->getGUIDir() + "/keyboard.png" );
video::ITexture* icon2 = irr_driver->getTexture( file_manager->getGUIDir() + "/gamepad.png" );
video::ITexture* icon3 = irr_driver->getTexture( file_manager->getGUIDir() + "/gamepad_off.png" );
video::ITexture* icon1 = irr_driver->getTexture( file_manager->getGUIDir() + "keyboard.png" );
video::ITexture* icon2 = irr_driver->getTexture( file_manager->getGUIDir() + "gamepad.png" );
video::ITexture* icon3 = irr_driver->getTexture( file_manager->getGUIDir() + "gamepad_off.png" );
m_icon_bank = new irr::gui::STKModifiedSpriteBank( GUIEngine::getGUIEnv() );
m_icon_bank->addTextureAsSprite(icon1);

View File

@ -69,7 +69,7 @@ void OptionsScreenUI::loadedFromFile()
skinSelector->clearLabels();
std::set<std::string> skinFiles;
file_manager->listFiles(skinFiles /* out */, file_manager->getGUIDir() + "/skins",
file_manager->listFiles(skinFiles /* out */, file_manager->getGUIDir() + "skins",
true /* is full path */, true /* make full path */ );
for (std::set<std::string>::iterator it = skinFiles.begin(); it != skinFiles.end(); it++)

View File

@ -143,12 +143,12 @@ void TrackManager::loadTrackList()
// Then see if a subdir of this dir contains tracks
// ------------------------------------------------
std::set<std::string> dirs;
file_manager->listFiles(dirs, dir, /*is_ileull_path*/ true);
file_manager->listFiles(dirs, dir, /*is_full_path*/ true);
for(std::set<std::string>::iterator subdir = dirs.begin();
subdir != dirs.end(); subdir++)
{
if(*subdir=="." || *subdir=="..") continue;
loadTrack(dir+"/"+*subdir);
loadTrack(dir+*subdir);
} // for dir in dirs
} // for i <m_track_search_path.size()
} // loadTrackList