http://vitas.matfyz.cz/txt/pohadky/pohadka.cpp.html
// pohadka.cpp int main(int args, char *argv[]) { if( args != 1 ) { printf("usage: %s prokoho",argv[0]); exit(1); } if( String(argv[1]) != String("Lenka") ) { printf("Az tu bude Lenka"); exit(-1); } Osoba who(argv[1]); try { pohadka(who); } catch(Osoba::Expection::Spinka e) { who.celo.put_at(new Pusinka(Pusinka::Něžná)); who.postylka.perinka.urovnat(); } return 0; } int pohadka(Osoba &pro_koho = &OS_LENKA) { // setup Osoba princ("Jason"), kral("Mojmir"), princezna("Jasnenka", kral); princ.sendto(kral, Message::PrinceznaRequest); princezna.set_nalada(Temperature::Abs_zero); prinzena.komnata.lock(); Drak * drak_bill = new Drak(5); drak_bill->sendto(kral, Message::PrinceznaRequest); for(int i=100;i--;) { kral.move(Sem); kral.move(Tam); } kral.sendto( Osoba::Everyone, Message::KillDragonRequest | Message::PrinceznaOffer); princ.horse.add(princ); princ.horse.sendto(*drak_bill); try { princ.sendto(*drak_bill, Message::GoHome); } catch(ExtraheatExeption e) { princ.set_nalada(e.temperature * 2); kill_bill(princ, *drak_bill); kill_bill2(princ, *drak_bill); delete(drak_bill); } princezna.komnata.unlock(); while( princezna.vizual_object_analyze(princ) < 0 ) { princezna.komnta.lock(); princ.upgrade(); princezna.komnata.unlock(); } princ.kiss(princezna); return Pohadka::HappyEnd; } void kill_bill(Osoba &uma, Osoba &bill) { while( bill.heads() > 0) { uma.sek(bill); } } void kill_bill2(Osoba &uma, Osoba &bill) { while( bill.size() > 0.1) { uma.sek(bill); } }
http://vitas.matfyz.cz/txt/pohadky/pohadka.cpp.html