예제 #1
0
//affichage copié et modifié de la version Particle, peut-être pas la méthode la plus efficace
void MassiveParticle::print(ostream &stream) const {
    stream << "MassiveParticle at : ";
    int i;
    for(i = 0 ; i < 3 ; i++) {
        stream << m_position[i] << "   ";
    }
    stream << endl << "speed, mass, kinectic e : " << getvel() << "   " << getmass() << "   " << getke() << endl;
}
예제 #2
0
파일: doship.c 프로젝트: uhuntgx00/GB
void domass(shiptype *ship)
{
    double rmass;
    int sh;

    rmass = races[ship->owner-1]->mass;

    sh = ship->ships;
    ship->mass = 0.0;
    ship->hanger = 0;
    while(sh) {
        domass(ships[sh]);	/* recursive call */
        ship->mass += ships[sh]->mass;
        ship->hanger += ships[sh]->size;
        sh = ships[sh]->nextship;
    }
    ship->mass += getmass(ship);
    ship->mass += (double)(ship->popn+ship->troops) * rmass;
    ship->mass += (double)ship->destruct * MASS_DESTRUCT;
    ship->mass += ship->fuel * MASS_FUEL;
    ship->mass += (double)ship->resource * MASS_RESOURCE;
}