Skip to content

Commit

Permalink
Different fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
cvet committed Jan 10, 2022
1 parent dee9de7 commit 426bc94
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 6 deletions.
6 changes: 3 additions & 3 deletions BuildTools/codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -628,10 +628,10 @@ def parseOtherTags():

try:
tok = [s.strip() for s in tagInfo.split(' ') if s.strip()]
entity = tok[0]

target = tok[1]
target = tok[0]
assert target in ['Server', 'Client', 'Mapper', 'Common'], target
entity = tok[1]
eventName = tok[2] if '(' not in tok[2] else tok[2][:tok[2].find('(')]

braceOpenPos = tagInfo.find('(')
Expand Down Expand Up @@ -1543,7 +1543,7 @@ def writeMarshalingMethod(entity, targ, name, ret, params, isASGlobal):
for rcTag in codeGenTags['RemoteCall']:
targ, subsystem, rcName, rcArgs, rcFlags, _ = rcTag
if targ == ('Client' if target == 'Server' else 'Server') and subsystem == 'AngelScript':
selfArg = 'Critter* self' if target == 'Server' else 'FOClient* self'
selfArg = 'Player* self' if target == 'Server' else 'FOClient* self'
globalLines.append('static void ASRemoteCall_' + rcName + '(' + selfArg + (', ' if rcArgs else '') + ', '.join([metaTypeToASEngineType(p[0]) + ' ' + p[1] for p in rcArgs]) + ')')
globalLines.append('{')
globalLines.append('}')
Expand Down
2 changes: 1 addition & 1 deletion Source/Scripting/AngelScriptScripting-Template.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1296,7 +1296,7 @@ void SCRIPTING_CLASS::InitAngelScriptScripting(INIT_ARGS)
}

#if SERVER_SCRIPTING
AS_VERIFY(engine->RegisterObjectProperty("Critter", "RemoteCaller ClientCall", 0));
AS_VERIFY(engine->RegisterObjectProperty("Player", "RemoteCaller ClientCall", 0));
#elif CLIENT_SCRIPTING
AS_VERIFY(engine->RegisterGlobalProperty("RemoteCaller ServerCall", game_engine));
#endif
Expand Down
31 changes: 31 additions & 0 deletions Source/Scripting/ServerCritterScriptMethods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,29 @@

// ReSharper disable CppInconsistentNaming

///# ...
///# return ...
///@ ExportMethod
[[maybe_unused]] bool Server_Critter_IsFree(Critter* self)
{
return false;
}

///# ...
///# return ...
///@ ExportMethod
[[maybe_unused]] bool Server_Critter_IsBusy(Critter* self)
{
return false;
}

///# ...
///# param ms ...
///@ ExportMethod
[[maybe_unused]] void Server_Critter_Wait(Critter* self, uint ms)
{
}

///# ...
///# return ...
///@ ExportMethod ExcludeInSingleplayer
Expand All @@ -57,6 +80,14 @@
return self->IsNpc();
}

///# ...
///# return ...
///@ ExportMethod ExcludeInSingleplayer
[[maybe_unused]] Player* Server_Critter_GetOwner(Critter* self)
{
return self->GetOwner();
}

///# ...
///# return ...
///@ ExportMethod
Expand Down
8 changes: 8 additions & 0 deletions Source/Scripting/ServerPlayerScriptMethods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@

// ReSharper disable CppInconsistentNaming

///# ...
///# return ...
///@ ExportMethod ExcludeInSingleplayer
[[maybe_unused]] Critter* Server_Player_GetOwnedCritter(Player* self)
{
return self->GetOwnedCritter();
}

///# ...
///# return ...
///@ ExportMethod
Expand Down
9 changes: 7 additions & 2 deletions ThirdParty/AngelScript/preprocessor/preprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1230,13 +1230,18 @@ void Preprocessor::PrintLexemList( LexemList& out, OutStream& destination )
{
if( need_a_space )
destination << " ";
need_a_space = true;
destination << itr->Value;
need_a_space = true;
}
else
else if( itr->Type == BACKSLASH )
{
destination << " ";
need_a_space = false;
}
else
{
destination << itr->Value;
need_a_space = false;
}
}
}
Expand Down

0 comments on commit 426bc94

Please sign in to comment.