-
Notifications
You must be signed in to change notification settings - Fork 34
FLHook core optimizations #347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -458,6 +458,8 @@ namespace HkIServerImpl | |
|
|
||
| CHECK_FOR_DISCONNECT | ||
|
|
||
| ClientInfo[iClientID].iCharMenuEnterTime = 0; | ||
|
|
||
| CALL_PLUGINS_V(PLUGIN_HkIServerImpl_CharacterSelect, __stdcall, (struct CHARACTER_ID const & cId, unsigned int iClientID), (cId, iClientID)); | ||
|
|
||
| wstring wscCharBefore; | ||
|
|
@@ -482,36 +484,17 @@ namespace HkIServerImpl | |
| if (set_bUserCmdHelp) | ||
| PrintUserCmdText(iClientID, L"To get a list of available commands, type \"/help\" in chat."); | ||
|
|
||
| // anti-cheat check | ||
| list <CARGO_INFO> lstCargo; | ||
| int iHold; | ||
| HkEnumCargo(ARG_CLIENTID(iClientID), lstCargo, iHold); | ||
| foreach(lstCargo, CARGO_INFO, it) | ||
| { | ||
| if ((*it).iCount < 0) | ||
| { | ||
| HkAddCheaterLog(wscCharname, L"Negative good-count, likely to have cheated in the past"); | ||
|
|
||
| wchar_t wszBuf[256]; | ||
| swprintf(wszBuf, L"Possible cheating detected (%s)", wscCharname.c_str()); | ||
| HkMsgU(wszBuf); | ||
| HkBan(ARG_CLIENTID(iClientID), true); | ||
| HkKick(ARG_CLIENTID(iClientID)); | ||
| return; | ||
| } | ||
| } | ||
|
|
||
| // event | ||
| CAccount *acc = Players.FindAccountFromClientID(iClientID); | ||
| wstring wscDir; | ||
| HkGetAccountDirName(acc, wscDir); | ||
| HKPLAYERINFO pi; | ||
| HkGetPlayerInfo(ARG_CLIENTID(iClientID), pi, false); | ||
| wstring playerIP; | ||
| HkGetPlayerIP(iClientID, playerIP); | ||
| ProcessEvent(L"login char=%s accountdirname=%s id=%d ip=%s", | ||
| wscCharname.c_str(), | ||
| wscDir.c_str(), | ||
| iClientID, | ||
| pi.wscIP.c_str()); | ||
| playerIP.c_str()); | ||
| } | ||
| } CATCH_HOOK({}) | ||
|
|
||
|
|
@@ -704,19 +687,12 @@ namespace HkIServerImpl | |
|
|
||
| EXECUTE_SERVER_CALL(Server.TerminateTrade(iClientID, iAccepted)); | ||
|
|
||
| TRY_HOOK { | ||
| if (iAccepted) | ||
| { // save both chars to prevent cheating in case of server crash | ||
| HkSaveChar(ARG_CLIENTID(iClientID)); | ||
| if (ClientInfo[iClientID].iTradePartner) | ||
| HkSaveChar(ARG_CLIENTID(ClientInfo[iClientID].iTradePartner)); | ||
| } | ||
|
|
||
| if (ClientInfo[iClientID].iTradePartner) | ||
| ClientInfo[ClientInfo[iClientID].iTradePartner].iTradePartner = 0; | ||
| ClientInfo[iClientID].iTradePartner = 0; | ||
|
|
||
| } CATCH_HOOK({}) | ||
|
|
||
|
|
||
| CALL_PLUGINS_V(PLUGIN_HkIServerImpl_TerminateTrade_AFTER, __stdcall, (unsigned int iClientID, int iAccepted), (iClientID, iAccepted)); | ||
| } | ||
|
|
@@ -1017,50 +993,8 @@ namespace HkIServerImpl | |
| return; | ||
| } | ||
|
|
||
| CALL_PLUGINS_V(PLUGIN_HkIServerImpl_Login, __stdcall, (struct SLoginInfo const &li, unsigned int iClientID), (li, iClientID)); | ||
|
|
||
|
|
||
| // check for ip ban | ||
| wstring wscIP; | ||
| HkGetPlayerIP(iClientID, wscIP); | ||
|
|
||
| foreach(set_lstBans, wstring, itb) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we seem to be getting rid of random things without proper cleanup here - set_lstBans is still defined somewhere |
||
| { | ||
| if (Wildcard::wildcardfit(wstos(*itb).c_str(), wstos(wscIP).c_str())) | ||
| { | ||
| HkAddKickLog(iClientID, L"IP ban(%s matches %s)", wscIP.c_str(), (*itb).c_str()); | ||
| if (set_bBanAccountOnMatch) | ||
| HkBan(ARG_CLIENTID(iClientID), true); | ||
| HkKick(ARG_CLIENTID(iClientID)); | ||
| } | ||
| } | ||
|
|
||
| // count players | ||
| struct PlayerData *pPD = 0; | ||
| uint iPlayers = 0; | ||
| while (pPD = Players.traverse_active(pPD)) | ||
| iPlayers++; | ||
|
|
||
| if (iPlayers > (Players.GetMaxPlayerCount() - set_iReservedSlots)) | ||
| { // check if player has a reserved slot | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if we're getting rid of the reserved slots functionality altogether, HkSetReservedSlot/CmdSetReservedSlot/HkGetReservedSlot/CmdGetReservedSlot must go too |
||
| CAccount *acc = Players.FindAccountFromClientID(iClientID); | ||
| wstring wscDir; | ||
| HkGetAccountDirName(acc, wscDir); | ||
| string scUserFile = scAcctPath + wstos(wscDir) + "\\flhookuser.ini"; | ||
|
|
||
| bool bReserved = IniGetB(scUserFile, "Settings", "ReservedSlot", false); | ||
| if (!bReserved) | ||
| { | ||
| HkKick(acc); | ||
| return; | ||
| } | ||
| } | ||
|
|
||
| LoadUserSettings(iClientID); | ||
|
|
||
| // log | ||
| if (set_bLogConnects) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto |
||
| HkAddConnectLog(iClientID, wscIP); | ||
|
|
||
| } CATCH_HOOK({ | ||
| CAccount *acc = Players.FindAccountFromClientID(iClientID); | ||
|
|
@@ -1070,7 +1004,7 @@ namespace HkIServerImpl | |
| } | ||
| }) | ||
|
|
||
| CALL_PLUGINS_V(PLUGIN_HkIServerImpl_Login_AFTER, __stdcall, (struct SLoginInfo const &li, unsigned int iClientID), (li, iClientID)); | ||
| CALL_PLUGINS_V(PLUGIN_HkIServerImpl_Login, __stdcall, (struct SLoginInfo const& li, unsigned int iClientID), (li, iClientID)); | ||
| } | ||
|
|
||
| /************************************************************************************************************** | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,6 +54,30 @@ | |
| #define OBJ_ASTEROID (1 << 29) | ||
|
|
||
|
|
||
| enum EquipmentClass : uint | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok but I don't see what this has to do with optimisations |
||
| { | ||
| None = 0, | ||
| LightEquip = 1 << 0, | ||
| AttachedFx = 1 << 1, // contrails | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. where are 1<<2, 1<<3, 1<<4? |
||
| Mine = 1 << 5, | ||
| CM = 1 << 6, | ||
| Gun = 1 << 7, | ||
| Shield = 1 << 8, | ||
| ShieldGenerator = 1 << 9, | ||
| Thruster = 1 << 10, | ||
| CargoPod = 1 << 11, | ||
| CloakingDevice = 1 << 12, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. where are 1<<13, 1<<14, 1<<15? |
||
| Cargo = 1 << 16, // commodities, ammo | ||
| Engine = 1 << 17, | ||
| Power = 1 << 18, | ||
| Scanner = 1 << 19, | ||
| TractorBeam = 1 << 20, | ||
| RepairDroid = 1 << 21, | ||
| InternalFX = 1 << 22, | ||
| TradeLaneEquip = 1 << 23, | ||
| Armor = 1 << 24, | ||
| }; | ||
|
|
||
| struct IMPORT CacheString | ||
| { | ||
| void clear(void); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it safe to remove this? It seems to me that removing this creates an obvious duplication cheat.