aboutsummaryrefslogtreecommitdiff
path: root/src
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
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')
-rw-r--r--src/crnonpl.cc4
-rw-r--r--src/houses.cc4
-rw-r--r--src/info.cc24
-rw-r--r--src/magic.cc2
4 files changed, 13 insertions, 21 deletions
diff --git a/src/crnonpl.cc b/src/crnonpl.cc
index 73a68af..477b18b 100644
--- a/src/crnonpl.cc
+++ b/src/crnonpl.cc
@@ -1984,8 +1984,8 @@ TMonster::TMonster(int Race, int x, int y, int z, int Home, uint32 MasterID) :
this->starty = y;
this->startz = z;
this->posx = x;
- this->posx = y;
- this->posx = z;
+ this->posy = y;
+ this->posz = z;
this->State = IDLE;
this->Home = Home;
this->Master = MasterID;
diff --git a/src/houses.cc b/src/houses.cc
index 5c03ad8..2fe0da2 100644
--- a/src/houses.cc
+++ b/src/houses.cc
@@ -798,8 +798,8 @@ static Object CreateTempDepot(void){
return TempDepot;
}
-// NOTE(fusion): This is used inside house processing functions to empty the depot
-// container after processing a player's depot.
+// NOTE(fusion): This is used by house processing functions to clear the temporary
+// depot container after processing player depots.
static void DeleteContainerObjects(Object Con){
Object Obj = GetFirstContainerObject(Con);
while(Obj != NONE){
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();
diff --git a/src/magic.cc b/src/magic.cc
index 4e92808..d30c894 100644
--- a/src/magic.cc
+++ b/src/magic.cc
@@ -4119,7 +4119,7 @@ void UseMagicItem(uint32 CreatureID, Object Obj, Object Dest){
throw NOCREATURE;
}
- int Amount = ComputeDamage(Actor, SpellNr, 250, 30);
+ int Amount = ComputeDamage(Actor, SpellNr, 250, 0);
Heal(Target, -1, 0, Amount); // -1 ?
break;
}