void CityLordView::mousePressEvent(QMouseEvent * e){ showFieldColor(false, true); startMouse = mapToScene(e->pos()); Location location = isoToLoc(startMouse); if(*sabotageActive){ if(goodLocation(location)){ selectField(location); if(clientManager->getMap()->getCase(location)->isRoad()){ clientManager->setRequest("roadblock"); clientManager->addInfo("row", std::to_string(location.getRow())); clientManager->addInfo("col", std::to_string(location.getCol())); clientManager->sendRequestAndRecv(); openMessageBox("RoadBlock"); } } } else{ if(goodLocation(location)){ selectField(location); if(clientManager->getMap()->getCase(location)->isField()){ dynamic_cast<ClientField*>(clientManager->getMap()->getCase(location))->setShowOwnerColor(true); } } if(goodLocation(previousSelectedLocation) && !previousSelectedLocation.isEqual(location)){ if(clientManager->getMap()->getCase(previousSelectedLocation)->isField()){ dynamic_cast<ClientField*>(clientManager->getMap()->getCase(previousSelectedLocation))->setShowOwnerColor(false); } } previousSelectedLocation = location; } repaintView(); }
void MapRipper::finish() { if(zoom<maxzoom && cancel==false) { ++zoom; if (shouldAutoRip == true && (zoom <= progressForm->maxAutoRipZoom)) { this->doRip(); }else{ if(openMessageBox()) { this->doRip(); }else{ this->stopRipping(); } } } else { this->stopRipping(); } }