Skip to content
Permalink
Browse files
Fix characters going missing in "PushLongString"
  • Loading branch information
crosire committed Oct 14, 2019
1 parent 728f0b5 commit 85f1394dae4baf7c69f7e32e92f2d888270c4058
Showing with 4 additions and 6 deletions.
  1. +1 −1 source/core/DllMain.cpp
  2. +3 −5 source/core/NativeFunc.cs
@@ -32,7 +32,7 @@ public ref class ScriptHookVDotNet
static void Help()
{
console->PrintInfo("~c~--- Help ---");
console->PrintInfo("The console accepts C# expressions as input and has full access to the scripting API. To print the result of an expression, simply add \"return\" in front of it.");
console->PrintInfo("The console accepts ~h~C# expressions~h~ as input and has full access to the scripting API. To print the result of an expression, simply add \"return\" in front of it.");
console->PrintInfo("You can use \"P\" as a shortcut for the player character and \"V\" for the current vehicle (without the quotes).");
console->PrintInfo("Example: \"return P.IsInVehicle()\" will print a boolean value indicating whether the player is currently sitting in a vehicle to the console.");
console->PrintInfo("~c~--- Commands ---");
@@ -89,8 +89,7 @@ public static void PushLongString(string str, Action<string> action)
{
const int maxLengthUtf8 = 99;

int size = Encoding.UTF8.GetByteCount(str);
if (size <= maxLengthUtf8)
if (Encoding.UTF8.GetByteCount(str) <= maxLengthUtf8)
{
action(str);
return;
@@ -145,16 +144,15 @@ public static void PushLongString(string str, Action<string> action)
{
action(str.Substring(startPos, currentPos - startPos));

currentUtf8StrLength = 0;
startPos = currentPos;
currentUtf8StrLength = 0;
}
else
{
currentPos++;
currentUtf8StrLength += codePointSize;
}

currentPos++;

// Additional increment is needed for surrogate
if (codePointSize == 4)
{

0 comments on commit 85f1394

Please sign in to comment.