Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Menu::buildMenuBar()
- {
- if( mGUImenuBar )
- {
- mGUIFrame->removeChild( mGUImenuBar );
- delete mGUImenuBar;
- mGUImenuBar = NULL;
- }
- mGUImenuBar = new UIMenuBar();
- mGUImenuBar->AddMenu( "File" );
- mGUImenuBar->GetMenu( "File" )->AddMenuItemSwitch( "exit ESC", &gPop, true );
- mGUIFrame->addChild( mGUImenuBar );
- static const char* typeToName[3] = { "Continent", "Dungeons", "Raid" };
- mGUImenuBar->AddMenu( typeToName[0] );
- mGUImenuBar->AddMenu( typeToName[1] );
- mGUImenuBar->AddMenu( typeToName[2] );
- for( std::vector<MapEntry>::const_iterator it = mMaps.begin(); it != mMaps.end(); ++it )
- {
- mGUImenuBar->GetMenu( typeToName[it->areaType] )->AddMenuItemButton( it->name, &showMap, it->mapID );
- }
- static const size_t nBookmarksPerMenu = 20;
- const size_t nBookmarkMenus = ( mBookmarks.size() / nBookmarksPerMenu ) + 1;
- if( mBookmarks.size() )
- {
- mGUImenuBar->AddMenu( "Bookmarks" );
- }
- for( size_t i = 1; i < nBookmarkMenus; ++i )
- {
- std::stringstream name;
- name << "Bookmarks (" << ( i + 1 ) << ")";
- mGUImenuBar->AddMenu( name.str() );
- }
- int n = -1;
- for( std::vector<BookmarkEntry>::const_iterator it = mBookmarks.begin(); it != mBookmarks.end(); ++it )
- {
- std::stringstream name;
- const int page = ( ++n / nBookmarksPerMenu );
- if( page )
- {
- name << "Bookmarks (" << ( page + 1 ) << ")";
- }
- else
- {
- name << "Bookmarks";
- }
- mGUImenuBar->GetMenu( name.str() )->AddMenuItemButton( it->name, &showBookmark, n );
- }
- }
- void Menu::createMapList()
- {
- for( DBCFile::Iterator i = gMapDB.begin(); i != gMapDB.end(); ++i )
- {
- MapEntry e;
- e.mapID = i->getInt( MapDB::MapID );
- e.name = i->getLocalizedString( MapDB::Name );
- e.areaType = i->getUInt( MapDB::AreaType );
- if( e.areaType < 0 || e.areaType > 2 || !World::IsEditableWorld( e.mapID ) )
- continue;
- mMaps.push_back( e );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement