예제 #1
0
void test_cpp11_tuple()
{
    ///> vs的tuple貌似跟c++标准的用法略有不同
    auto r = GetXyz();
    
    cout<< std::get<0>(r)
        << std::get<1>(r)
        << std::get<2>(r)
        << std::get<3>(r)
        << endl;
}
예제 #2
0
파일: Active.cpp 프로젝트: mmaulwurff/FREG
void Active::UpdateLightRadius(const int old_radius) {
    if ( IsInside() ) return;
    const int radius = LightRadius();
    if ( radius != old_radius ) {
        const XyzInt xyz = GetXyz();
        World* const world = World::GetWorld();
        world->Shine(xyz, -old_radius);
        world->Shine(xyz, radius);
        emit world->UpdatedAround(XYZ(xyz));
    }
    if ( radius && old_radius == 0 ) {
        GetShred()->AddShining(this);
    } else if ( old_radius && radius == 0 ) {
        GetShred()->RemShining(this);
    }
}
예제 #3
0
 void Converter::Damage(const int dmg, const int dmg_kind) {
     World* const world = World::GetWorld();
     if ( dmg_kind == damageKindOn ) {
         if ( not isOn ) {
             isOn = true;
             world->GetShred(X(), Y())->AddShining(this);
             world->Shine(GetXyz(), (lightRadius=CONVERTER_LIGHT_RADIUS));
         } else {
             fuelLevel += dmg;
         }
     } else if ( dmg_kind == damageKindOff ) {
         isOn = false;
         fuelLevel = 0;
         lightRadius = 0;
         world->GetShred(X(), Y())->RemShining(this);
     } else {
         Block::Damage(dmg, dmg_kind);
     }
 }