Skip to content

Commit

Permalink
Merge branch 'master' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
cbnolok authored Aug 6, 2024
2 parents 35dafdb + 2522987 commit 4edddf1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/game/game_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ typedef dword DAMAGE_TYPE; // describe a type of damage.
#define SPELLFLAG_RESIST 0x0000400 // Allowed to resist this.
#define SPELLFLAG_TARG_NOSELF 0x0000800
#define SPELLFLAG_FREEZEONCAST 0x0001000 // freezes the char on cast for this spell.
#define SPELLFLAG_FIELD_RANDOMDECAY 0x0002000 // Make the field items have random timers.
#define SPELLFLAG_NO_ELEMENTALENGINE 0x0004000
#define SPELLFLAG_DISABLED 0x0008000
#define SPELLFLAG_SCRIPTED 0x0010000
#define SPELLFLAG_PLAYERONLY 0x0020000 // casted by players only
Expand All @@ -105,7 +107,5 @@ typedef dword DAMAGE_TYPE; // describe a type of damage.
#define SPELLFLAG_CURSE 0x20000000 // Curses just like Weaken,Purge Magic,Curse,etc.
#define SPELLFLAG_HEAL 0x40000000 // Healing spell
#define SPELLFLAG_TICK 0x80000000 // A ticking spell like Poison.
#define SPELLFLAG_FIELD_RANDOMDECAY 0x100000000 // Make the field items have random timers.
#define SPELLFLAG_NO_ELEMENTALENGINE 0x200000000

#endif // _INC_GAME_MACROS_H
15 changes: 12 additions & 3 deletions src/game/items/CItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -658,9 +658,18 @@ CItem * CItem::ReadTemplate( CResourceLock & s, CObjBase * pCont ) // static
pScriptArgs = std::make_unique<CScriptTriggerArgs>(ptcArgs);
}

CObjBaseTemplate* pContObjBaseT = pCont->GetTopLevelObj();
ASSERT(pContObjBaseT);
pItem->r_Call(ptcFunctionName, dynamic_cast<CTextConsole*>(pContObjBaseT), pScriptArgs.get());
// use pCont is exist, if not use g_Serv
if (pCont)
{
CObjBaseTemplate* pContObjBaseT = pCont->GetTopLevelObj();
ASSERT(pContObjBaseT);
pItem->r_Call(ptcFunctionName, dynamic_cast<CTextConsole*>(pContObjBaseT), pScriptArgs.get());
}
else
{
pItem->r_Call(ptcFunctionName, &g_Serv, pScriptArgs.get());
}

if (pItem->IsDeleted())
{
pItem = nullptr;
Expand Down

0 comments on commit 4edddf1

Please sign in to comment.