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


C++ Objective::GetName方法代码示例

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


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

示例1: GetDeaggregationPoint

int TaskForceClass::GetDeaggregationPoint (int slot, CampEntity *installation)
{
    int			pt=0,type;
    static int	last_pt, index = 0;

    if (!*installation)
    {
        // We're looking for a new list, so clear statics
        last_pt = index = 0;

        // Check if we care about placement
        if (!Moving())
        {
            // Find the appropriate installation
            GridIndex	x,y;
            Objective	o;
            GetLocation(&x,&y);
            o = FindNearestObjective (x,y,NULL,0);
            *installation = o;

            // Find the appropriate list
            if (o)
            {
                ObjClassDataType	*oc = o->GetObjectiveClassData();
                index = oc->PtDataIndex;
                while (index)
                {
                    if (PtHeaderDataTable[index].type == DockListType)
                    {
                        // The first time we look, we just want to know if we have a list.
                        // Return now.
                        return index;
                    }
                    index = PtHeaderDataTable[index].nextHeader;
                }
#ifdef DEBUG
                FILE	*fp = fopen("PtDatErr.log","a");
                if (fp)
                {
                    char		name[80];
                    o->GetName(name,79,FALSE);
                    fprintf(fp, "Obj %s @ %d,%d: No header list of type %d.\n",name,x,y,DockListType);
                    fclose(fp);
                }
#endif
            }
        }
    }

    if (index)
    {
        // We have a list, and want to find the correct point
        UnitClassDataType		*uc = GetUnitClassData();
        VehicleClassDataType	*vc = GetVehicleClassData(uc->VehicleType[slot]);

        // Check which type of point we're looking for
        // TODO: Check ship type here...
        //		type = SmallDockPt;
        type = LargeDockPt;

        // Return the next point, if it's the base type
        // NOTE: Log error if we don't have enough points of this type
        if (last_pt)
        {
            last_pt = pt = GetNextPt(last_pt);
#ifdef DEBUG
            if (!pt || PtDataTable[pt].type != type)
            {
                FILE	*fp = fopen("PtDatErr.log","a");
                if (fp)
                {
                    char		name[80];
                    GridIndex	x,y;
                    (*installation)->GetName(name,79,FALSE);
                    (*installation)->GetLocation(&x,&y);
                    fprintf(fp, "HeaderList %d (Obj %s @ %d,%d): Insufficient points of type %d.\n",index,name,x,y,type);
                    fclose(fp);
                }
            }
#endif
            return pt;
        }

        // Find one of the appropriate type
        pt = GetFirstPt(index);
        while (pt)
        {
            if (PtDataTable[pt].type == type)
            {
                last_pt = pt;
                return pt;
            }
            pt = GetNextPt(pt);
        }
#ifdef DEBUG
        FILE	*fp = fopen("PtDatErr.log","a");
        if (fp)
        {
            char		name[80];
            GridIndex	x,y;
//.........这里部分代码省略.........
开发者ID:aoighost,项目名称:freefalcon-central,代码行数:101,代码来源:navunit.cpp


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