Skip to content

Commit 2916061

Browse files
committed
Fixed #9738 ([Request] refreshResource function) by adding optional resource argument to refreshResources function
1 parent 67b40ed commit 2916061

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

Server/mods/deathmatch/logic/CConsoleCommands.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,15 +135,15 @@ bool CConsoleCommands::RestartResource ( CConsole* pConsole, const char* szArgum
135135
bool CConsoleCommands::RefreshResources ( CConsole* pConsole, const char* szArguments, CClient* pClient, CClient* pEchoClient )
136136
{
137137
BeginConsoleOutputCapture ( pEchoClient );
138-
g_pGame->GetResourceManager ()->Refresh ( false, "", SStringX( szArguments ) == "t" );
138+
g_pGame->GetResourceManager ()->Refresh ( false, szArguments );
139139
EndConsoleOutputCapture ( pEchoClient, "refresh completed" );
140140
return true;
141141
}
142142

143143
bool CConsoleCommands::RefreshAllResources ( CConsole* pConsole, const char* szArguments, CClient* pClient, CClient* pEchoClient )
144144
{
145145
BeginConsoleOutputCapture ( pEchoClient );
146-
g_pGame->GetResourceManager ()->Refresh ( true );
146+
g_pGame->GetResourceManager ()->Refresh ( true, szArguments );
147147
EndConsoleOutputCapture ( pEchoClient, "refreshall completed" );
148148
return true;
149149
}

Server/mods/deathmatch/logic/CResourceManager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -850,11 +850,11 @@ void CResourceManager::ProcessQueue ( void )
850850
}
851851
else if ( sItem.eQueue == QUEUE_REFRESH )
852852
{
853-
Refresh();
853+
Refresh( false, sItem.pResource ? sItem.pResource->GetName() : "" );
854854
}
855855
else if ( sItem.eQueue == QUEUE_REFRESHALL )
856856
{
857-
Refresh( true );
857+
Refresh( true, sItem.pResource ? sItem.pResource->GetName() : "" );
858858
}
859859
}
860860

Server/mods/deathmatch/logic/luadefs/CLuaResourceDefs.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,17 +1196,19 @@ int CLuaResourceDefs::call ( lua_State* luaVM )
11961196

11971197
int CLuaResourceDefs::refreshResources ( lua_State* luaVM )
11981198
{
1199-
bool bRefreshAll;
1199+
// bool refreshResources ( [ bool refreshAll = false, resource onlyThisResource = nil ] )
1200+
bool bRefreshAll; CResource* pResource;
12001201

12011202
CScriptArgReader argStream ( luaVM );
12021203
argStream.ReadBool ( bRefreshAll, false );
1204+
argStream.ReadUserData(pResource, nullptr);
12031205

12041206
if ( !argStream.HasErrors ( ) )
12051207
{
12061208
if ( bRefreshAll )
1207-
m_pResourceManager->QueueResource( NULL, CResourceManager::QUEUE_REFRESHALL, NULL );
1209+
m_pResourceManager->QueueResource( pResource, CResourceManager::QUEUE_REFRESHALL, NULL );
12081210
else
1209-
m_pResourceManager->QueueResource( NULL, CResourceManager::QUEUE_REFRESH, NULL );
1211+
m_pResourceManager->QueueResource( pResource, CResourceManager::QUEUE_REFRESH, NULL );
12101212

12111213
lua_pushboolean ( luaVM, true );
12121214
return 1;

0 commit comments

Comments
 (0)