diff options
| author | fusion32 <marcopuzziello@gmail.com> | 2025-07-21 19:23:42 -0300 |
|---|---|---|
| committer | fusion32 <marcopuzziello@gmail.com> | 2025-07-21 22:49:41 -0300 |
| commit | e4b8bf807b76f6f446d9617d9a3957dc77dd6e90 (patch) | |
| tree | f974c51ca7ea111c7e96990e39453ae5dba9a6c5 /src/moveuse.cc | |
| parent | 7b9e7dbbcf1d779419be8f22df812ff523a25450 (diff) | |
| download | game-e4b8bf807b76f6f446d9617d9a3957dc77dd6e90.tar.gz game-e4b8bf807b76f6f446d9617d9a3957dc77dd6e90.zip | |
multiple bug-fixes and improvements
- Make uint32 -> Object conversion explicit. This can be more
verbose but will get a lot of small mistakes, especially with
function overloads.
- Fix problem with the path finder not including the last step
when `MustReach` was false.
- Fix problem with NPC conditions.
- Fix problem with monster homes continuously spawning monsters.
- Fix problem with creating the standard inventory.
- Fix problem with creature timers (IMPORTANT).
- Fix problem with `ThrowPossible` (IMPORTANT).
- Fix problem with rune casting.
- Fix problem with executing moveuse events.
- Fix problem with `MoveRel` and `WriteName` moveuse actions.
- Fix problem with eating food deleting the whole stack.
- Many other bug-fixes and improvements.
Diffstat (limited to 'src/moveuse.cc')
| -rw-r--r-- | src/moveuse.cc | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/moveuse.cc b/src/moveuse.cc index 81fa948..e4d76db 100644 --- a/src/moveuse.cc +++ b/src/moveuse.cc @@ -1176,7 +1176,7 @@ void ExecuteAction(MoveUseEventType EventType, TMoveUseAction *Action, } // TODO(fusion): Some helper function to format text? - char Text[256]; + char Text[256] = {}; { int ReadPos = 0; int WritePos = 0; @@ -1331,12 +1331,13 @@ void ExecuteAction(MoveUseEventType EventType, TMoveUseAction *Action, } case MOVEUSE_ACTION_MOVEREL:{ - int ObjX, ObjY, ObjZ, RelX, RelY, RelZ; - Object Obj = GetEventObject(Action->Parameters[0], User, Obj1, Obj2, *Temp); - UnpackRelativeCoordinate(Action->Parameters[1], &RelX, &RelY, &RelZ); - GetObjectCoordinates(Obj, &ObjX, &ObjY, &ObjZ); - Object Dest = GetMapContainer((ObjX + RelX), (ObjY + RelY), (ObjZ + RelZ)); - MoveOneObject(Obj, Dest); + int RefX, RefY, RefZ, RelX, RelY, RelZ; + Object MovObj = GetEventObject(Action->Parameters[0], User, Obj1, Obj2, *Temp); + Object RefObj = GetEventObject(Action->Parameters[1], User, Obj1, Obj2, *Temp); + UnpackRelativeCoordinate(Action->Parameters[2], &RelX, &RelY, &RelZ); + GetObjectCoordinates(RefObj, &RefX, &RefY, &RefZ); + Object Dest = GetMapContainer((RefX + RelX), (RefY + RelY), (RefZ + RelZ)); + MoveOneObject(MovObj, Dest); break; } @@ -1520,9 +1521,10 @@ bool HandleEvent(MoveUseEventType EventType, Object User, Object Obj1, Object Ob ActionNr <= Rule->LastAction; ActionNr += 1){ TMoveUseAction *Action = MoveUseActions.at(ActionNr); - ExecuteAction(EventType, Action, User, Obj2, Obj2, &Temp); + ExecuteAction(EventType, Action, User, Obj1, Obj2, &Temp); } Result = true; + break; } } RecursionDepth -= 1; @@ -1842,7 +1844,7 @@ void UseFood(uint32 CreatureID, Object Obj){ } Player->SetTimer(SKILL_FED, (CurFoodTime + ObjFoodTime), 0, 0, -1); - Delete(Obj, -1); + Delete(Obj, 1); } void UseTextObject(uint32 CreatureID, Object Obj){ |
