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


C++ color_ostream::print方法代码示例

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


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

示例1: printHelp

void printHelp(color_ostream &out) // prints help
{
    out.print(
        "Watches the numbers of seeds available and enables/disables seed and plant cooking.\n"
        "Each plant type can be assigned a limit. If their number falls below,\n"
        "the plants and seeds of that type will be excluded from cookery.\n"
        "If the number rises above the limit + %i, then cooking will be allowed.\n", buffer
        );
    out.printerr(
        "The plugin needs a fortress to be loaded and will deactivate automatically otherwise.\n"
        "You have to reactivate with 'seedwatch start' after you load the game.\n"
        );
    out.print(
        "Options:\n"
        "seedwatch all   - Adds all plants from the abbreviation list to the watch list.\n"
        "seedwatch start - Start watching.\n"
        "seedwatch stop  - Stop watching.\n"
        "seedwatch info  - Display whether seedwatch is watching, and the watch list.\n"
        "seedwatch clear - Clears the watch list.\n\n"
        );
    if(!abbreviations.empty())
    {
        out.print("You can use these abbreviations for the plant tokens:\n");
        for(map<string, string>::const_iterator i = abbreviations.begin(); i != abbreviations.end(); ++i)
        {
            out.print("%s -> %s\n", i->first.c_str(), i->second.c_str());
        }
    }
    out.print(
        "Examples:\n"
        "seedwatch MUSHROOM_HELMET_PLUMP 30\n"
        "  add MUSHROOM_HELMET_PLUMP to the watch list, limit = 30\n"
        "seedwatch MUSHROOM_HELMET_PLUMP\n"
        "  removes MUSHROOM_HELMET_PLUMP from the watch list.\n"
        "seedwatch ph 30\n"
        "  is the same as 'seedwatch MUSHROOM_HELMET_PLUMP 30'\n"
        "seedwatch all 30\n"
        "  adds all plants from the abbreviation list to the watch list, the limit being 30.\n"
        );
};
开发者ID:DocHoncho,项目名称:dfhack,代码行数:40,代码来源:seedwatch.cpp

示例2: df_flows

command_result df_flows (color_ostream &out, vector <string> & parameters)
{
    CoreSuspender suspend;

    int flow1 = 0, flow2 = 0, flowboth = 0, water = 0, magma = 0;
    out.print("Counting flows and liquids ...\n");

    for (size_t i = 0; i < world->map.map_blocks.size(); i++)
    {
        df::map_block *cur = world->map.map_blocks[i];
        if (cur->flags.bits.update_liquid)
            flow1++;
        if (cur->flags.bits.update_liquid_twice)
            flow2++;
        if (cur->flags.bits.update_liquid && cur->flags.bits.update_liquid_twice)
            flowboth++;
        for (int x = 0; x < 16; x++)
        {
            for (int y = 0; y < 16; y++)
            {
                // only count tiles with actual liquid in them
                if (cur->designation[x][y].bits.flow_size == 0)
                    continue;
                if (cur->designation[x][y].bits.liquid_type == tile_liquid::Magma)
                    magma++;
                if (cur->designation[x][y].bits.liquid_type == tile_liquid::Water)
                    water++;
            }
        }
    }

    out.print("Blocks with liquid_1=true: %d\n", flow1);
    out.print("Blocks with liquid_2=true: %d\n", flow2);
    out.print("Blocks with both:          %d\n", flowboth);
    out.print("Water tiles:               %d\n", water);
    out.print("Magma tiles:               %d\n", magma);
    return CR_OK;
}
开发者ID:AtomicChicken,项目名称:dfhack,代码行数:38,代码来源:flows.cpp

示例3: world_specific_hooks

static void world_specific_hooks(color_ostream &out,bool enable)
{
    if(enable && find_reactions(out))
    {
        out.print("Detected reaction hooks - enabling plugin.\n");
        INTERPOSE_HOOK(product_hook, produce).apply(true);
    }
    else
    {
       INTERPOSE_HOOK(product_hook, produce).apply(false);
        reactions.clear();
        products.clear();
    }
}
开发者ID:mstram,项目名称:dfhack-40d,代码行数:14,代码来源:eventful.cpp

示例4: df_rubyload

static command_result df_rubyload(color_ostream &out, std::vector <std::string> & parameters)
{
    if (parameters.size() == 1 && (parameters[0] == "help" || parameters[0] == "?"))
    {
        out.print("This command loads the ruby script whose path is given as parameter, and run it.\n");
        return CR_OK;
    }

    std::string cmd = "load '";
    cmd += parameters[0];       // TODO escape singlequotes
    cmd += "'";

    return plugin_eval_rb(cmd);
}
开发者ID:amezick,项目名称:dfhack,代码行数:14,代码来源:ruby.cpp

示例5: df_liquids_here

command_result df_liquids_here (color_ostream &out, vector <string> & parameters)
{
    for(size_t i = 0; i < parameters.size();i++)
    {
        if(parameters[i] == "help" || parameters[i] == "?")
            return CR_WRONG_USAGE;
    }

    out.print("Run liquids-here with these parameters: ");
    print_prompt(out, cur_mode);
    out << endl;

    return df_liquids_execute(out);
}
开发者ID:mstram,项目名称:dfhack-40d,代码行数:14,代码来源:liquids.cpp

示例6: setJobResumed

static void setJobResumed(color_ostream &out, ProtectedJob *pj, bool goal)
{
    bool current = pj->isResumed();

    pj->set_resumed(goal);

    if (goal != current)
    {
        out.print("%s %s%s\n",
                     (goal ? "Resuming" : "Suspending"),
                     shortJobDescription(pj->actual_job).c_str(),
                     (!goal || pj->isActuallyResumed() ? "" : " (delayed)"));
    }
}
开发者ID:Reag,项目名称:dfhack,代码行数:14,代码来源:workflow.cpp

示例7: cageInfo

// dump some cage info
void cageInfo(color_ostream & out, df::building* building, bool verbose = false)
{
    if(!isCage(building))
        return;

    string name;
    building->getName(&name);
    out.print("Building %i - \"%s\" - type %s (%i)",
                building->id,
                name.c_str(),
                ENUM_KEY_STR(building_type, building->getType()).c_str(),
                building->getType());
    out.print("\n");

	out << "x:"  << building->x1
		<< " y:" << building->y1
		<< " z:" << building->z
		<< endl;

    df::building_cagest * cage = (df::building_cagest*) building;
    int32_t creaturecount = cage->assigned_creature.size();
    out << "Creatures in this cage: " << creaturecount << endl;
    for(size_t c = 0; c < creaturecount; c++)
    {
        int32_t cindex = cage->assigned_creature.at(c);

        // print list of all units assigned to that cage
        for(size_t i = 0; i < world->units.all.size(); i++)
        {
            df::unit * creature = world->units.all[i];
            if(creature->id != cindex)
                continue;
                    
            unitInfo(out, creature, verbose);
        }
    }
}
开发者ID:doomchild,项目名称:dfhack,代码行数:38,代码来源:zone.cpp

示例8: doInfiniteSky

void doInfiniteSky(color_ostream& out, int32_t howMany) {
    CoreSuspender suspend;
    int32_t x_count_block = world->map.x_count_block;
    int32_t y_count_block = world->map.y_count_block;
    for ( int32_t count = 0; count < howMany; count++ ) {
        //change the size of the pointer stuff
        int32_t z_count_block = world->map.z_count_block;
        df::map_block**** block_index = world->map.block_index;
        for ( int32_t a = 0; a < x_count_block; a++ ) {
            for ( int32_t b = 0; b < y_count_block; b++ ) {
                df::map_block** blockColumn = new df::map_block*[z_count_block+1];
                memcpy(blockColumn, block_index[a][b], z_count_block*sizeof(df::map_block*));
                blockColumn[z_count_block] = NULL;
                delete[] block_index[a][b];
                block_index[a][b] = blockColumn;

                //deal with map_block_column stuff even though it'd probably be fine
                df::map_block_column* column = world->map.column_index[a][b];
                if ( !column ) {
                    out.print("%s, line %d: column is null (%d, %d).\n", __FILE__, __LINE__, a, b);
                    continue;
                }
                df::map_block_column::T_unmined_glyphs* glyphs = new df::map_block_column::T_unmined_glyphs;
                glyphs->x[0] = 0;
                glyphs->x[1] = 1;
                glyphs->x[2] = 2;
                glyphs->x[3] = 3;
                glyphs->y[0] = 0;
                glyphs->y[1] = 0;
                glyphs->y[2] = 0;
                glyphs->y[3] = 0;
                glyphs->tile[0] = 'e';
                glyphs->tile[1] = 'x';
                glyphs->tile[2] = 'p';
                glyphs->tile[3] = '^';
                column->unmined_glyphs.push_back(glyphs);
            }
        }
        df::z_level_flags* flags = new df::z_level_flags[z_count_block+1];
        memcpy(flags, world->map_extras.z_level_flags, z_count_block*sizeof(df::z_level_flags));
        flags[z_count_block].whole = 0;
        flags[z_count_block].bits.update = 1;
        world->map.z_count_block++;
        world->map.z_count++;
        delete[] world->map_extras.z_level_flags;
        world->map_extras.z_level_flags = flags;
    }
    
}
开发者ID:Alloyed,项目名称:dfhack,代码行数:49,代码来源:infiniteSky.cpp

示例9: workNow

DFhackCExport command_result workNow(color_ostream& out, vector<string>& parameters) {
    if ( parameters.size() == 0 ) {
        out.print("workNow status = %d\n", mode);
        return CR_OK;
    }
    if ( parameters.size() > 1 ) {
        return CR_WRONG_USAGE;
    }
    int32_t a = atoi(parameters[0].c_str());
    
    if (a < 0 || a > 2)
        return CR_WRONG_USAGE;

    if ( a == 2 && mode != 2 ) {
        EventManager::registerListener(EventManager::EventType::JOB_COMPLETED, handler, plugin_self);
    } else if ( mode == 2 && a != 2 ) {
        EventManager::unregister(EventManager::EventType::JOB_COMPLETED, handler, plugin_self);
    }

    mode = a;
    out.print("workNow status = %d\n", mode);

    return CR_OK;
}
开发者ID:CarabusX,项目名称:dfhack,代码行数:24,代码来源:workNow.cpp

示例10: follow

command_result follow (color_ostream &out, std::vector <std::string> & parameters)
{
    // HOTKEY COMMAND: CORE ALREADY SUSPENDED

    if (!parameters.empty())
        return CR_WRONG_USAGE;

    if (followedUnit)
    {
        out.print("No longer following previously selected unit.\n");
        followedUnit = 0;
    }
    followedUnit = Gui::getSelectedUnit(out);
    if (followedUnit)
    {
        std::ostringstream ss;
        ss << "Unpause to begin following " << df::global::world->raws.creatures.all[followedUnit->race]->name[0];
        if (followedUnit->name.has_name) ss << " " << followedUnit->name.first_name;
        ss << ". Simply manually move the view to break the following.\n";
        out.print(ss.str().c_str());
    }
    else followedUnit = 0;
    return CR_OK;
}
开发者ID:Elvang,项目名称:dfhack,代码行数:24,代码来源:follow.cpp

示例11: df_cleanconst

command_result df_cleanconst(color_ostream &out, vector <string> & parameters)
{
    CoreSuspender suspend;

    if (!Maps::IsValid())
    {
        out.printerr("Map is not available!\n");
        return CR_FAILURE;
    }
    size_t numItems = world->items.all.size();

    int cleaned_total = 0;

    // proceed with the cleanup operation
    for (size_t i = 0; i < numItems; i++)
    {
        df::item *item = world->items.all[i];
        // only process items marked as "in construction"
        if (!item->flags.bits.construction)
            continue;
        df::coord pos(item->pos.x, item->pos.y, item->pos.z);

        df::construction *cons = df::construction::find(pos);
        if (!cons)
        {
            out.printerr("Item at %i,%i,%i marked as construction but no construction is present!\n", pos.x, pos.y, pos.z);
            continue;
        }
        // if the construction is already labeled as "no build item", then leave it alone
        if (cons->flags.bits.no_build_item)
            continue;

        // only destroy the item if the construction claims to be made of the exact same thing
        if (item->getType() != cons->item_type ||
            item->getSubtype() != cons->item_subtype ||
            item->getMaterial() != cons->mat_type ||
            item->getMaterialIndex() != cons->mat_index)
            continue;

        item->flags.bits.garbage_collect = 1;
        cons->flags.bits.no_build_item = 1;

        cleaned_total++;
    }

    out.print("Done. %d construction items cleaned up.\n", cleaned_total);
    return CR_OK;
}
开发者ID:Alloyed,项目名称:dfhack,代码行数:48,代码来源:cleanconst.cpp

示例12: revealAdventure

void revealAdventure(color_ostream &out)
{
    for (size_t i = 0; i < world->map.map_blocks.size(); i++)
    {
        df::map_block *block = world->map.map_blocks[i];
        designations40d & designations = block->designation;
        // for each tile in block
        for (uint32_t x = 0; x < 16; x++) for (uint32_t y = 0; y < 16; y++)
        {
            // set to revealed
            designations[x][y].bits.hidden = 0;
            // and visible
            designations[x][y].bits.pile = 1;
        }
    }
    out.print("Local map revealed.\n");
}
开发者ID:quietust,项目名称:dfhack-23a,代码行数:17,代码来源:reveal.cpp

示例13: describeTile

void describeTile(color_ostream &out, df::tiletype tiletype)
{
    out.print("%d", tiletype);
    if(tileName(tiletype))
        out.print(" = %s",tileName(tiletype));
    out.print("\n");

    df::tiletype_shape shape = tileShape(tiletype);
    df::tiletype_material material = tileMaterial(tiletype);
    df::tiletype_special special = tileSpecial(tiletype);
    df::tiletype_variant variant = tileVariant(tiletype);
    out.print("%-10s: %4d %s\n","Class"    ,shape,
              ENUM_KEY_STR(tiletype_shape, shape).c_str());
    out.print("%-10s: %4d %s\n","Material" ,
              material, ENUM_KEY_STR(tiletype_material, material).c_str());
    out.print("%-10s: %4d %s\n","Special"  ,
              special, ENUM_KEY_STR(tiletype_special, special).c_str());
    out.print("%-10s: %4d %s\n"   ,"Variant"  ,
              variant, ENUM_KEY_STR(tiletype_variant, variant).c_str());
    out.print("%-10s: %s\n"    ,"Direction",
              tileDirection(tiletype).getStr());
    out.print("\n");
}
开发者ID:AlexanderStarr,项目名称:dfhack,代码行数:23,代码来源:probe.cpp

示例14: ktimer

command_result ktimer (color_ostream &out, vector <string> & parameters)
{
    if(timering)
    {
        timering = false;
        return CR_OK;
    }
    uint64_t timestart = GetTimeMs64();
    {
        CoreSuspender suspend;
    }
    uint64_t timeend = GetTimeMs64();
    out.print("Time to suspend = %d ms\n",timeend - timestart);
    // harmless potential data race here...
    timeLast = timeend;
    timering = true;
    return CR_OK;
}
开发者ID:AnnanFay,项目名称:dfhack,代码行数:18,代码来源:kittens.cpp

示例15: revtoggle

command_result revtoggle (color_ostream &out, vector<string> & params)
{
    for(size_t i = 0; i < params.size();i++)
    {
        if(params[i] == "help" || params[i] == "?")
        {
            out.print("Toggles between reveal and unreveal.\nCurrently it: ");
            break;
        }
    }
    if(revealed)
    {
        return unreveal(out,params);
    }
    else
    {
        return reveal(out,params);
    }
}
开发者ID:EldrickWT,项目名称:dfhack,代码行数:19,代码来源:reveal.cpp


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