Thread: Release #2!
View Single Post
Re: Release #2!
Old
  (#19)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: Release #2! - 13-05-2004

In the barebones PB2.6 source code, the bot names array was a dynamically allocated linked list, that could in theory grow as far as there were names to add to it. My first go at fixing the memory leaks and the slowmo issue was to get rid of as much dynamic memory as possible and turn all these linked lists into static arrays. I never thought one could need more than 100 botnames (since 32 players on a server is the maximum you can go anyway).

If you want to make it dynamic, I'm against linked lists. Better count the number of lines in botnames.txt and allocate once and for all enough memory for the bot names, and then fill the array. You mustn't forget to do the same for the used bot names array. And NEITHER must you forget to free them all along with the rest of the memory the bot uses (in ServerDeactivate() if I remember well).



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
  
Reply With Quote