Ejemplo n.º 1
0
//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;
}
Ejemplo n.º 2
0
//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;
}