void doPortal(const char* user,int x,int y, int z) { int cx=x,cy=y,cz=z; addToDo(user,x,y,z); while(blockToDo.size()>0) { doPortalFromFrame(user, blockToDo[0]->x, blockToDo[0]->y, blockToDo[0]->z); blockDone.push_back(blockToDo[0]); blockToDo.erase(blockToDo.begin()); cz ++; } for(size_t i = 0; i < blockDone.size(); i++) { delete blockDone[i]; } blockDone.clear(); }
void PapyrusDesktop::init_mainWidget() { p->panel = new PanelBox(); p->papers_view = new PapersView(); p->editor = new EditorViewManager(); SColor titleBarColor = p->desktop->titleBarColor(); if( p->desktop->titleBarIsDark() ) titleBarColor = titleBarColor*1.3; QPalette palette; palette.setColor( QPalette::Window, titleBarColor ); palette.setColor( QPalette::WindowText, p->desktop->titleBarTextColor() ); p->tabbar = p->editor->tabBar(); p->tabbar->setStyle( QStyleFactory::create("Fusion") ); p->tabbar->setDrawBase(false); p->tabbar->setPalette(palette); p->tabbar_layout->addWidget(p->tabbar); p->splitter = new QSplitter(); p->splitter->addWidget(p->panel); p->splitter->addWidget(p->papers_view); p->splitter->addWidget(p->editor); p->splitter->setStyleSheet("QSplitter::handle{background: #f3f3f3}"); p->splitter->setSizes( QList<int>()<< 213 << 273 << width()-486 ); p->splitter->restoreState( p->papyrus->settings()->value("UserInterface/splitter").toByteArray() ); p->main_layout->addWidget(p->splitter); p->sync_pbar = new QProgressBar(p->main_widget); p->sync_pbar->resize( p->editor->width(), SYNC_PBAR_HEIGHT ); p->sync_pbar->move( width()-p->sync_pbar->width(), height()-SYNC_PBAR_HEIGHT ); p->sync_pbar->setTextVisible(false); p->sync_pbar->setVisible(false); connect( p->splitter , SIGNAL(splitterMoved(int,int)) , this , SLOT(save_splitter()) ); connect( p->panel , SIGNAL(showPaperRequest(QList<int>)), p->papers_view, SLOT(showPapers(QList<int>)) ); connect( p->papers_view , SIGNAL(paperSelected(int)) , p->editor , SLOT(setMainPaper(int)) ); connect( p->papers_view , SIGNAL(paperOpened(int)) , p->editor , SLOT(addPaper(int)) ); connect( p->new_act , SIGNAL(triggered()) , p->editor , SLOT(addPaper()) ); connect( p->new_todo_act, SIGNAL(triggered()) , p->editor , SLOT(addToDo()) ); connect( p->new_grp_act , SIGNAL(triggered()) , this , SLOT(addGroup()) ); connect( p->rsync_act , SIGNAL(triggered()) , this , SLOT(refreshSync()) ); connect( p->conf_act , SIGNAL(triggered()) , this , SLOT(showConfigure()) ); connect( p->about_act , SIGNAL(triggered()) , this , SLOT(showAbout()) ); }
void doPortalFromFrame(const char* user, int x,int y, int z) { bool up=false,down=false,left=false,right=false,forward=false,backward=false; for(int c=1; c<10; c++) // Yes, we start at 1 so we DONT see the start again { if(getBlock(user,x,y+c,z)==49){ up=true; addToDo(user,x,y+c,z);} if(getBlock(user,x,y-c,z)==49){ down=true; addToDo(user,x,y-c,z);} if(getBlock(user,x+c,y,z)==49){ left=true; addToDo(user,x+c,y,z);} if(getBlock(user,x-c,y,z)==49){ right=true; addToDo(user,x-c,y,z);} if(getBlock(user,x,y,z+c)==49){ forward=true; addToDo(user,x,y,z+c);} if(getBlock(user,x,y,z-c)==49){ backward=true; addToDo(user,x,y,z-c);} } for(int c=1; c<10; c++) { if(up) { if(getBlock(user,x,y+c,z)!=49) { setBlock(user,x,y+c,z,90); }else{ up=false; } } if(down) { if(getBlock(user,x,y-c,z)!=49) { setBlock(user,x,y-c,z,90); }else{ down=false; } } if(left) { if(getBlock(user,x+c,y,z)!=49) { setBlock(user,x+c,y,z,90); }else{ left=false; } } if(right) { if(getBlock(user,x-c,y,z)!=49) { setBlock(user,x-c,y,z,90); }else{ right=false; } } if(forward) { if(getBlock(user,x,y,z+c)!=49) { setBlock(user,x,y,z+c,90); }else{ forward=false; } } if(backward) { if(getBlock(user,x,y,z-c)!=49) { setBlock(user,x,y,z-c,90); }else{ backward=false; } } } }