check if any menu item selected, deal with more warnings

completely resolves #3
master
poikilos 2019-04-11 02:39:12 -04:00
parent 5b0dcc46dc
commit 54ff9333e2
2 changed files with 33 additions and 31 deletions

View File

@ -158,40 +158,42 @@ void UserInterface::displayLoadTextureDialog()
void UserInterface::handleMenuItemPressed( IGUIContextMenu *menu ) void UserInterface::handleMenuItemPressed( IGUIContextMenu *menu )
{ {
s32 id = menu->getItemCommandId( menu->getSelectedItem() ); s32 selected = menu->getSelectedItem();
if (selected > -1) {
s32 id = menu->getItemCommandId(static_cast<u32>(selected));
switch( id ) switch( id )
{ {
case UIC_FILE_LOAD: case UIC_FILE_LOAD:
displayLoadFileDialog(); displayLoadFileDialog();
break; break;
case UIC_FILE_LOAD_TEXTURE: case UIC_FILE_LOAD_TEXTURE:
displayLoadTextureDialog(); displayLoadTextureDialog();
break; break;
case UIC_FILE_QUIT: case UIC_FILE_QUIT:
m_Engine->m_RunEngine = false; m_Engine->m_RunEngine = false;
break; break;
case UIC_VIEW_WIREFRAME: case UIC_VIEW_WIREFRAME:
m_WireframeDisplay = viewMenu->isItemChecked(INDEX_VIEW_WIREFRAME_MESH); m_WireframeDisplay = viewMenu->isItemChecked(INDEX_VIEW_WIREFRAME_MESH);
m_Engine->setMeshDisplayMode(m_WireframeDisplay, m_Lighting, m_TextureInterpolation); m_Engine->setMeshDisplayMode(m_WireframeDisplay, m_Lighting, m_TextureInterpolation);
break; break;
case UIC_VIEW_LIGHTING: case UIC_VIEW_LIGHTING:
m_Lighting = viewMenu->isItemChecked(INDEX_VIEW_LIGHTING); m_Lighting = viewMenu->isItemChecked(INDEX_VIEW_LIGHTING);
m_Engine->setMeshDisplayMode(m_WireframeDisplay, m_Lighting, m_TextureInterpolation); m_Engine->setMeshDisplayMode(m_WireframeDisplay, m_Lighting, m_TextureInterpolation);
break; break;
case UIC_VIEW_TEXTURE_INTERPOLATION: case UIC_VIEW_TEXTURE_INTERPOLATION:
m_TextureInterpolation = viewMenu->isItemChecked(INDEX_VIEW_TEXTURE_INTERPOLATION); m_TextureInterpolation = viewMenu->isItemChecked(INDEX_VIEW_TEXTURE_INTERPOLATION);
m_Engine->setMeshDisplayMode(m_WireframeDisplay, m_Lighting, m_TextureInterpolation); m_Engine->setMeshDisplayMode(m_WireframeDisplay, m_Lighting, m_TextureInterpolation);
break; break;
}
} }
} }
// PUBLIC // PUBLIC

View File

@ -37,7 +37,7 @@ void Utility::dumpMeshInfoToConsole( IAnimatedMeshSceneNode *node )
debug() << "[MESH]: # of frames : " << mesh->getFrameCount() << endl; debug() << "[MESH]: # of frames : " << mesh->getFrameCount() << endl;
debug() << "[MESH]: # of materials : " << node->getMaterialCount() << endl; debug() << "[MESH]: # of materials : " << node->getMaterialCount() << endl;
for( int matIndex = 0; matIndex < node->getMaterialCount(); matIndex ++ ) for( irr::u32 matIndex = 0; matIndex < node->getMaterialCount(); matIndex ++ )
{ {
debug() << "[MESH]: Material # " << matIndex << endl; debug() << "[MESH]: Material # " << matIndex << endl;
const SMaterial &material = node->getMaterial( matIndex ); const SMaterial &material = node->getMaterial( matIndex );
@ -47,7 +47,7 @@ void Utility::dumpMeshInfoToConsole( IAnimatedMeshSceneNode *node )
// check for # textures // check for # textures
int textures = 0; int textures = 0;
for( int ti = 0; ti < MATERIAL_MAX_TEXTURES; ti ++ ) for( irr::u32 ti = 0; ti < MATERIAL_MAX_TEXTURES; ti ++ )
if( material.getTexture( ti ) != nullptr ) textures ++; if( material.getTexture( ti ) != nullptr ) textures ++;
debug() << "[MESH]: # of textures : " << textures << endl; debug() << "[MESH]: # of textures : " << textures << endl;
} }
@ -62,7 +62,7 @@ std::wstring Utility::parentOfPath(const wstring &path)
else { else {
std::wstring::size_type lastSlashPos = path.find_last_of(L"/"); std::wstring::size_type lastSlashPos = path.find_last_of(L"/");
if (lastSlashPos == std::wstring::npos) { if (lastSlashPos == std::wstring::npos) {
std::wstring::size_type lastSlashPos = path.find_last_of(L"\\"); lastSlashPos = path.find_last_of(L"\\");
} }
if (lastSlashPos != std::wstring::npos) { if (lastSlashPos != std::wstring::npos) {
ret = path.substr(0, lastSlashPos); ret = path.substr(0, lastSlashPos);
@ -76,7 +76,7 @@ wstring Utility::basename(const wstring &path)
std::wstring ret = path; std::wstring ret = path;
std::wstring::size_type lastSlashPos = path.find_last_of(L"/"); std::wstring::size_type lastSlashPos = path.find_last_of(L"/");
if (lastSlashPos == std::wstring::npos) { if (lastSlashPos == std::wstring::npos) {
std::wstring::size_type lastSlashPos = path.find_last_of(L"\\"); lastSlashPos = path.find_last_of(L"\\");
} }
if (lastSlashPos != std::wstring::npos) { if (lastSlashPos != std::wstring::npos) {
ret = path.substr(lastSlashPos+1); ret = path.substr(lastSlashPos+1);
@ -91,7 +91,7 @@ wstring Utility::withoutExtension(const wstring &path)
if (lastDotPos != std::wstring::npos) { if (lastDotPos != std::wstring::npos) {
std::wstring::size_type lastSlashPos = path.find_last_of(L"/"); std::wstring::size_type lastSlashPos = path.find_last_of(L"/");
if (lastSlashPos == std::wstring::npos) { if (lastSlashPos == std::wstring::npos) {
std::wstring::size_type lastSlashPos = path.find_last_of(L"\\"); lastSlashPos = path.find_last_of(L"\\");
} }
if (lastSlashPos != std::wstring::npos) { if (lastSlashPos != std::wstring::npos) {
if (lastDotPos > lastSlashPos) ret = path.substr(0, lastDotPos); if (lastDotPos > lastSlashPos) ret = path.substr(0, lastDotPos);
@ -108,7 +108,7 @@ wstring Utility::extensionOf(const wstring &path)
if (lastDotPos != std::wstring::npos) { if (lastDotPos != std::wstring::npos) {
std::wstring::size_type lastSlashPos = path.find_last_of(L"/"); std::wstring::size_type lastSlashPos = path.find_last_of(L"/");
if (lastSlashPos == std::wstring::npos) { if (lastSlashPos == std::wstring::npos) {
std::wstring::size_type lastSlashPos = path.find_last_of(L"\\"); lastSlashPos = path.find_last_of(L"\\");
} }
if (lastSlashPos != std::wstring::npos) { if (lastSlashPos != std::wstring::npos) {
if (lastDotPos > lastSlashPos) ret = path.substr(lastDotPos + 1); if (lastDotPos > lastSlashPos) ret = path.substr(lastDotPos + 1);