Raised This Month: $ Target: $400
 0% 

[SNIPPET] Get Workshop Map Name


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Leonardo
Veteran Member
Join Date: Feb 2010
Location: 90's
Old 10-14-2014 , 16:17   Re: [SNIPPET] Get Workshop Map Name
Reply With Quote #1

so strcopy(destination, maxlen, ""); is faster/better than destination[0] = 0; ?
__________________
Leonardo is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 10-15-2014 , 11:10   Re: [SNIPPET] Get Workshop Map Name
Reply With Quote #2

Quote:
Originally Posted by Leonardo View Post
so strcopy(destination, maxlen, ""); is faster/better than destination[0] = 0; ?
Yes1. Unless you meant than destination[0] = '\0'; in which case, no. I missed that I did a strcopy of "", whoops.

The comment optimization above it was there because earlier in development, it didn't check so it kept going all the way down the function when the copy length was 0.

To be honest, the entire SubString function is unnecessary as long as its args are positive, as it's just a fancy wrapper for strcopy.

1Because destination is tagged as String and that will toss warnings/errors.
Attached Files
File Type: inc map_workshop_functions.inc (5.5 KB, 378 views)
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 10-15-2014 at 11:20.
Powerlord is offline
Mathias.
Veteran Member
Join Date: Aug 2010
Location: Canada is my city
Old 04-28-2015 , 16:06   Re: [SNIPPET] Get Workshop Map Name
Reply With Quote #3

Quote:
Originally Posted by Leonardo View Post
so strcopy(destination, maxlen, ""); is faster/better than destination[0] = 0; ?
destination[0] = '\0' or 0 is still faster but not at a point it really matter even if you had to call the function into a large loop.
Mathias. is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:30.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode