aboutsummaryrefslogtreecommitdiff
path: root/src/info.cc
diff options
context:
space:
mode:
authorfusion32 <marcopuzziello@gmail.com>2026-05-09 12:24:34 -0300
committerfusion32 <marcopuzziello@gmail.com>2026-05-09 12:40:41 -0300
commit54c2169ec9a99e34e1270e43e9fd1fccd3d2a824 (patch)
tree0da9195620521a3e4cbfcbb042441c34aba3794b /src/info.cc
parent7beaa081de8aedd28f4c7ce717bcfbd2b09230d3 (diff)
downloadgame-54c2169ec9a99e34e1270e43e9fd1fccd3d2a824.tar.gz
game-54c2169ec9a99e34e1270e43e9fd1fccd3d2a824.zip
fix issues with TMonster constructor + Search functions + UH formula
The issue with the TMonster constructor was obvious, but the others were slightly different from the original.
Diffstat (limited to 'src/info.cc')
-rw-r--r--src/info.cc24
1 files changed, 8 insertions, 16 deletions
diff --git a/src/info.cc b/src/info.cc
index e0e9467..3178c17 100644
--- a/src/info.cc
+++ b/src/info.cc
@@ -768,19 +768,14 @@ bool SearchFreeField(int *x, int *y, int *z, int Distance, uint16 HouseID, bool
int FieldY = *y + OffsetY;
int FieldZ = *z;
- // TODO(fusion): This is probably some form of the `TCreature::MovePossible`
- // function inlined.
- bool MovePossible;
+ bool MovePossible = false;
if(Jump){
MovePossible = JumpPossible(FieldX, FieldY, FieldZ, true);
}else{
MovePossible = CoordinateFlag(FieldX, FieldY, FieldZ, BANK)
- && !CoordinateFlag(FieldX, FieldY, FieldZ, UNPASS);
-
- // TODO(fusion): This one I'm not so sure.
- if(MovePossible && CoordinateFlag(FieldX, FieldY, FieldZ, AVOID)){
- MovePossible = CoordinateFlag(FieldX, FieldY, FieldZ, BED);
- }
+ && !CoordinateFlag(FieldX, FieldY, FieldZ, UNPASS)
+ && (!CoordinateFlag(FieldX, FieldY, FieldZ, AVOID)
+ || CoordinateFlag(FieldX, FieldY, FieldZ, BED));
}
if(MovePossible){
@@ -792,11 +787,9 @@ bool SearchFreeField(int *x, int *y, int *z, int Distance, uint16 HouseID, bool
}
}
-
- // NOTE(fusion): We're spiraling out from the initial coordinate.
- // TODO(fusion): This function used directions different from the ones
- // used by creatures and defined in `enums.hh` so I made it use them
- // instead, LOL.
+ // NOTE(fusion): We're spiraling out from the initial coordinate. The
+ // original function used direction values different from the ones used
+ // by creatures and defined in `enums.hh` so I changed it for consistency.
if(CurrentDirection == DIRECTION_NORTH){
OffsetY -= 1;
if(OffsetY <= -CurrentDistance){
@@ -979,9 +972,8 @@ bool SearchSpawnField(int *x, int *y, int *z, int Distance, bool Player){
if(ObjType.getFlag(UNMOVE)){
ExpansionPossible = false;
LoginPossible = LoginPossible && !Player;
- }else{
- LoginBad = true;
}
+ LoginBad = true;
}
Obj = Obj.getNextObject();