diff options
| author | fusion32 <marcopuzziello@gmail.com> | 2025-08-19 22:41:08 -0300 |
|---|---|---|
| committer | fusion32 <marcopuzziello@gmail.com> | 2025-08-19 22:41:08 -0300 |
| commit | d55b9473ec498ae181b3c91583c6950e4c3bb7f2 (patch) | |
| tree | 6f0b2dc1504c037f774868b549fe00fc2945b99d /src/cract.cc | |
| parent | b2a9d2cb961fabc1ca05052a645d90663d8e0a92 (diff) | |
| download | game-d55b9473ec498ae181b3c91583c6950e4c3bb7f2.tar.gz game-d55b9473ec498ae181b3c91583c6950e4c3bb7f2.zip | |
fix a problem with monsters freezing after failing to attack
Diffstat (limited to 'src/cract.cc')
| -rw-r--r-- | src/cract.cc | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/cract.cc b/src/cract.cc index 35ca92a..7b5673e 100644 --- a/src/cract.cc +++ b/src/cract.cc @@ -443,8 +443,7 @@ void TCreature::Move(Object Obj, int DestX, int DestY, int DestZ, uint8 Count){ } if(DestX == 0xFFFF){ // SPECIAL_COORDINATE ? - // NOTE(fusion): Any inventory slot. - if(DestY == 0){ + if(DestY == INVENTORY_ANY){ // NOTE(fusion): `CheckInventoryDestination` will throw if it's not // possible to place the object on the chosen container. We want to // find a slot that doesn't make it throw while giving priority to @@ -470,7 +469,7 @@ void TCreature::Move(Object Obj, int DestX, int DestY, int DestZ, uint8 Count){ // NOTE(fusion): No appropriate inventory slot was found so we now // fallback to inventory containers. For whatever reason we don't // give priority to the bag slot. - if(DestY == 0){ + if(DestY == INVENTORY_ANY){ for(int Position = INVENTORY_FIRST; Position <= INVENTORY_LAST; Position += 1){ @@ -487,7 +486,7 @@ void TCreature::Move(Object Obj, int DestX, int DestY, int DestZ, uint8 Count){ } } - if(DestY == 0){ + if(DestY == INVENTORY_ANY){ throw NOROOM; } } @@ -984,6 +983,13 @@ void TCreature::ToDoWait(int Delay){ this->ToDoAdd(TD); } +void TCreature::ToDoWaitUntil(uint32 Time){ + TToDoEntry TD = {}; + TD.Code = TDWait; + TD.Wait.Time = Time; + this->ToDoAdd(TD); +} + void TCreature::ToDoGo(int DestX, int DestY, int DestZ, bool MustReach, int MaxSteps){ if(this->posz > DestZ){ throw UPSTAIRS; |
