removed duplicates of the cell name function

This commit is contained in:
Marc Zinnschlag 2013-11-26 11:49:07 +01:00
parent bc6fe682c9
commit e6dc927f11
2 changed files with 7 additions and 38 deletions

View file

@ -752,29 +752,18 @@ namespace MWGui
void WindowManager::changeCell(MWWorld::Ptr::CellStore* cell) void WindowManager::changeCell(MWWorld::Ptr::CellStore* cell)
{ {
std::string name = MWBase::Environment::get().getWorld()->getCellName (cell);
mMap->setCellName( name );
mHud->setCellName( name );
if (cell->mCell->isExterior()) if (cell->mCell->isExterior())
{ {
std::string name; if (!cell->mCell->mName.empty())
if (cell->mCell->mName != "")
{
name = cell->mCell->mName;
mMap->addVisitedLocation ("#{sCell=" + name + "}", cell->mCell->getGridX (), cell->mCell->getGridY ()); mMap->addVisitedLocation ("#{sCell=" + name + "}", cell->mCell->getGridX (), cell->mCell->getGridY ());
}
else
{
const ESM::Region* region =
MWBase::Environment::get().getWorld()->getStore().get<ESM::Region>().search(cell->mCell->mRegion);
if (region)
name = region->mName;
else
name = getGameSettingString("sDefaultCellname", "Wilderness");
}
mMap->cellExplored(cell->mCell->getGridX(), cell->mCell->getGridY()); mMap->cellExplored(cell->mCell->getGridX(), cell->mCell->getGridY());
mMap->setCellName( name );
mHud->setCellName( name );
mMap->setCellPrefix("Cell"); mMap->setCellPrefix("Cell");
mHud->setCellPrefix("Cell"); mHud->setCellPrefix("Cell");
mMap->setActiveCell( cell->mCell->getGridX(), cell->mCell->getGridY() ); mMap->setActiveCell( cell->mCell->getGridX(), cell->mCell->getGridY() );
@ -782,12 +771,9 @@ namespace MWGui
} }
else else
{ {
mMap->setCellName( cell->mCell->mName );
mHud->setCellName( cell->mCell->mName );
mMap->setCellPrefix( cell->mCell->mName ); mMap->setCellPrefix( cell->mCell->mName );
mHud->setCellPrefix( cell->mCell->mName ); mHud->setCellPrefix( cell->mCell->mName );
} }
} }
void WindowManager::setInteriorMapTexture(const int x, const int y) void WindowManager::setInteriorMapTexture(const int x, const int y)

View file

@ -77,24 +77,7 @@ void MWState::StateManager::saveGame (const std::string& description, const Slot
profile.mPlayerLevel = player.getClass().getNpcStats (player).getLevel(); profile.mPlayerLevel = player.getClass().getNpcStats (player).getLevel();
profile.mPlayerClass = player.get<ESM::NPC>()->mBase->mClass; profile.mPlayerClass = player.get<ESM::NPC>()->mBase->mClass;
std::string cellName; profile.mPlayerCell = world.getCellName();
if (player.getCell()->mCell->isExterior())
{
if (player.getCell()->mCell->mName != "")
cellName = player.getCell()->mCell->mName;
else
{
const ESM::Region* region =
MWBase::Environment::get().getWorld()->getStore().get<ESM::Region>().search(player.getCell()->mCell->mRegion);
if (region)
cellName = region->mName;
else
cellName = MWBase::Environment::get().getWindowManager()->getGameSettingString("sDefaultCellname", "Wilderness");
}
}
else
cellName = player.getCell()->mCell->mName;
profile.mPlayerCell = cellName;
profile.mInGameTime.mGameHour = world.getTimeStamp().getHour(); profile.mInGameTime.mGameHour = world.getTimeStamp().getHour();
profile.mInGameTime.mDay = world.getDay(); profile.mInGameTime.mDay = world.getDay();