The Ur-Quan Masters Home Page Welcome, Guest. Please login or register.
Did you miss your activation email?
September 25, 2022, 01:10:55 pm
Home Help Search Login Register
News: Paul & Fred have reached a settlement with Stardock!

+  The Ur-Quan Masters Discussion Forum
|-+  The Ur-Quan Masters Re-Release
| |-+  Technical Issues (Moderator: Death 999)
| | |-+  Problem with too many elements when modding UQM
« previous next »
Pages: [1] Print
Author Topic: Problem with too many elements when modding UQM  (Read 1659 times)
Elvish Pillager
Enlightened
*****
Offline Offline

Posts: 625



View Profile
Problem with too many elements when modding UQM
« on: February 23, 2007, 07:42:09 pm »

Various times while developing my mod, I caused large amounts of shot to created, but at some point, it would stop making more shots, and each time would say:

AllocLink(): No more elements

I found where this is in the code, but I have been unable to track it to a cause... I would quite like a more unlimited amount of objects in my arena!
Logged

My team of four Androsynth and three Chmmr is the most unfair team ever!
My mod
meep-eep
Forum Admin
Enlightened
*****
Offline Offline

Posts: 2847



View Profile
Re: Problem with too many elements when modding UQM
« Reply #1 on: February 23, 2007, 08:07:38 pm »

The code works with pre-allocated lists of Elements, probably so that it can make certain guarantees about memory usage. If there are no more elements available, some things just won't show up.
The elements are allocated when InitQueue() is called. The one you're probably running into is called from InitContexts(). If you just want more elements, you can simply change the '100' into something you like better. If you want the game to dynamically allocate more elements, you'll have to modify the displist code yourself.
Logged

“When Juffo-Wup is complete
when at last there is no Void, no Non
when the Creators return
then we can finally rest.”
Elvish Pillager
Enlightened
*****
Offline Offline

Posts: 625



View Profile
Re: Problem with too many elements when modding UQM
« Reply #2 on: February 23, 2007, 08:33:58 pm »

Increasing the number to more than 255 causes the game to crash on startup:

*** glibc detected *** ./uqm: malloc(): memory corruption: 0x10563968 ***
======= Backtrace: =========
/lib/libc.so.6[0xfb9c4a4]
/lib/libc.so.6[0xfb9eaa0]
/lib/libc.so.6(malloc+0xc4)[0xfba08a4]
./uqm[0x100a7d98]
./uqm[0x100a7f44]
./uqm[0x100bb7b0]
./uqm[0x100bb26c]
./uqm[0x1007bc04]
./uqm[0x10015af0]
./uqm[0x1004661c]
./uqm[0x100bc208]
/usr/lib/libSDL-1.2.so.0[0xff8f348]
/usr/lib/libSDL-1.2.so.0[0xffcad28]
/lib/libpthread.so.0[0xff4b9bc]
/lib/libc.so.6(__clone+0x84)[0xfbf7cb4]
Logged

My team of four Androsynth and three Chmmr is the most unfair team ever!
My mod
meep-eep
Forum Admin
Enlightened
*****
Offline Offline

Posts: 2847



View Profile
Re: Problem with too many elements when modding UQM
« Reply #3 on: February 23, 2007, 08:52:58 pm »

It looks like the size is stored in a single byte (num_objects in struct queue). You could change the type (you'd also need to change AllocQueueTableTab.
But it looks like the code actually has a mode to allocate these links dynamically after all. Just don't #define QUEUE_TABLE in displist.h.
Logged

“When Juffo-Wup is complete
when at last there is no Void, no Non
when the Creators return
then we can finally rest.”
Elvish Pillager
Enlightened
*****
Offline Offline

Posts: 625



View Profile
Re: Problem with too many elements when modding UQM
« Reply #4 on: February 23, 2007, 09:07:08 pm »

Cool, thanks.
Logged

My team of four Androsynth and three Chmmr is the most unfair team ever!
My mod
Pages: [1] Print 
« previous next »
Jump to:  


Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!