View Full Version : Any chance the source will be updated for spells over 3602?
killspree
02-13-2003, 08:22 PM
I noticed that Faerune and other spells over the #3602 work on some servers like Halls of Paranor and ForeverHacking, but it doesn't seem to be updated in the CVS - I downloaded telmets binary(which I'd assume is compiled from the CVS source), and the spells don't work with it.
Trumpcard
02-14-2003, 12:24 AM
There a minor issue here we're trying to work out.. Its not a hard one, just going to take a little thought.
Right now, the code hardcodes the MAX SPELL # to use to create the array that spells are stored in. It also is the loop counter. IF we make that number 2 high, the server will die a horrible death, so we keep it low. Why not change it to the spell # of the latest spells_en.txt? Couple of reasons I wont go into here, but it will just be easier for someone to come up with a simple method to dynamiclly read the max of the spell_en.txt , then use that value.
If anyone is willing to work on that, it would be great, then the server will auto adjust for spells_en.txt you have in your directory.
Kaiyodo
02-14-2003, 02:10 AM
The spell editor gets round this by reading the spells into a temporary linked list of dynamically allocated spells_structs until it hits the end of the file. It then uses the highest spell number in the list to allocate the array which the spells are then copied into.
That lets you to have a dynamic number of spells along with the quick access of an array. That's how I did it anyway, you might be able to think of something a bit neater :)
K.
Trumpcard
02-14-2003, 02:33 AM
Smart way.. Read it into a buffer, yank the high index, then create the array with the index value, and move out of the temporary buffer into the spell array.. Seems pretty intutiative...
Valdain
02-15-2003, 03:20 PM
Hi all,
I have updated the spell loading function to load as many spells that are in the file. Here's the code so far. I haven't been able to test it yet due to some DB problems I'm having.
Attached is the updated LoadSPDat. You also need to change
SPDat_Spell_Struct spells[SPDAT_RECORDS];
to
SPDat_Spell_Struct *spells;
at the top of net.cpp and change
extern SPDat_Spell_Struct spells[SPDAT_RECORDS];
to
extern SPDat_Spell_Struct *spells;
in any files that have it.
Hope that makes sense. I am working on speeding up the loading, but I've been a little busy with Valentines Day.
-Valdain
EDIT: I have removed this file. See my next post down for the polished version.
Valdain
02-16-2003, 08:23 AM
Ok, attached is the polished version. It loads much faster than the old version. There is a new function also added at the bottom. I found it at http://www.castaglia.org/proftpd/doc/devel-guide/src/lib/strsep.c.html. You need to add the function delcaration at the top of net.cpp for the new strsep function. The last change is to add
delete[] spells;
at line 286 of net.cpp to clean-up. Not sure if that's the best place for it, but it works. Be sure to also make the changes listed in my post above.
-Valdain
Trumpcard
02-16-2003, 10:54 AM
Thats alot cleaner than the old function !
Thanks Valdian, I'll check it out...
Trumpcard
02-16-2003, 12:32 PM
Might work on windows, but im having problems working it into linux..
ios::nocreate doesnt exist in newer gcc versions, it has OS specific ties...
Also, seems that the loop never gets executed for some reason, not sure what it is about the file thats causing it to fall out. The first loop works great in getting the high id, tempid number, but the next loop is failing for some reason..l
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.