Update of /cvsroot/decaldev/source/DecalFilters
In directory usw-pr-cvs1:/tmp/cvs-serv21178
Modified Files:
Enchantment.h Enchantment.cpp DecalFilters.rc DecalFilters.idl
CharacterStats.h CharacterStats.cpp
Log Message:
fixed the last of the enchantment handling bugs (get_Enchant now returns proper values for everything)
Index: Enchantment.h
===================================================================
RCS file: /cvsroot/decaldev/source/DecalFilters/Enchantment.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Enchantment.h 29 Jul 2002 02:56:03 -0000 1.1
--- Enchantment.h 2 Aug 2002 00:38:33 -0000 1.2
***************
*** 11,14 ****
--- 11,15 ----
#include "resource.h" // main symbols
+ #include "CharacterStats.h"
/////////////////////////////////////////////////////////////////////////////
***************
*** 22,25 ****
--- 23,27 ----
public:
Enchantment() {}
+
BEGIN_COM_MAP(Enchantment)
COM_INTERFACE_ENTRY(IDispatch)
***************
*** 30,34 ****
private:
! long SpellID, Layer, TimeLeft, Affected, AffectMask, Family;
double Adjustment;
--- 32,36 ----
private:
! long SpellID, Layer, SecondsLeft, Affected, AffectMask, Family;
double Adjustment;
Index: Enchantment.cpp
===================================================================
RCS file: /cvsroot/decaldev/source/DecalFilters/Enchantment.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Enchantment.cpp 29 Jul 2002 02:56:03 -0000 1.1
--- Enchantment.cpp 2 Aug 2002 00:38:33 -0000 1.2
***************
*** 38,42 ****
STDMETHODIMP Enchantment::get_TimeRemaining(long *pVal)
{
! *pVal = TimeLeft;
return S_OK;
--- 38,42 ----
STDMETHODIMP Enchantment::get_TimeRemaining(long *pVal)
{
! *pVal = SecondsLeft;
return S_OK;
***************
*** 45,49 ****
STDMETHODIMP Enchantment::put_TimeRemaining(long newVal)
{
! TimeLeft = newVal;
return S_OK;
--- 45,49 ----
STDMETHODIMP Enchantment::put_TimeRemaining(long newVal)
{
! SecondsLeft = newVal;
return S_OK;
Index: DecalFilters.rc
===================================================================
RCS file: /cvsroot/decaldev/source/DecalFilters/DecalFilters.rc,v
retrieving revision 1.40
retrieving revision 1.41
diff -C2 -d -r1.40 -r1.41
*** DecalFilters.rc 31 Jul 2002 17:37:16 -0000 1.40
--- DecalFilters.rc 2 Aug 2002 00:38:33 -0000 1.41
***************
*** 55,60 ****
VS_VERSION_INFO VERSIONINFO
! FILEVERSION 2,3,1,4
! PRODUCTVERSION 2,3,1,4
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
--- 55,60 ----
VS_VERSION_INFO VERSIONINFO
! FILEVERSION 2,3,1,5
! PRODUCTVERSION 2,3,1,5
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
***************
*** 74,78 ****
VALUE "CompanyName", "\0"
VALUE "FileDescription", "DecalFilters Module\0"
! VALUE "FileVersion", "2, 3, 1, 4\0"
VALUE "InternalName", "DecalFilters\0"
VALUE "LegalCopyright", "Copyright 2001\0"
--- 74,78 ----
VALUE "CompanyName", "\0"
VALUE "FileDescription", "DecalFilters Module\0"
! VALUE "FileVersion", "2, 3, 1, 5\0"
VALUE "InternalName", "DecalFilters\0"
VALUE "LegalCopyright", "Copyright 2001\0"
***************
*** 82,86 ****
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "DecalFilters Module\0"
! VALUE "ProductVersion", "2, 3, 1, 4\0"
VALUE "SpecialBuild", "\0"
END
--- 82,86 ----
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "DecalFilters Module\0"
! VALUE "ProductVersion", "2, 3, 1, 5\0"
VALUE "SpecialBuild", "\0"
END
Index: DecalFilters.idl
===================================================================
RCS file: /cvsroot/decaldev/source/DecalFilters/DecalFilters.idl,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** DecalFilters.idl 31 Jul 2002 01:38:40 -0000 1.23
--- DecalFilters.idl 2 Aug 2002 00:38:33 -0000 1.24
***************
*** 269,273 ****
[propget, id(32), helpstring("property MonarchFollowers")] HRESULT MonarchFollowers([out, retval] long *pVal);
[propget, id(33), helpstring("property EnchantmentCount")] HRESULT EnchantmentCount([out, retval] long *pVal);
! [propget, id(34), helpstring("property Enchantment")] HRESULT Enchantment(long EnchantNum, [out, retval] IEnchantment **pVal);
[propget, id(35), helpstring("property EffectiveAttribute")] HRESULT EffectiveAttribute(enum eAttributeID Index, [out, retval] long *pVal);
[propget, id(36), helpstring("property EffectiveSkill")] HRESULT EffectiveSkill(enum eSkillID Index, [out, retval] long *pVal);
--- 269,273 ----
[propget, id(32), helpstring("property MonarchFollowers")] HRESULT MonarchFollowers([out, retval] long *pVal);
[propget, id(33), helpstring("property EnchantmentCount")] HRESULT EnchantmentCount([out, retval] long *pVal);
! [propget, id(34), helpstring("property Enchantment")] HRESULT Enchantment(long SpellID, [out, retval] IEnchantment **pVal);
[propget, id(35), helpstring("property EffectiveAttribute")] HRESULT EffectiveAttribute(enum eAttributeID Index, [out, retval] long *pVal);
[propget, id(36), helpstring("property EffectiveSkill")] HRESULT EffectiveSkill(enum eSkillID Index, [out, retval] long *pVal);
Index: CharacterStats.h
===================================================================
RCS file: /cvsroot/decaldev/source/DecalFilters/CharacterStats.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** CharacterStats.h 31 Jul 2002 01:38:40 -0000 1.9
--- CharacterStats.h 2 Aug 2002 00:38:33 -0000 1.10
***************
*** 9,12 ****
--- 9,13 ----
#include "DecalDat.h" // NEED THIS FOR THE PORTAL DATSTREAM!
+ #include <time.h>
/////////////////////////////////////////////////////////////////////////////
***************
*** 52,56 ****
{
int iSpellID, iLayer;
! int iTimeLeft;
DWORD dwAffected, dwAffectMask, dwFamily;
float fAdjustment;
--- 53,57 ----
{
int iSpellID, iLayer;
! time_t ExpireTime;
DWORD dwAffected, dwAffectMask, dwFamily;
float fAdjustment;
***************
*** 195,199 ****
STDMETHOD(get_EnchantmentCount)(long *pVal);
! STDMETHOD(get_Enchantment)(long EnchantNum, IEnchantment **pVal);
STDMETHOD(get_EffectiveVital)(enum eVitalID Index, /*[out, retval]*/ long *pVal);
--- 196,200 ----
STDMETHOD(get_EnchantmentCount)(long *pVal);
! STDMETHOD(get_Enchantment)(long SpellID, IEnchantment **pVal);
STDMETHOD(get_EffectiveVital)(enum eVitalID Index, /*[out, retval]*/ long *pVal);
Index: CharacterStats.cpp
===================================================================
RCS file: /cvsroot/decaldev/source/DecalFilters/CharacterStats.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** CharacterStats.cpp 1 Aug 2002 01:05:54 -0000 1.21
--- CharacterStats.cpp 2 Aug 2002 00:38:33 -0000 1.22
***************
*** 7,10 ****
--- 7,12 ----
#include "AttributeInfo.h"
#include "SkillInfo.h"
+ #include "Enchantment.h"
+ #include <time.h>
/////////////////////////////////////////////////////////////////////////////
***************
*** 736,744 ****
void cCharacterStats::AddEnchant(int SpellID, int Layer, double Duration, DWORD Family, double Elapsed, DWORD AffectMask, DWORD Affected, float Adjustment)
{
cEnchantment *tpench = new cEnchantment;
tpench->iSpellID = SpellID;
tpench->iLayer = Layer;
tpench->dwFamily = Family;
! tpench->iTimeLeft = (int) (Duration - Elapsed);
tpench->dwAffected = Affected;
tpench->dwAffectMask = AffectMask;
--- 738,750 ----
void cCharacterStats::AddEnchant(int SpellID, int Layer, double Duration, DWORD Family, double Elapsed, DWORD AffectMask, DWORD Affected, float Adjustment)
{
+ time_t TimeExpires = time(NULL);
+ // duration of the spell plus the (negative) number the server sends us indicating how many seconds have elapsed
+ TimeExpires += (long(Duration + 0.5f) + long(Elapsed + 0.5f));
+
cEnchantment *tpench = new cEnchantment;
tpench->iSpellID = SpellID;
tpench->iLayer = Layer;
tpench->dwFamily = Family;
! tpench->ExpireTime = TimeExpires;
tpench->dwAffected = Affected;
tpench->dwAffectMask = AffectMask;
***************
*** 1451,1476 ****
}
! HRESULT cCharacterStats::get_Enchantment(long EnchantNum, IEnchantment **pVal)
{
if (!GotLogin)
return E_FAIL;
! if ((EnchantNum < 0) || (EnchantNum >= Enchantments.size()))
return S_FALSE;
! CComPtr< IEnchantment > pEnchant;
! pEnchant.CoCreateInstance( _bstr_t( "DecalFilters.Enchantment" ), NULL, CLSCTX_INPROC_SERVER );
! pEnchant->put_SpellID( Enchantments[ EnchantNum ]->iSpellID );
! pEnchant->put_Layer( Enchantments[ EnchantNum ]->iLayer );
! pEnchant->put_TimeRemaining( Enchantments[ EnchantNum ]->iTimeLeft );
! pEnchant->put_Affected( Enchantments[ EnchantNum ]->dwAffected );
! pEnchant->put_AffectedMask( Enchantments[ EnchantNum ]->dwAffectMask );
! pEnchant->put_Family( Enchantments[ EnchantNum ]->dwFamily );
! pEnchant->put_Adjustment( Enchantments[ EnchantNum ]->fAdjustment );
! return pEnchant->QueryInterface( IID_IEnchantment, reinterpret_cast< void ** >( pVal ) );
! return S_OK;
}
--- 1457,1492 ----
}
! HRESULT cCharacterStats::get_Enchantment(long SpellID, IEnchantment **pVal)
{
if (!GotLogin)
return E_FAIL;
! if (SpellID < 0)
return S_FALSE;
! for (std::vector<cEnchantment *>::iterator tpi = Enchantments.begin(); tpi != Enchantments.end(); tpi++)
! {
! if ((*tpi)->iSpellID == SpellID)
! {
! time_t CurrentTime = time(NULL);
! long SecondsLeft = (*tpi)->ExpireTime - CurrentTime;
! CComObject< ::Enchantment > *pEnchant;
! CComObject< ::Enchantment >::CreateInstance( &pEnchant );
! pEnchant->put_SpellID( (*tpi)->iSpellID );
! pEnchant->put_Layer( (*tpi)->iLayer );
! pEnchant->put_TimeRemaining( SecondsLeft );
! pEnchant->put_Affected( (*tpi)->dwAffected );
! pEnchant->put_AffectedMask( (*tpi)->dwAffectMask );
! pEnchant->put_Family( (*tpi)->dwFamily );
! pEnchant->put_Adjustment( (*tpi)->fAdjustment );
! return pEnchant->QueryInterface(pVal);
! return S_OK;
! }
! }
!
! return S_FALSE;
}
|