View Single Post
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 06-11-2013 , 16:49   Re: SourceModGen - Data modeling tool
Reply With Quote #10

Quote:
Originally Posted by friagram View Post
No, i am just pointing out how odd and inefficient dynamic array models are in pawn.
But sure, you don't need these type functions, esp realloc, you can just allocate a new array of the new size, copy the contents, and close the old handle, and return the new handle. You need more functions to do it.
I'm lost as to what you mean here. adt_arrays automatically resize based on how many elements they have so you should never have to copy data between adt_arrays... and since normal Pawn arrays don't use handles, I have to assume you're talking about adt_arrays.

Quote:
Originally Posted by friagram View Post
Also, there is no tag type associated to the array, i think, so you can't initialize it on creation. This is a bit annoying.
Yes, but sadly it's more or less a limitation of Pawn. Remember, everything is a 32-bit int to Pawn, even floating point numbers. Strings are just sets of 4 chars stuffed into 32-bit ints.

Quote:
Originally Posted by friagram View Post
Presumably array creation will succeed? There is no way of knowing i think, because it doesn't return something like null ptr on failure.
It returns INVALID_HANDLE on failure.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline