Hello all. It's been a while since I posted. I am still working on things, but a few real life things have kept me busy elsewhere for while.
Yes, mobs are going to be a problem in many ways. I took out code that autospawned monsters, and I am trying to get an annoying piece of code to work that removes creatures when landblocks are out of focus. There have been all sorts of problems going in and out of dungeons, with portals disappearing. At the moment, you manually spawn a creature (in a dungeon) it follows you rather relentlessly. It has a limitation of its travel, after which it returns "home". But it's rather more tenacious than the original game. No stuck in corners running pointlessly - it navigates around, follows you upstairs, leaps down if you jump down - very amusing. I stopped short of allowing them to follow you into portals.. that would be very amusing but I must resist! Creatures (like skeletons) randomly are equipped with appropriate weapons and shields, but sometimes not, and perform the right animation depending. I think I have all the idle animations defined too, I had to do a lot of experimentation.
When I've got bored trying to fix bugs, I went on to do other things. I made jewellery have enchantments on them, and had to a dozen other things to make them assess properly. This led to all sorts of realizations about various assess functions not working correctly, and I had to persist spells and all that kind of jazz. Since gems are not far different from jewelry, I put code in for those too, at least inasmuch as you can spawn a gem, and it has random spells on it (only one so far) including minor or major traits, and you can click them and the spell activates and counts down. Code for mana stones and charging of them onto items is more or less correct - that was very tricky too because mana stones have to be declared in a certain way to make the warning about destroying the item come up or not come up.
In the meantime I have wasted enormous amounts of time on various memory corruption issues. And I thought I'd share one of the culprits. Not my code, I hasten to add, but I thought I'd share.
time(&NextCleanTime + DELAY);
Innocuous looking line of code, but of course very nasty. It puts the current time into the variable's address plus the delay, which is some random other place. I've been putting in _CrtCheckMemory() commands to work out where the memory fault occurs. I had already fixed one of those elsewhere, but I suppose I'll have to look for similar other occurrences. It should be time(&NextCleanTime); NextCleanTime+= DELAY.
There was another terrible bug in various places - a precedence problem throughout
if (flags & 0x00000008 == 0x00000008)
Yes - I might have once myself made that kind of mistake, but I tend to throw parenths around everything these days because I am paranoid about such things. So if ((flags & 0x00000008) == 0x00000008) This kind of thing can create quite baffling problems,not crashing but just wrong packets going out, so objects not appearing perhaps. The & has lower priority so the pointless 8 = 8 part is done first.