some characters have no default attributes

Mar 1, 11:37 am
#1
Joined: Sep 5, 2010
Interests: make more ivans!
Posts: 430
some characters have undefined attributes. it is mostly harmless, but causes the game to access uninitialised memory.

imp has no:
DefaultArmStrength
DefaultLegStrength
DefaultDexterity
DefaultAgility
DefaultEndurance
i don't know what to put there. i mean, by which other creature imp was modelled? and i'm not sure that this is harmless.

petruss wives has no fighting skills, and they need them just in case they will get some weapons. also, petruss wife #2 "wields" a child, so she needs weapon skills from the start. i propose something like
// taken from the housewife
KnownCWeaponSkills = { 3, UNARMED, UNCATEGORIZED, BLUNT_WEAPONS; }
CWeaponSkillHits = { 2, 50, 50, 50; }
BaseUnarmedStrength = 200;
in the main definition. "blunt" added for frying pans and rolling pins.

firstborn item is missing some definitions, so danger caluclation for petruss wife #2 is UB.
Category = MISC;
FormModifier = 30; //k8: i don't know
IsTwoHanded = true; //k8: why not?

don't ask me how i found that. you don't want to know.
SPOILER ALERT. Click here to see text.
a lot of debug printing and a lot of valgrind sessions with k8IVAN. then quickly checked if vanilla is missing those too.


there seem to be a problem with mushrooms too, but i don't know yet what causes it, and if it is present in vanilla too. it is something with graphics data and animation (and i rewrote graphics subsystem, so it's hard to compare things there).
Mar 1, 2:23 pm
#2
Joined: Sep 5, 2010
Interests: make more ivans!
Posts: 430
mushroom needs `TorsoSpecialColor` and `BeltColor` set. the values can be arbitrary, the properties simply need to be defined. this is prolly wrong (the actual bug is somewhere else), but at least it makes valgrind happy.
Mar 1, 4:02 pm
#3
Joined: Apr 2, 2014
Occupation: Navastating
Location: Aslona
Posts: 854
I think this all just draws values from the default "character" here: https://github.com/Attnam/ivan/blob/master/Script/char.dat#L...

Doesn't it?
Mar 1, 4:07 pm
#4
Joined: Sep 5, 2010
Interests: make more ivans!
Posts: 430
valgrind says that they are uninitialised. `character` doesn't have those default strenghtes set, there is even the comment about that. and colors are set only for humanoids. so those end up as undefined. fighting skills don't have default values too.

actually, the game itself should check for this, but sadly, it can't.

that is, valgrind is always right, because it actually executes the machine code, and checks if the memory initialised on each read. it's not some static analysis tool. it is freakin' slow, of course, because it is a fully-featured CPU emulator. so running the game with valgrind is PITA, and i cannot check more than that (it literally takes minutes to heal several HP). sigh.
Mar 2, 11:49 am
#5
Joined: Apr 2, 2014
Occupation: Navastating
Location: Aslona
Posts: 854
Ah, thanks. Tracked here: https://github.com/Attnam/ivan/issues/670
Jump to