//:://////////////////////////////////////////////////
//:: SQL_DB_PARTYWIDE
/*
	Modified x0_i0_partywide include library for 
	persistent party-wide database functions.  
	
 */
//:://////////////////////////////////////////////////
//:: Copyright (c) 2002 Floodgate Entertainment
//:: Created By: Naomi Novik
//:: Created On: 12/08/2002
//:: Modified By: Jaysyn
//:: Modified On: 11/16/2022
//:://////////////////////////////////////////////////

#include "utl_i_sqluuid"


/**********************************************************************
 * CONSTANTS
 **********************************************************************/


/**********************************************************************
 * FUNCTION PROTOTYPES
 **********************************************************************/

// Given a varname, value, and PC, sets the variable on
// all members of the PC's party.
// For strings.
void SQL_SetLocalStringOnAll(object oPC, string sVarname, string value);

// Given a varname, value, and PC, sets the variable on
// all members of the PC's party.
// For ints.
void SQL_SetLocalIntOnAll(object oPC, string sVarname, int value);

// Given a varname, value, and PC, sets the variable on
// all members of the PC's party.
// For floats.
void SQL_SetLocalFloatOnAll(object oPC, string sVarname, float value);

// Given a varname, value, and PC, sets the variable on
// all members of the PC's party.
// For locations.
void SQL_SetLocalLocationOnAll(object oPC, string sVarname, location value);

// Given a varname, value, and PC, sets the variable on
// all members of the PC's party.
// For objects.
void SQL_SetLocalObjectOnAll(object oPC, string sVarname, object value);


/**********************************************************************
 * FUNCTION DEFINITIONS
 **********************************************************************/


// Given a varname, value, and PC, sets the variable on
// all members of the PC's party, including associates.
// For strings.
void SQL_SetLocalStringOnAll(object oPC, string sVarname, string value)
{
    object oPartyMem = GetFirstFactionMember(oPC, FALSE);
    while (GetIsObjectValid(oPartyMem)) {
        SQLocalsUUID_SetString(oPartyMem, sVarname, value);
        oPartyMem = GetNextFactionMember(oPC, FALSE);
    }
}

// Given a varname, value, and PC, sets the variable on
// all members of the PC's party, including associates.
// For ints.
void SQL_SetLocalIntOnAll(object oPC, string sVarname, int value)
{
    object oPartyMem = GetFirstFactionMember(oPC, FALSE);
    while (GetIsObjectValid(oPartyMem)) {
        SQLocalsUUID_SetInt(oPartyMem, sVarname, value);
        oPartyMem = GetNextFactionMember(oPC, FALSE);
    }

}

// Given a varname, value, and PC, sets the variable on
// all members of the PC's party.
// For floats.
void SQL_SetLocalFloatOnAll(object oPC, string sVarname, float value)
{
    object oPartyMem = GetFirstFactionMember(oPC, FALSE);
    while (GetIsObjectValid(oPartyMem)) {
        SQLocalsUUID_SetFloat(oPartyMem, sVarname, value);
        oPartyMem = GetNextFactionMember(oPC, FALSE);
    }

}

// Given a varname, value, and PC, sets the variable on
// all members of the PC's party.
// For locations.
void SQL_SetLocalLocationOnAll(object oPC, string sVarname, location value)
{
    object oPartyMem = GetFirstFactionMember(oPC, FALSE);
    while (GetIsObjectValid(oPartyMem)) {
        SQLocalsUUID_SetLocation(oPartyMem, sVarname, value);
        oPartyMem = GetNextFactionMember(oPC, FALSE);
    }

}

// Given a varname, value, and PC, sets the variable on
// all members of the PC's party.
// For objects.
void SQL_SetLocalObjectOnAll(object oPC, string sVarname, object value)
{
    object oPartyMem = GetFirstFactionMember(oPC, FALSE);
    while (GetIsObjectValid(oPartyMem)) {
        SQLocalsUUID_SetObject(oPartyMem, sVarname, value);
        oPartyMem = GetNextFactionMember(oPC, FALSE);
    }

}

// void main (){}