Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Vector 0 is a valid resource?

Author
Message
RiiDii
21
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 25th Nov 2010 18:41
Just wondering if this was intentional, or if it is a potential issue:

In most cases, entity 0 is reserved for system resources. For example, bitmap 0 is the system's drawing screen. Therefore, "Create Bitmap 0,256,256" is not allowed. All, or at least most, other entity types (images, memblocks, objects, etc.) have this same restriction regardless if entity 0 is used by the system. For example, [I am pretty sure] object 0 is not really a system resource.

However,...

R = Make Vector3(0)

...seems to work just fine. While this might be good news (Woohoo! We can use all of the 2^32 vectors!), I am concerned that perhaps this was really done in error instead of intentionally. For example, will some of the 107 vector command(s) / function(s) give an error if vector 0 is used? Or perhaps there will be some less obvious error, such as the system deciding it needs to use its vector resource and overwrites the data in vector 0.

The reason I am asking is that I am writing some error-catching functions to ensure entities are valid before using them for other functions. Should these error-catching functions not allow vector 0 just to be safe? Or is vector 0 completely 100% golden-safe to use?

From a curiosity perspective, if this was intentional - why not allow other entities to use 0 such as objects? One possible reason might be that, "object 0, even if not used by the system today, may one day be used by the system in a later update to DBPro." However, this reasoning is equally applicable to vectors. Are all the other entity-zeros used by the system, but not vectors?
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 25th Nov 2010 19:48
It's in error.

Negative resources are internal (eg images)
'Zero' resources, are created by the runtime (eg camera, light)
Positive resources are all yours to do with as you like.

Don't use it, I'm about to ensure that it's disabled

Utility plug-ins (26-JUL-2010)
I'm applying terms of use that require you to wear a red nose and honk a horn whenever you use the Internet
RiiDii
21
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 25th Nov 2010 20:06
Thanks IanM.
Be sure to update the Find Free Vector() function in the Matrix Utilities as well.

Login to post a reply

Server time is: 2026-07-21 12:49:11
Your offset time is: 2026-07-21 12:49:11