From 89be1069a78e858f431112d6b0bc8423a6da6aa3 Mon Sep 17 00:00:00 2001 From: cc9cii Date: Mon, 14 Apr 2014 18:31:46 +1000 Subject: [PATCH 1/2] Bug #1260: show thief.dds image for a custom class level up menu --- apps/openmw/mwgui/levelupdialog.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwgui/levelupdialog.cpp b/apps/openmw/mwgui/levelupdialog.cpp index 2f11a4d12..cd72f5677 100644 --- a/apps/openmw/mwgui/levelupdialog.cpp +++ b/apps/openmw/mwgui/levelupdialog.cpp @@ -131,7 +131,14 @@ namespace MWGui const ESM::Class *cls = world->getStore().get().find(playerData->mClass); - mClassImage->setImageTexture ("textures\\levelup\\" + cls->mId + ".dds"); + // Vanilla uses thief.dds for custom classes. A player with a custom class + // doesn't have mId set, see mwworld/esmstore.hpp where it is initialised as + // "$dynamic0". This check should resolve bug #1260. + if(world->getStore().get().isDynamic(cls->mId)) + mClassImage->setImageTexture ("textures\\levelup\\thief.dds"); + else + mClassImage->setImageTexture ("textures\\levelup\\" + cls->mId + ".dds"); + int level = creatureStats.getLevel ()+1; mLevelText->setCaptionWithReplacing("#{sLevelUpMenu1} " + boost::lexical_cast(level)); From 1fc030653fb9c3b25dc96ee5ac202a5eb5778d4c Mon Sep 17 00:00:00 2001 From: cc9cii Date: Tue, 15 Apr 2014 22:30:41 +1000 Subject: [PATCH 2/2] Avoid hard coding "thief.dds" string. --- apps/openmw/mwgui/levelupdialog.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwgui/levelupdialog.cpp b/apps/openmw/mwgui/levelupdialog.cpp index cd72f5677..5a3fc2855 100644 --- a/apps/openmw/mwgui/levelupdialog.cpp +++ b/apps/openmw/mwgui/levelupdialog.cpp @@ -134,12 +134,20 @@ namespace MWGui // Vanilla uses thief.dds for custom classes. A player with a custom class // doesn't have mId set, see mwworld/esmstore.hpp where it is initialised as // "$dynamic0". This check should resolve bug #1260. + // Choosing Stealth specialization and Speed/Agility as attributes. if(world->getStore().get().isDynamic(cls->mId)) - mClassImage->setImageTexture ("textures\\levelup\\thief.dds"); + { + MWWorld::SharedIterator it = world->getStore().get().begin(); + for(; it != world->getStore().get().end(); it++) + { + if(it->mData.mIsPlayable && it->mData.mSpecialization == 2 && it->mData.mAttribute[0] == 4 && it->mData.mAttribute[1] == 3) + break; + } + mClassImage->setImageTexture ("textures\\levelup\\" + it->mId + ".dds"); + } else mClassImage->setImageTexture ("textures\\levelup\\" + cls->mId + ".dds"); - int level = creatureStats.getLevel ()+1; mLevelText->setCaptionWithReplacing("#{sLevelUpMenu1} " + boost::lexical_cast(level));