Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/WorldAction/BoundInBoxAction.cpp

    r623e89 r047878  
    66 */
    77
     8#include "Helpers/MemDebug.hpp"
     9
    810#include "Actions/WorldAction/BoundInBoxAction.hpp"
     11#include "Actions/ActionRegistry.hpp"
    912#include "log.hpp"
    1013#include "molecule.hpp"
     
    1922#include "UIElements/UIFactory.hpp"
    2023#include "UIElements/Dialog.hpp"
    21 #include "Actions/MapOfActions.hpp"
     24#include "UIElements/ValueStorage.hpp"
    2225
    2326const char WorldBoundInBoxAction::NAME[] = "bound-in-box";
     
    3033{}
    3134
     35void WorldBoundInBox() {
     36  ActionRegistry::getInstance().getActionByName(WorldBoundInBoxAction::NAME)->call(Action::NonInteractive);
     37};
     38
     39Dialog* WorldBoundInBoxAction::fillDialog(Dialog *dialog) {
     40  ASSERT(dialog,"No Dialog given when filling action dialog");
     41
     42  dialog->queryEmpty(NAME, ValueStorage::getInstance().getDescription(NAME));
     43
     44  return dialog;
     45}
     46
    3247Action::state_ptr WorldBoundInBoxAction::performCall() {
    33   Dialog *dialog = UIFactory::getInstance().makeDialog();
    3448
    35   dialog->queryEmpty(NAME, MapOfActions::getInstance().getDescription(NAME));
    36 
    37   if(dialog->display()) {
    38     // center
    39     vector<molecule*> AllMolecules = World::getInstance().getAllMolecules();
    40     for (vector<molecule*>::iterator MolRunner = AllMolecules.begin(); MolRunner != AllMolecules.end(); ++MolRunner) {
    41       (*MolRunner)->BoundInBox();
    42     }
    43     delete dialog;
    44     return Action::success;
    45   } else {
    46     delete dialog;
    47     return Action::failure;
     49  // center
     50  vector<molecule*> AllMolecules = World::getInstance().getAllMolecules();
     51  for (vector<molecule*>::iterator MolRunner = AllMolecules.begin(); MolRunner != AllMolecules.end(); ++MolRunner) {
     52    (*MolRunner)->BoundInBox();
    4853  }
     54  return Action::success;
    4955}
    5056
Note: See TracChangeset for help on using the changeset viewer.