-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathQuickGame.cpp
57 lines (49 loc) · 1.3 KB
/
QuickGame.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include "stdafx.h"
#ifdef MODULE_QUICKGAME
void SaveGameName() {
if(GAMEINFO->szGameName[0]) {
wcscpy2(wszGameName, GAMEINFO->szGameName);
wcscpy2(wszGamePassword, GAMEINFO->szGamePassword);
}
}
void QuickExitGame(){
if (fCanExitGame==FALSE)return;
fCanExitGame = FALSE;
ExitGame();
}
void QuickNextGame(int addnum)
{
if (fCanExitGame==FALSE)return;
fCanExitGame = FALSE;
wchar_t *nptr = wszGameName+wcslen(wszGameName)-1;
wchar_t *endptr = nptr+1;
while (nptr >= wszGameName && (*nptr == L'0' || iswdigit(*nptr))) {
--nptr;
}
if (nptr < endptr-1) {
long n = wcstol(++nptr, &endptr, 10);
wchar_t temp[32];
wsprintfW(temp, L"%d", n+addnum);
wchar_t *nptr2 = endptr-wcslen(temp);
if (nptr < nptr2) nptr = nptr2;
wcscpy(nptr, temp);
}
ExitGame();
}
void __fastcall NextGameNamePatch(D2EditBox* box, BOOL (__stdcall *FunCallBack)(D2EditBox*,DWORD,char*))
{
if (!fAutoNextGameName) return;
D2SetEditBoxText(box, wszGameName);
D2SelectEditBoxText(box);
// original code
D2SetEditBoxProc(box, FunCallBack);
}
void __fastcall NextGamePasswordPatch(D2EditBox* box, BOOL (__stdcall *FunCallBack)(D2EditBox*,DWORD,char*))
{
if (!fAutoNextGamePassword) return;
D2SetEditBoxText(box, wszGamePassword);
D2SelectEditBoxText(box);
// original code
D2SetEditBoxProc(box, FunCallBack);
}
#endif