Skip to content

Commit 0acf209

Browse files
authored
Merge branch 'master' into nitro
2 parents cd5a83b + b6d7258 commit 0acf209

File tree

610 files changed

+57775
-31355
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

610 files changed

+57775
-31355
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Crowdin Auto-Merge
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * 5' # This cron expression runs the workflow every Friday at midnight (UTC)
6+
workflow_dispatch:
7+
8+
jobs:
9+
crowdin-auto-merge:
10+
if: github.event.repository.fork == false
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Setup Git
19+
run: |
20+
git config --global user.name 'github-actions[bot]'
21+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
22+
23+
- name: Auto-merge pull request
24+
run: |
25+
PR_NUMBER=$(gh pr list --repo ${{ github.repository }} --author 'MTABot' --base 'master' --head 'l10n/master' --state open --json number --jq '.[0].number')
26+
if [ -n "$PR_NUMBER" ]; then
27+
gh pr merge $PR_NUMBER --squash --repo ${{ github.repository }} --admin --subject "New Crowdin updates (PR #$PR_NUMBER)" --body ""
28+
git push origin --delete l10n/master
29+
fi
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/dockerimage.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ jobs:
2626
dockerfile: Dockerfile.armhf
2727
- tag: arm64
2828
dockerfile: Dockerfile.arm64
29+
if: github.event.repository.fork == false
2930
runs-on: ubuntu-latest
3031
steps:
3132
- uses: actions/checkout@v4

.github/workflows/rebuild-pots.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on: [push, workflow_dispatch]
44

55
jobs:
66
test:
7+
if: github.event.repository.fork == false
78
runs-on: ubuntu-latest
89
steps:
910
- uses: actions/checkout@v4
@@ -23,6 +24,7 @@ jobs:
2324
run: pytest "utils/localization/tests"
2425
shell: bash -l {0}
2526
rebuild-pots:
27+
if: github.event.repository.fork == false
2628
runs-on: ubuntu-latest
2729
needs: test
2830
steps:
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: "Update crowdin-translators.json"
2+
3+
on:
4+
workflow_dispatch:
5+
delete:
6+
branches:
7+
- l10n/master
8+
9+
jobs:
10+
generate_translators:
11+
if: github.event.repository.fork == false
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
with:
17+
ref: master
18+
token: ${{ secrets.POT_CI_PAT }}
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: latest
24+
cache: 'npm'
25+
cache-dependency-path: ./utils/localization/generate-translators/package-lock.json
26+
27+
- name: Install dependencies
28+
working-directory: ./utils/localization/generate-translators
29+
run: npm clean-install
30+
31+
- name: Generate translators
32+
working-directory: ./utils/localization/generate-translators
33+
env:
34+
CROWDIN_TOKEN: "${{ secrets.CROWDIN_TOKEN }}"
35+
CROWDIN_ORGANIZATION: "multitheftauto"
36+
CROWDIN_PROJECT_ID: "13" # Multi Theft Auto
37+
CROWDIN_IGNORE_USER_ID: "2" # multitheftautoqa
38+
run: npm run ci
39+
40+
- name: Commit changes
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
run: |
44+
git config --global user.name 'github-actions[bot]'
45+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
46+
47+
git add ./utils/localization/generate-translators/crowdin-translators.json
48+
49+
if ! git diff-index --quiet HEAD; then
50+
git commit -m "Update crowdin-translators.json" -m "[ci skip]"
51+
git push
52+
fi

.github/workflows/stale.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66

77
jobs:
88
stale:
9+
if: github.event.repository.fork == false
910
runs-on: ubuntu-latest
1011
steps:
1112
- uses: multitheftauto/[email protected]

.github/workflows/sync-master-to-maetro.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77

88
jobs:
99
sync-master-to-maetro:
10+
if: github.event.repository.fork == false
1011
runs-on: ubuntu-latest
1112
steps:
1213
- uses: actions/checkout@v4

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,3 +416,4 @@ utils/DXFiles/
416416
!*.dll
417417
!*.exe
418418
utils/vswhere.exe
419+
*.generated.h

Client/cefweb/CWebCore.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ std::unordered_set<SString> CWebCore::AllowPendingPages(bool bRemember)
409409
}
410410

411411
// Trigger an event now
412-
auto pCurrentMod = g_pCore->GetModManager()->GetCurrentMod();
412+
auto pCurrentMod = g_pCore->GetModManager()->GetClient();
413413
if (!pCurrentMod)
414414
return std::unordered_set<SString>();
415415

Client/core/CChat.cpp

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,29 @@ bool CChat::CharacterKeyHandler(CGUIKeyEventArgs KeyboardArgs)
650650

651651
// If the input isn't empty and isn't identical to the previous entry in history, add it to the history
652652
if (!m_strInputText.empty() && (m_pInputHistory->Empty() || m_pInputHistory->GetLast() != m_strInputText))
653-
m_pInputHistory->Add(m_strInputText);
653+
{
654+
if (m_strCommand.empty() && m_strInputText[0] != '/')
655+
{
656+
// If the input is not a command, store it
657+
m_pInputHistory->Add(m_strInputText);
658+
}
659+
else if (m_strCommand.compare("login") != 0)
660+
{
661+
// If the input is a command, check that it isn't the 'login' command, if it is censor it
662+
char szInput[256];
663+
unsigned int uiLength = sizeof(szInput) - 1;
664+
665+
strncpy(szInput, m_strInputText.c_str() + 1, uiLength);
666+
szInput[uiLength] = '\0';
667+
668+
const char* szCommand = strtok(szInput, " ");
669+
670+
if (szCommand && (strcmp(szCommand, "login") != 0))
671+
m_pInputHistory->Add(m_strInputText);
672+
else if ((m_pInputHistory->Empty() || m_pInputHistory->GetLast() != std::string("/login")))
673+
m_pInputHistory->Add("/login");
674+
}
675+
}
654676

655677
SetInputVisible(false);
656678

@@ -677,11 +699,11 @@ bool CChat::CharacterKeyHandler(CGUIKeyEventArgs KeyboardArgs)
677699
SString strPlayerNamePart = strCurrentInput.substr(iFound);
678700

679701
CModManager* pModManager = CModManager::GetSingletonPtr();
680-
if (pModManager && pModManager->GetCurrentMod())
702+
if (pModManager && pModManager->IsLoaded())
681703
{
682704
// Create vector and get playernames from deathmatch module
683705
std::vector<SString> vPlayerNames;
684-
pModManager->GetCurrentMod()->GetPlayerNames(vPlayerNames);
706+
pModManager->GetClient()->GetPlayerNames(vPlayerNames);
685707

686708
for (std::vector<SString>::iterator iter = vPlayerNames.begin(); iter != vPlayerNames.end(); ++iter)
687709
{

Client/core/CCommandFuncs.cpp

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -167,36 +167,13 @@ void CCommandFuncs::Clear(const char* szParameters)
167167

168168
void CCommandFuncs::Load(const char* szParameters)
169169
{
170-
if (!szParameters)
171-
{
172-
CCore::GetSingleton().GetConsole()->Printf("* Syntax: load <mod-name> [<arguments>]");
173-
return;
174-
}
175-
176-
// Copy the buffer
177-
char* szTemp = new char[strlen(szParameters) + 1];
178-
strcpy(szTemp, szParameters);
179-
180-
// Split it up into mod name and the arguments
181-
char* szModName = strtok(szTemp, " ");
182-
char* szArguments = strtok(NULL, "\0");
183-
184-
if (szModName)
185-
{
186-
// Load the mod with the given arguments
187-
CModManager::GetSingleton().RequestLoad(szModName, szArguments);
188-
}
189-
else
190-
CCore::GetSingleton().GetConsole()->Printf("* Syntax: load <mod-name> [<arguments>]");
191-
192-
// Free the temp buffer
193-
delete[] szTemp;
170+
CModManager::GetSingleton().RequestLoad(szParameters);
194171
}
195172

196173
void CCommandFuncs::Unload(const char* szParameters)
197174
{
198175
// Any mod loaded?
199-
if (CModManager::GetSingleton().GetCurrentMod())
176+
if (CModManager::GetSingleton().IsLoaded())
200177
{
201178
// Unload it
202179
CModManager::GetSingleton().RequestUnload();
@@ -209,6 +186,12 @@ void CCommandFuncs::Unload(const char* szParameters)
209186

210187
void CCommandFuncs::Connect(const char* szParameters)
211188
{
189+
if (!CCore::GetSingleton().IsNetworkReady())
190+
{
191+
CCore::GetSingleton().GetConsole()->Print(_("connect: Network is not ready, please wait a moment"));
192+
return;
193+
}
194+
212195
// Parse the arguments (host port nick pass)
213196
char szBuffer[256] = "";
214197
if (szParameters)
@@ -264,7 +247,7 @@ void CCommandFuncs::Connect(const char* szParameters)
264247
CModManager::GetSingleton().Unload();
265248

266249
// Only connect if there is no mod loaded
267-
if (!CModManager::GetSingleton().GetCurrentMod())
250+
if (!CModManager::GetSingleton().IsLoaded())
268251
{
269252
// Start the connect
270253
if (CCore::GetSingleton().GetConnectManager()->Connect(szHost, usPort, strNick.c_str(), szPass))
@@ -284,7 +267,7 @@ void CCommandFuncs::Connect(const char* szParameters)
284267

285268
void CCommandFuncs::ReloadNews(const char* szParameters)
286269
{
287-
if (CModManager::GetSingleton().GetCurrentMod())
270+
if (CModManager::GetSingleton().IsLoaded())
288271
{
289272
CCore::GetSingleton().GetConsole()->Print("reloadnews: can't do this whilst connected to server");
290273
return;
@@ -296,6 +279,12 @@ void CCommandFuncs::ReloadNews(const char* szParameters)
296279

297280
void CCommandFuncs::Reconnect(const char* szParameters)
298281
{
282+
if (!CCore::GetSingleton().IsNetworkReady())
283+
{
284+
CCore::GetSingleton().GetConsole()->Print(_("reconnect: Network is not ready, please wait a moment"));
285+
return;
286+
}
287+
299288
CModManager::GetSingleton().Unload();
300289

301290
std::string strHost, strNick, strPassword;
@@ -309,7 +298,7 @@ void CCommandFuncs::Reconnect(const char* szParameters)
309298
CModManager::GetSingleton().Unload();
310299

311300
// Any mod loaded?
312-
if (!CModManager::GetSingleton().GetCurrentMod())
301+
if (!CModManager::GetSingleton().IsLoaded())
313302
{
314303
// Verify and convert the port number
315304
if (uiPort <= 0 || uiPort > 0xFFFF)

0 commit comments

Comments
 (0)