void Woman::update() { elapsedTime = GetNowCount() - beginTime; if (elapsedTime > 20000) { this->isVisible = false; } if (!isVisible)return; Vector2 target = Vector2(500,335); target -= this->getPosition(); if (target.length() < 1) { gamemodes->sceneMode = 2; } target *= (1.0/target.length()); Vector2 newPos = this->getPosition() - target; for (std::list<Botch>::iterator itr = this->botches->begin(); itr != this->botches->end(); itr++) { Botch b = *itr; if (!b.isVisible)continue; Vector2 dist = b.getPosition()-newPos; if (dist.length() < 100) { Vector2 newDist = Vector2(-dist.y, dist.x); newPos = this->getPosition() - newDist; } } this->setPosition(newPos); }
int main() { try{ Botch b; b.f(); } catch(...) { cout << "inside catch(...)" << endl; } } ///:~
int main() throw(Botch::Fruit, Botch::Orange) { set_unexpected(hb_unexpected); //5- //terminate(); //7- //throw 7; //unexpected and terminate are called if int is not in execption list //throw 7; //terminate is called otherwise try { Botch b; //4- //throw; try { //7- throw 7; //unexpected is called b.f(); } catch(Botch::Fruit & f) { cout << "inside catch1(...)" << endl; f.x=5; //6- //throw f; throw; } } catch(Botch::Orange & f) { cout << "inside catch2(orange)" <<f.x<< endl; } catch(Botch::Apple & f) { cout << "inside catch2(Apple)" << endl; } catch(Botch::Fruit & f) { cout << "inside catch2(Fruit)" <<f.x<< endl; } catch(...) { cout << "inside catch2(...)" << endl; } return 0; } ///:~