forked from ValveSoftware/source-sdk-2013
-
Notifications
You must be signed in to change notification settings - Fork 159
Mapbase v8.0 #429
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
Merged
Mapbase v8.0 #429
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
On every save on a load, these functions would keep reference to their old versions from the previous save which kept stacking up on each load-save
When a Vector or QAngle rvalue reference is returned from a VScript function, the constructed ScriptVariant_t must not store the pointer to it since it is, per convention, a temporary reference. Only do that for lvalue-references, but do a copy when constructing from or assigning a rvalue reference.
Type FIELD_HSCRIPT is removed, it never sets SV_FREE. All dynamic memory is now free`d via free(). For strdup(), this would be the conformant way in standard C++. It matters not in Source, since both use the same global allocator of the engine, but it is tidier. Vector and QAngle are now allocated via malloc() instead of new to provide symmetry.
When assigning a null value in getVariant(), make sure a previous SV_FREE is not carried over. In SqurrelVM::ReleaseValue(), make sure SV_FREE is not kept after Free()ing a value.
Instead of temporary allocating dynamic memory, which subsequently is copied into another dynamically allocated piece of memory, provide a temporary buffer on the stack. The script value inserted into the VM still needs to allocate dynamically though... A few sites are adapted to not create a ScriptVariant_t from a temporary Vector to avoid dynamic allocation there too. cf. #321
They wouldn't even work.
Free values before assignment.
They were broken, and only add for Quaternions was implemented, for which there is a working QuaternionAdd() script function instead. Fixing it seems like unnecessary work.
… has userpointer type This prevents memory errors when incorrectly invoking native member functions from Squirrel.
…on call This enhances the ScriptFuncDescriptor_t to record the ScriptClassDesc_t of the class for which it gets invoked. The ScriptClassDesc_t are traversed in the function_stub() for native function calls for member functions, to ensure the passed in instance has a compatible type. This prevents memory errors when incorrectly invoking native member functions from Squirrel.
This prevents manual invocations of the Vector.constructor with an invalid value.
…meters This prevents manual invocations of the native class constructor for non-class values or non-native classes.
This prevents manual invocations of the native class constructor with an invalid value.
The function_stub() resets it when used.
Also streamline SQUserPointer usage in sq_getinstanceup() and sq_getuserpointer() calls to write directly to a pointer of the expected type.
This fixes a memory leak.
VScript member function call safety
vscript saverestore and debugger fixes
Fallback if IScriptInstanceHelper::Get/Set are not implemented
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Large update with a focus on player model support, VScript fixes, and a new generation of saves.
After Mapbase mods started getting released on Steam (e.g. Entropy : Zero 2), preserving existing saves after updates became a major concern. This led to some important changes being put off due to perceived or confirmed lack of save compatibility, most notably #221, which fixes save/restore issues that have severely undermined Mapbase's singleplayer VScript since it was first released.
Mapbase v8.0 is the first update since v7.0 that definitively breaks saves, and it does so by design. This means there are much larger changes included here compared to the last few updates.