void AreaVisitor::visit( Rectangle & r) { double l = r.getLength(); double b = r.getBreadth(); _area = l * b; printArea( r ); }
void AreaVisitor::visit( Triangle & t) { double b = t.getBase(); double h = t.getHeight(); _area = 0.5 * b * h; printArea( t ); }
void MainModule::start() { srand (time(NULL)); if ( !netMod.initNetwork() ) return; Area * a = new Area( 101, 101 ); worldMod.areaVec.push_back(a); worldMod.areaVec[0]->id = 9; printArea( 0, &worldMod ); std::cout<<"Starting mainloop"<<std::endl; while ( true ) //mainloop { netMod.checkNewConnection(); //check for incoming connections clientMod.playerCheck(); // check player input and send view(); SDL_Delay( DELAY_AMOUNT ); } }
void AreaVisitor::visit( Circle & c) { double r = c.getRadius(); _area = PI * r * r; printArea( c ); }