本文整理汇总了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;
}
示例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;
}