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


C++ Database::GetFactionName方法代码示例

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


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

示例1: BuildFactionMessage

//o--------------------------------------------------------------
//| Name: BuildFactionMessage; rembrant, Dec. 16, 2001
//o--------------------------------------------------------------
//| Purpose: duh?
//o--------------------------------------------------------------
char* BuildFactionMessage(sint32 tmpvalue, sint32 faction_id, sint32 totalvalue)
{
	char *faction_message = 0;

	char name[50];

	if(database.GetFactionName(faction_id, name, sizeof(name)) == false) {
		snprintf(name, sizeof(name),"Faction%i",faction_id);
	}

	if(totalvalue >= MAX_FACTION) {
		MakeAnyLenString(&faction_message, "Your faction standing with %s could not possibly get any better!", name);
		return faction_message;
	}
	else if(tmpvalue > 0 && totalvalue < MAX_FACTION) {
		MakeAnyLenString(&faction_message, "Your faction standing with %s has gotten better!", name);
		return faction_message;
	}
	else if(tmpvalue == 0) {
		return 0;
	}
	else if(tmpvalue < 0 && totalvalue > MIN_FACTION) {
		MakeAnyLenString(&faction_message, "Your faction standing with %s has gotten worse!", name);
		return faction_message;
	}
	else if(totalvalue <= MIN_FACTION) {
		MakeAnyLenString(&faction_message, "Your faction standing with %s could not possibly get any worse!", name);
		return faction_message;
	}
	return 0;
}
开发者ID:aceoyame,项目名称:OpenEQC,代码行数:36,代码来源:faction.cpp

示例2: BuildFactionMessage

//o--------------------------------------------------------------
//| Name: BuildFactionMessage; rembrant, Dec. 16, 2001
//o--------------------------------------------------------------
//| Purpose: duh?
//o--------------------------------------------------------------
char* BuildFactionMessage(sint32 tmpvalue, int32 faction_id)
{
    char *faction_message = 0;
    int buf_len = 256;
    int chars = -1;

    char name[50];

    if(database.GetFactionName(faction_id, name) == false)
    {
        snprintf(name, buf_len,"Faction%i",faction_id);
    }

    if(tmpvalue == MAX_FACTION)
    {
        while (chars == -1 || chars >= buf_len)
        {
            if (faction_message != 0)
            {
                delete[] faction_message;
                faction_message = 0;
                buf_len *= 2;
            }
            faction_message = new char[buf_len];
            chars = snprintf(faction_message, buf_len, "Your faction standing with %s could not possibly get any better!", name);
        }
    }
    if(tmpvalue > 0 && tmpvalue < MAX_FACTION)
    {
        while (chars == -1 || chars >= buf_len)
        {
            if (faction_message != 0)
            {
                delete[] faction_message;
                faction_message = 0;
                buf_len *= 2;
            }
            faction_message = new char[buf_len];
            chars = snprintf(faction_message, buf_len, "Your faction standing with %s has gotten better!", name);
        }
    }
    if(tmpvalue < 0 && tmpvalue > MIN_FACTION)
    {
        while (chars == -1 || chars >= buf_len)
        {
            if (faction_message != 0)
            {
                delete[] faction_message;
                faction_message = 0;
                buf_len *= 2;
            }
            faction_message = new char[buf_len];
            chars = snprintf(faction_message, buf_len, "Your faction standing with %s has gotten worse!", name);
        }
    }
    if(tmpvalue == MIN_FACTION)
    {
        while (chars == -1 || chars >= buf_len)
        {
            if (faction_message != 0)
            {
                delete[] faction_message;
                faction_message = 0;
                buf_len *= 2;
            }
            faction_message = new char[buf_len];
            chars = snprintf(faction_message, buf_len, "Your faction standing with %s could not possibly get any worse!", name);
        }
    }
    return faction_message;
}
开发者ID:cavedude00,项目名称:eqmacemu,代码行数:76,代码来源:faction1.cpp


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