-
-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add precache_player_model #533
base: master
Are you sure you want to change the base?
Changes from 1 commit
a84e1f0
3e56bba
0b9d9e7
d1e9c0c
109837d
f48e728
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -921,6 +921,7 @@ stock precache_player_model(const name[], &id = 0) | |
if(file_exists(model)) | ||
id = precache_generic(model); | ||
|
||
replace_string(model[strlen(model) - 5], charsmax(model), "T.mdl", ".mdl"); | ||
static const extension[] = "T.mdl"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why static ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @justgo97 It doesn't need to be defined more than once. It acts like a global variable with a local scope. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. static is bad here because its lifetime (or "extent") is the entire run of the program while these stock will be only used in one forward. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah but this string constant is pretty small in size and in its use having it static means it will stay in memory all the time while its only needed at the 1-2 seconds of map start for plugin_precache forward ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @justgo97 no, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @WPMGPRoSToTeMa I mean in overall which is better for memory ?
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @justgo97 if consider only permanent memory, then they are both the same. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @WPMGPRoSToTeMa so for non-permanent memory new is better, which is an advantage for new over static ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It doesn't matter, you shouldn't spend time deciding that while coding. |
||
replace_string(model[charsmax(extension)], charsmax(model), extension, ".mdl"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
return precache_model(model); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not the way how it should be checked, you need to check if model really needs it rehlds/ReHLDS@9080b9b#diff-462e3f794ed90c12c86f5d8d5b725c4aR5405.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@WPMGPRoSToTeMa Which I assume can't be done with a stock?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@OciXCrom it can be done through the reading of model file.