aboutsummaryrefslogtreecommitdiff
path: root/src/magic.cc
diff options
context:
space:
mode:
authorfusion32 <marcopuzziello@gmail.com>2025-06-08 19:54:40 -0300
committerfusion32 <marcopuzziello@gmail.com>2025-06-08 19:54:40 -0300
commiteaa3536c027a4f7c1b879b78ab0ecdefcdb4833d (patch)
tree03f851e558656f8fc36fdb982c28fbc09cef8dac /src/magic.cc
parentab9f606371a1df23e9cacbffa0811db7a9e50100 (diff)
downloadgame-eaa3536c027a4f7c1b879b78ab0ecdefcdb4833d.tar.gz
game-eaa3536c027a4f7c1b879b78ab0ecdefcdb4833d.zip
impl `TCreature::Move` which was absolute hell + some tidying up
Diffstat (limited to 'src/magic.cc')
-rw-r--r--src/magic.cc16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/magic.cc b/src/magic.cc
index 1caf83b..a222b3a 100644
--- a/src/magic.cc
+++ b/src/magic.cc
@@ -2409,7 +2409,9 @@ void CancelInvisibility(TCreature *Actor, Object Target, int ManaPoints, int Sou
// it on pvp enforced worlds.
// TODO(fusion): This is probably an inlined function.
if(WorldType == PVP_ENFORCED){
- for(int Position = 1; Position <= 10; Position += 1){
+ for(int Position = INVENTORY_FIRST;
+ Position <= INVENTORY_LAST;
+ Position += 1){
Object Item = GetBodyObject(Victim->ID, Position);
if(Item == NONE){
continue;
@@ -2516,8 +2518,8 @@ void ChangeData(TCreature *Actor, const char *Param){
return;
}
- Object RightHand = GetBodyObject(Actor->ID, 5); // RIGHTHAND ?
- Object LeftHand = GetBodyObject(Actor->ID, 6); // LEFTHAND ?
+ Object RightHand = GetBodyObject(Actor->ID, INVENTORY_RIGHTHAND);
+ Object LeftHand = GetBodyObject(Actor->ID, INVENTORY_LEFTHAND);
if(RightHand != NONE && LeftHand != NONE){
SendMessage(Actor->Connection, TALK_FAILURE_MESSAGE, "First drop one object.");
return;
@@ -2578,9 +2580,9 @@ void EnchantObject(TCreature *Actor, int ManaPoints, int SoulPoints, ObjectType
throw ERROR;
}
- Object Obj = GetBodyObject(Actor->ID, 5); // RIGHTHAND ?
+ Object Obj = GetBodyObject(Actor->ID, INVENTORY_RIGHTHAND);
if(Obj == NONE || Obj.getObjectType() != OldType){
- Obj = GetBodyObject(Actor->ID, 6); // LEFTHAND ?
+ Obj = GetBodyObject(Actor->ID, INVENTORY_LEFTHAND);
if(Obj == NONE || Obj.getObjectType() != OldType){
throw MAGICITEM;
}
@@ -3670,7 +3672,7 @@ static void RuneSpell(uint32 CreatureID, int SpellNr){
bool RuneCreated = false;
ObjectType BlankType = GetSpecialObject(RUNE_BLANK);
- Object RightHand = GetBodyObject(Actor->ID, 5); // RIGHTHAND
+ Object RightHand = GetBodyObject(Actor->ID, INVENTORY_RIGHTHAND);
if(RightHand.exists() && RightHand.getObjectType() == BlankType){
CheckMana(Actor, ManaPoints, SoulPoints, 1000);
ObjectType RuneType = GetNewObjectType(RuneGr, RuneNr);
@@ -3678,7 +3680,7 @@ static void RuneSpell(uint32 CreatureID, int SpellNr){
RuneCreated = true;
}
- Object LeftHand = GetBodyObject(Actor->ID, 6); // LEFTHAND
+ Object LeftHand = GetBodyObject(Actor->ID, INVENTORY_LEFTHAND);
if(LeftHand.exists() && LeftHand.getObjectType() == BlankType){
// TODO(fusion): Ughh... I'm not sure why we're trying to cast the spell
// twice but we need to make so errors from the second cast are only