| 247 | } |
| 248 | |
| 249 | void CommandManager::Populator::DoBeginGroup( |
| 250 | const MenuRegistry::GroupItem<MenuRegistry::Traits> &item) |
| 251 | { |
| 252 | using namespace MenuRegistry; |
| 253 | auto pItem = &item; |
| 254 | if (const auto pMenu = dynamic_cast<const MenuItem*>( pItem )) { |
| 255 | const auto &title = pMenu->GetTitle(); |
| 256 | mMenuNames.emplace_back(title); |
| 257 | BeginMenu(title); |
| 258 | } |
| 259 | else if (const auto pConditionalGroup = |
| 260 | dynamic_cast<const ConditionalGroupItem*>( pItem ) |
| 261 | ) { |
| 262 | const auto flag = (*pConditionalGroup)(); |
| 263 | if (!flag) { |
| 264 | bMakingOccultCommands = true; |
| 265 | BeginOccultCommands(); |
| 266 | } |
| 267 | // to avoid repeated call of condition predicate in EndGroup(): |
| 268 | mFlags.push_back(flag); |
| 269 | } |
| 270 | else |
| 271 | assert(IsSection(item)); |
| 272 | } |
| 273 | |
| 274 | void CommandManager::Populator::DoVisit(const Registry::SingleItem &item) |
| 275 | { |