当前位置: 首页>>代码示例>>C++>>正文


C++ map::add_vehicle方法代码示例

本文整理汇总了C++中map::add_vehicle方法的典型用法代码示例。如果您正苦于以下问题:C++ map::add_vehicle方法的具体用法?C++ map::add_vehicle怎么用?C++ map::add_vehicle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在map的用法示例。


在下文中一共展示了map::add_vehicle方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: builtin_jackknifed_semi

void builtin_jackknifed_semi(map& m, const std::string &terrainid)
{
    const VehicleLocation* loc = vplacement_id(terrainid+"_semi").obj().pick();
    if(! loc) {
        debugmsg("builtin_jackknifed_semi unable to get location to place vehicle. placement %s", (terrainid+"_semi").c_str());
        return;
    }

    int facing = loc->pick_facing();
    point semi_p = loc->pick_point();
    point trailer_p;

    if(facing == 0) {
        trailer_p.x = semi_p.x + 4;
        trailer_p.y = semi_p.y - 10;
    } else if(facing == 90) {
        trailer_p.x = semi_p.x + 12;
        trailer_p.y = semi_p.y + 1;
    } else if(facing == 180) {
        trailer_p.x = semi_p.x - 4;
        trailer_p.y = semi_p.y + 10;
    } else {
        trailer_p.x = semi_p.x - 12;
        trailer_p.y = semi_p.y - 1;
    }

    m.add_vehicle(vgroup_id("semi_truck"), semi_p, (facing + 135) % 360, -1, 1);
    m.add_vehicle(vgroup_id("truck_trailer"), trailer_p, (facing + 90) % 360, -1, 1);
}
开发者ID:Etgfrog,项目名称:Cataclysm-DDA,代码行数:29,代码来源:vehicle_group.cpp

示例2: apply

void VehicleFunction_json::apply(map& m, const std::string &terrain_name) const
{
    for(auto i = number.get(); i > 0; i--) {
        if(! location) {
            size_t replace = placement.find("%t");
            const VehicleLocation* loc = vplacement_id(replace != std::string::npos
                ? placement.substr(0,replace) + terrain_name + placement.substr(replace+2)
                : placement).obj().pick();

            if(! loc) {
                debugmsg("vehiclefunction_json: unable to get location to place vehicle.");
                return;
            }
            m.add_vehicle(vehicle, loc->pick_point(), loc->pick_facing(), fuel, status);
        }
        else {
            m.add_vehicle(vehicle, location->pick_point(), location->pick_facing(), fuel, status);
        }
    }
}
开发者ID:Etgfrog,项目名称:Cataclysm-DDA,代码行数:20,代码来源:vehicle_group.cpp

示例3: builtin_parkinglot

void builtin_parkinglot(map& m, const std::string&)
{
    for(int v = 0; v < rng(1,4); v++) {
        point pos_p;
        pos_p.x = rng(0, 1) * 15 + rng(4,5);
        pos_p.y = rng(0, 4) * 4 + rng(2,4);

        if (!m.veh_at(pos_p.x,pos_p.y)) {
            m.add_vehicle(vgroup_id("parkinglot"), pos_p, (one_in(2)?0:180) + (one_in(10)*rng(0,179)), -1, -1);
        }
    }
}
开发者ID:Etgfrog,项目名称:Cataclysm-DDA,代码行数:12,代码来源:vehicle_group.cpp

示例4: builtin_policepileup

void builtin_policepileup(map& m, const std::string&)
{
    vehicle *last_added_car = NULL;
    int num_cars = rng(18, 22);

    for(int i = 0; i < num_cars; i++) {
        const VehicleLocation* loc = vplacement_id("pileup").obj().pick();
        if(! loc) {
            debugmsg("builtin_policepileup unable to get location to place vehicle.");
            return;
        }

        last_added_car = m.add_vehicle(vgroup_id("policecar"), loc->pick_point(),
            loc->pick_facing(), -1, 1);
    }

    if (last_added_car != NULL) {
        last_added_car->name = _("policecar pile-up");
    }
}
开发者ID:Etgfrog,项目名称:Cataclysm-DDA,代码行数:20,代码来源:vehicle_group.cpp


注:本文中的map::add_vehicle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。