[SNIPPET] Get Workshop Map Name
5 Attachment(s)
SourceMod 1.8 has a function GetMapDisplayName(const char[] map, char[] displayName, int maxlength) that should be used instead of this functionality.
So, I wrote this just recently and was thinking about submitting it for inclusion in SourceMod. Note that if this is included in SourceMod, it likely would end up split into multiple include files instead of just the one (likely string.inc for SubString, mapchooser.inc for the others.) Changelog
Functions in this file: Code:
/**Code:
/**Code:
/**Code:
/** |
Re: [SNIPPET] Get Workshop Map Name
1 Attachment(s)
Here's version 1.1. It changes RemoveMapPath so that non-workshop maps will put the original string into destination instead of an empty string.
|
Re: [SNIPPET] Get Workshop Map Name
so strcopy(destination, maxlen, ""); is faster/better than destination[0] = 0; ?
|
Re: [SNIPPET] Get Workshop Map Name
1 Attachment(s)
Quote:
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. |
Re: [SNIPPET] Get Workshop Map Name
Am I correct to think this makes maps that look like "workshop/14235453/mapname" look like "mapname" if so, how would I go about adding this to MapChooserExtended so that it displays the clean map name in voting?
Thanks |
Re: [SNIPPET] Get Workshop Map Name
1 Attachment(s)
Quote:
Because it uses strcopy internally, I think it's safe to use the same string as the input and output. One of my MapChooser Extended branches has this already in place, but I forget what other changes I've made to it. I also forgot there was a separate thread for this. I've revamped this .inc file a bit since I originally posted it. Here's a 1.7 API version that should be considerably cleaner than the version in the first post. Note that SubString has completely gone away in this version. |
Re: [SNIPPET] Get Workshop Map Name
Quote:
|
Re: [SNIPPET] Get Workshop Map Name
Why doesn't this (substring) follow the current convention of all string/format functions that is to return the cells written?
|
Re: [SNIPPET] Get Workshop Map Name
Quote:
|
Re: [SNIPPET] Get Workshop Map Name
This include is completely obsolete now. Not only does it not cover all the use cases in CS:GO, but now TF2 supports workshop maps... in a somewhat different way than CS:GO does.
Incidentally, it'd be a huge help if someone could tell me which names can be used in CS:GO servers for workshop maps. I think someone mentioned the map workshop ID worked in addition to the map's name... I was wondering if partial filenames also worked. |
| All times are GMT -4. The time now is 18:30. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.