Skip to content

Commit

Permalink
Merge pull request #10 from SaschaKP/main
Browse files Browse the repository at this point in the history
FIXES in casttime and other read values in spheretables.scp, also other fixes concerning stripping space from string names, and a minor one for overhead msg
  • Loading branch information
x-77-x authored Dec 15, 2023
2 parents 9a8b4bb + be4ea52 commit 60fcd88
Show file tree
Hide file tree
Showing 30 changed files with 616 additions and 1,970 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/msbuild.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: MSBuild

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

env:
# Path to the solution file relative to the root of the project.
SOLUTION_FILE_PATH: .

# Configuration type to build.
# You can convert this to a build matrix if you need coverage of multiple configuration types.
# https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
BUILD_CONFIGURATION: Release

permissions:
contents: read

jobs:
build:
runs-on: windows-latest

steps:
- uses: actions/checkout@v3

- name: Add MSBuild to PATH
uses: microsoft/[email protected]

- name: Restore NuGet packages
working-directory: ${{env.GITHUB_WORKSPACE}}
run: nuget restore ${{env.SOLUTION_FILE_PATH}}

- name: Build
working-directory: ${{env.GITHUB_WORKSPACE}}
# Add additional options to the MSBuild command line here (like platform or verbosity level).
# See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference
run: msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} ${{env.SOLUTION_FILE_PATH}}

- name: Upload a Build Artifact
uses: actions/[email protected]
with:
name: SphereSrv
path: ${{env.SOLUTION_FILE_PATH}}/GraySvr/Release/GraySvr.exe
# The desired behavior if no files are found using the provided path.
if-no-files-found: warn
retention-days: 90

6 changes: 4 additions & 2 deletions Common/cregion.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ struct CPointBase // Non initialized 3d point.

bool IsValid() const
{
if ( m_z <= -UO_SIZE_Z || m_z >= UO_SIZE_Z ) return( false );
if ( m_z <= UO_SIZE_MIN_Z || m_z >= UO_SIZE_Z ) return( false );
if ( m_x < 0 || m_x >= UO_SIZE_X ) return( false );
if ( m_y < 0 || m_y >= UO_SIZE_Y ) return( false );
return( true );
}
bool IsCharValid() const
{
if ( m_z <= -UO_SIZE_Z || m_z >= UO_SIZE_Z ) return( false );
if ( m_z <= UO_SIZE_MIN_Z || m_z >= UO_SIZE_Z ) return( false );
if ( m_x <= 0 || m_x >= UO_SIZE_X ) return( false );
if ( m_y <= 0 || m_y >= UO_SIZE_Y ) return( false );
return( true );
Expand Down Expand Up @@ -709,6 +709,8 @@ class CObjBaseTemplate : public CGObListRec
bool IsDisconnected() const { return( m_UID.IsDisconnected() ); }
bool IsTopLevel() const { return( m_UID.IsTopLevel() ); }
bool IsValidUID() const { return( m_UID.IsValidUID() ); }
CChar* CharFind() const { return( m_UID.CharFind()); }
CItem* ItemFind() const { return( m_UID.ItemFind()); }

#if defined(_DEBUG) && defined(GRAY_SVR) // CObjBaseTemplate
bool IsValidContainer() const; // am i really in the container i say i am ?
Expand Down
13 changes: 13 additions & 0 deletions Common/cscript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1184,6 +1184,19 @@ bool CScriptObj::r_GetRef( const TCHAR * & pszKey, CScriptObj * & pRef, CTextCon
pRef = uid.ObjFind();
return( true );
}

if (!strnicmp(pszKey, "ARGO.", 5))
{
CObjUID uid = CObjUID(pRef->sm_iTrigArg);
if (uid.IsChar())
pRef = uid.CharFind();
else if (uid.IsItem())
pRef = uid.ItemFind();
if (pRef == NULL)
return false;
pszKey += 5;
return(true);
}
#endif

if ( ! strnicmp( pszKey, "I.", 2 )) // just talking about myself.
Expand Down
14 changes: 8 additions & 6 deletions Common/cstring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ int FindTable( const TCHAR * pFind, const TCHAR * const * ppTable, int iCount, i
return( -1 );
}

int GetBareText( TCHAR * pszOut, const TCHAR * pszInp, int iMaxSize, const TCHAR * pszStrip )
int GetBareText( TCHAR * pszOut, const TCHAR * pszInp, int iMaxSize, const TCHAR * pszStrip, BYTE mask )
{
// Allow only the basic set of chars. Non UNICODE !
// That the client can deal with.
Expand All @@ -241,7 +241,7 @@ int GetBareText( TCHAR * pszOut, const TCHAR * pszInp, int iMaxSize, const TCHAR
TCHAR ch = pszInp[i];
if ( ch )
{
if ( ch < ' ' || ch >= 127 )
if ( ch < ' ' || ch >= mask )
continue; // Special format chars.
int k=0;
while ( pszStrip[k] && pszStrip[k] != ch )
Expand Down Expand Up @@ -681,10 +681,12 @@ char* strip_extra_spaces(char* str, bool trim)

// Trim trailing space
end = str + strlen(str) - 1;
while (end > str && isspace((unsigned char)*end)) end--;

// Write new null terminator character
end[1] = '\0';
while (end > str && isspace((unsigned char)*end))
{
end--;
// Write new null terminator character
end[1] = '\0';
}
}

int i, x;
Expand Down
4 changes: 2 additions & 2 deletions Common/cstring.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ enum MATCH_TYPE // match result defines
extern MATCH_TYPE Text_Match( const TCHAR *pPattern, const TCHAR * pText );

extern TCHAR * GetTempStr();
extern int GetBareText( TCHAR * pszOut, const TCHAR * pszInp, int iMaxSize, const TCHAR * pszStrip = NULL );
extern int GetBareText( TCHAR * pszOut, const TCHAR * pszInp, int iMaxSize, const TCHAR * pszStrip = NULL, BYTE mask = 127);
extern TCHAR * MakeFilteredStr( TCHAR * pStr );
extern int strcpylen( TCHAR * pDst, const TCHAR * pSrc );
extern int strcpylen( TCHAR * pDst, const TCHAR * pSrc, int imaxlen );
Expand All @@ -245,6 +245,6 @@ extern int FindTableSorted( const TCHAR * pFind, const TCHAR * const * ppTable,

extern int ChkStrn(char* s, const char* sym, DWORD len);
extern int ChkStr(char* s, const char* sym);
extern char* strip_extra_spaces(char* str, bool trim = true);
extern char* strip_extra_spaces(char* str, bool trim);

#endif // _INC_CSTRING_H
6 changes: 0 additions & 6 deletions GraySvr.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,12 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GraySvr", "GraySvr\GraySvr.
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{9F35F446-79BA-4CAD-9E78-674D4E3552E3}.Debug|x64.ActiveCfg = Debug|x64
{9F35F446-79BA-4CAD-9E78-674D4E3552E3}.Debug|x64.Build.0 = Debug|x64
{9F35F446-79BA-4CAD-9E78-674D4E3552E3}.Debug|x86.ActiveCfg = Debug|Win32
{9F35F446-79BA-4CAD-9E78-674D4E3552E3}.Debug|x86.Build.0 = Debug|Win32
{9F35F446-79BA-4CAD-9E78-674D4E3552E3}.Release|x64.ActiveCfg = Release|x64
{9F35F446-79BA-4CAD-9E78-674D4E3552E3}.Release|x64.Build.0 = Release|x64
{9F35F446-79BA-4CAD-9E78-674D4E3552E3}.Release|x86.ActiveCfg = Release|Win32
{9F35F446-79BA-4CAD-9E78-674D4E3552E3}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
Expand Down
Loading

0 comments on commit 60fcd88

Please sign in to comment.