Je mets l'include que j'avais fait a l'epoque...
//::///////////////////////////////////////////////
//:: hc_inc_pin
//:: FileName
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Include de gestion des punaise sur les cartes.
A savoir :
Si on supprime une punaise sur une carte le jeu ne gere
pas la suppression d'un index du tableau
Ce qui fait qu'on a toujours un index qui s'incremente
meme si on supprime les punaises
Pour eviter d'avoir des trous dans le tableau de Pin
On supprime le tableau du PJ a chaque reboot du serveur.
Et on le reconstruit.
Attention si le serveur plante pendant l'opperation de load.
on perds les svgs!
*/
//:://////////////////////////////////////////////
//:: Created By: Garrath
//:: Created On:
//:://////////////////////////////////////////////
void DeletePinSave(object oPC);
void SavePin(object oPC);
void LoadPin(object oPC);
//::///////////////////////////////////////////////
//:: DeletePinSave
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Suppression des punaises d'un joueur
Parametre :
object oPC
*/
//:://////////////////////////////////////////////
//:: Created By: Garrath
//:: Created On:
//:://////////////////////////////////////////////
void DeletePinSave(object oPC)
{
if(oPC == OBJECT_INVALID)
return;
object oSvg = GetItemPossessedBy(oPC, "dmfi_pc_emote");
if(oSvg == OBJECT_INVALID)
return;
int nDernierPin = GetLocalInt(oSvg, "NW_TOTAL_MAP_PINS");
int i ;
string sPin;
for (i=1; i <= nDernierPin; i++)
{
sPin = IntToString(i);
DeleteLocalString(oSvg, "NW_MAP_PIN_NTRY_"+sPin);
DeleteLocalFloat(oSvg, "NW_MAP_PIN_XPOS_"+sPin);
DeleteLocalFloat(oSvg, "NW_MAP_PIN_YPOS_"+sPin);
DeleteLocalFloat(oSvg, "NW_MAP_PIN_ZPOS_"+sPin);
DeleteLocalString(oSvg, "TAG_NW_MAP_PIN_AREA_"+sPin);
}
DeleteLocalInt(oSvg, "NW_TOTAL_MAP_PINS");
}
//::///////////////////////////////////////////////
//:: SavePin
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Procedure de sauvegarde sur l'objet dmfi_pc_emote
des punaises du PJ.
On svg le tabelau a partir du debut a chaque fois,
car si des punaises sont supprimes l'index dans le tableau n'est
pas reutilise et donc pour etre sur de prendre en compte
les suppressions on resauvegarde tout le tableau.
Parametre :
object oPC Le jouer dont on svg les punaises
*/
//:://////////////////////////////////////////////
//:: Created By: Garrath
//:: Created On:
//:://////////////////////////////////////////////
void SavePin(object oPC)
{
if(oPC == OBJECT_INVALID)
return;
object oSvg = GetItemPossessedBy(oPC, "dmfi_pc_emote");
if(oSvg == OBJECT_INVALID)
return;
DeletePinSave(oPC);
int nDernierPin = GetLocalInt(oSvg, "NW_TOTAL_MAP_PINS");
int nDernierPinPJ = GetLocalInt(oPC, "NW_TOTAL_MAP_PINS");
string sPin;
while (nDernierPin < nDernierPinPJ)
{
nDernierPin++;
sPin = IntToString(nDernierPin);
SetLocalString(oSvg, "NW_MAP_PIN_NTRY_"+sPin, GetLocalString(oPC, "NW_MAP_PIN_NTRY_"+sPin));
SetLocalFloat(oSvg, "NW_MAP_PIN_XPOS_"+sPin, GetLocalFloat(oPC, "NW_MAP_PIN_XPOS_"+sPin));
SetLocalFloat(oSvg, "NW_MAP_PIN_YPOS_"+sPin, GetLocalFloat(oPC, "NW_MAP_PIN_YPOS_"+sPin));
SetLocalFloat(oSvg, "NW_MAP_PIN_ZPOS_"+sPin, GetLocalFloat(oPC, "NW_MAP_PIN_ZPOS_"+sPin));
SetLocalString(oSvg, "TAG_NW_MAP_PIN_AREA_"+sPin, GetTag(GetLocalObject(oPC, "NW_MAP_PIN_AREA_"+sPin)));
}
SetLocalInt(oSvg, "NW_TOTAL_MAP_PINS", nDernierPin);
}
//::///////////////////////////////////////////////
//:: LoadPin
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Chargement des Punaise sauvegarde
Parametre :
object oPC
*/
//:://////////////////////////////////////////////
//:: Created By: Garrath
//:: Created On:
//:://////////////////////////////////////////////
void LoadPin(object oPC)
{
if(oPC == OBJECT_INVALID)
return;
object oSvg = GetItemPossessedBy(oPC, "dmfi_pc_emote");
if(oSvg == OBJECT_INVALID)
return;
int nDernierPin = GetLocalInt(oSvg, "NW_TOTAL_MAP_PINS");
int i;
int j = 0;
string sPin;
string sPinRemise;
object oArea;
//Suppression des punaises du PJ
for (i = 1; i <= GetLocalInt(oPC, "NW_TOTAL_MAP_PINS"); i++)
{
sPin = IntToString(i);
DeleteLocalString(oPC, "NW_MAP_PIN_NTRY_"+sPin);
DeleteLocalFloat(oPC, "NW_MAP_PIN_XPOS_"+sPin);
DeleteLocalFloat(oPC, "NW_MAP_PIN_YPOS_"+sPin);
DeleteLocalFloat(oPC, "NW_MAP_PIN_ZPOS_"+sPin);
DeleteLocalObject(oPC, "NW_MAP_PIN_AREA_"+sPin);
}
//Lecture des sauvegardes
for (i = 1; i <= nDernierPin; i++)
{
sPin = IntToString(i);
oArea = GetObjectByTag(GetLocalString(oSvg, "TAG_NW_MAP_PIN_AREA_"+sPin));
// Si l'area n'est pas bonne on ne recopie pas la svg
if (GetIsObjectValid(oArea))
{
j++;
sPinRemise = IntToString(j);
SetLocalObject(oPC, "NW_MAP_PIN_AREA_"+sPinRemise, oArea);
SetLocalString(oPC, "NW_MAP_PIN_NTRY_"+sPinRemise, GetLocalString(oSvg, "NW_MAP_PIN_NTRY_"+sPin));
SetLocalFloat(oPC, "NW_MAP_PIN_XPOS_"+sPinRemise, GetLocalFloat(oSvg, "NW_MAP_PIN_XPOS_"+sPin));
SetLocalFloat(oPC, "NW_MAP_PIN_YPOS_"+sPinRemise, GetLocalFloat(oSvg, "NW_MAP_PIN_YPOS_"+sPin));
SetLocalFloat(oPC, "NW_MAP_PIN_ZPOS_"+sPinRemise, GetLocalFloat(oSvg, "NW_MAP_PIN_ZPOS_"+sPin));
}
}
SetLocalInt(oPC, "NW_TOTAL_MAP_PINS", j);
//Sauvegarde propre
SavePin(oPC);
}