-
Notifications
You must be signed in to change notification settings - Fork 23
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
Get rid of the SDK submodules and move the code into the repo #352
Conversation
This clang-format version crap is very tragic - your version is different from mine so you have a lot of unnecessary format diffs. I'll look into setting up a specific clang-format/uncrustify version, or we should completely nuke the formatting. |
spt/features/autocomplete.cpp
Outdated
playdemoCommand = reinterpret_cast<ConCommand_guts*>(interfaces::g_pCVar->FindCommand("playdemo")); | ||
loadCommand = reinterpret_cast<ConCommand_guts*>(interfaces::g_pCVar->FindCommand("load")); | ||
execCommand = reinterpret_cast<ConCommand_guts*>(interfaces::g_pCVar->FindCommand("exec")); | ||
playdemoCommand = reinterpret_cast<ConCommand_guts*>(g_pCVar->FindCommand("playdemo")); |
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.
Do we still need these _guts classes? With every member being public now, there isn't much of a reason to use these anymore. Even if some piece of code is reading from the vtable member(s), it should be easy to live without it.
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.
they aren't really needed but I was too lazy to clean up everything
spt/cvars.cpp
Outdated
@@ -88,23 +78,20 @@ extern "C" ICvar* GetCVarIF() | |||
} | |||
} | |||
|
|||
static void RemoveCommandFromList(ConCommandBase** head, ConCommandBase* command) | |||
static void RemoveCommandFromList(ConCommandBase* command) |
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.
I'm not sure if it's worth it to make this function specific to s_pConCommandBases but still have a generic version copied below for OE (outside of an #ifdef OE block too). This originally took the list head as parameter to avoid effectively repeating code.
spt/cvars.cpp
Outdated
@@ -23,31 +23,21 @@ struct FeatureCommand | |||
bool unhideOnUnregister; | |||
}; | |||
static std::vector<FeatureCommand> cmd_to_feature; | |||
static bool first_time_init = true; | |||
static ConCommandBase** pluginCommandListHead = nullptr; |
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.
This can be removed now
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.
I think this was already removed but should be now at least
spt/cvars.cpp
Outdated
continue; | ||
} | ||
else |
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.
This else
block is redundant, is it not?
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.
Not in OE. The plugin unload does not get rid of the binary (the fix that works in 3420 hasn't been ported over there). So the commands need to be put back in the plugin list in order to work next time the plugin is loaded.
spt/cvars.cpp
Outdated
if (inittedCmd == cmd_to_feature.end()) | ||
{ | ||
DevWarning("Command %s was unloaded, because it was not initialized!\n", cmdName); | ||
ConCommandBase* todelete = cmd; | ||
cmd = (ConCommandBase*)cmd->GetNext(); | ||
RemoveCommandFromList(pluginCommandListHead, todelete); | ||
RemoveCommandFromList(todelete); |
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.
Given that we go through our own list and register each ConCommand by hand, we could probably handle the local list differently, but we can leave that for a day with better moisture and wind speed conditions
spt/cvars.cpp
Outdated
return; | ||
|
||
ConCommandBase::s_pConCommandBases = NULL; |
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.
If you care about mimicking what the engine does naturally, this should be moved to the end of of Cvar_RegisterSPTCvars. Atm we are kinda living with a somewhat bogus pointer in this variable through the lifetime of the plugin since it's never cleared
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.
The reasoning for this is that in OE the plugin list contains (at least?) one concommand after the cvars have been loaded normally. This caused a crash upon reloading the plugin
spt/spt-serverplugin.cpp
Outdated
|
||
extern "C" __declspec(dllexport) const void* CreateInterface(const char* pName, int* pReturnCode) { | ||
if (pReturnCode) { | ||
*pReturnCode = 2007; |
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.
According to the sdk
if pReturnCode is set, it will return one of the following values (IFACE_OK, IFACE_FAILED)
Also, should we check for the INTERFACEVERSION_ISERVERPLUGINCALLBACKS
?
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.
Checking for the version is not necessary. I also just set the return code to something funny since it isn't actually used.
Redo of #351