From 1cfbf61ceb3fcd19e8194dbaaee947cd3a68c083 Mon Sep 17 00:00:00 2001 From: allejo Date: Fri, 20 Jan 2017 12:11:13 -0800 Subject: [PATCH] Rename PollOption to PollType --- Xcode/BZFlag.xcodeproj/project.pbxproj | 36 +++++++-------- include/VotingArbiter.h | 12 ++--- include/bzfsAPI.h | 12 ++--- plugins/customPollOptionSample/Makefile.am | 19 -------- plugins/customPollTypeSample/Makefile.am | 19 ++++++++ .../README.customPollTypeSample.txt} | 16 +++---- .../customPollTypeSample.cpp} | 32 ++++++------- .../customPollTypeSample.def} | 2 +- .../customPollTypeSample.sln} | 2 +- .../customPollTypeSample.vcxproj} | 46 +++++++++---------- src/bzfs/bzfs.cxx | 4 +- src/bzfs/bzfsAPI.cxx | 8 ++-- src/bzfs/commands.cxx | 18 ++++---- src/game/VotingArbiter.cxx | 14 +++--- 14 files changed, 120 insertions(+), 120 deletions(-) delete mode 100644 plugins/customPollOptionSample/Makefile.am create mode 100644 plugins/customPollTypeSample/Makefile.am rename plugins/{customPollOptionSample/README.customPollOptionSample.txt => customPollTypeSample/README.customPollTypeSample.txt} (72%) rename plugins/{customPollOptionSample/customPollOptionSample.cpp => customPollTypeSample/customPollTypeSample.cpp} (65%) rename plugins/{customPollOptionSample/customPollOptionSample.def => customPollTypeSample/customPollTypeSample.def} (74%) rename plugins/{customPollOptionSample/customPollOptionSample.sln => customPollTypeSample/customPollTypeSample.sln} (90%) rename plugins/{customPollOptionSample/customPollOptionSample.vcxproj => customPollTypeSample/customPollTypeSample.vcxproj} (87%) diff --git a/Xcode/BZFlag.xcodeproj/project.pbxproj b/Xcode/BZFlag.xcodeproj/project.pbxproj index 676e3016aa..c4094820c9 100644 --- a/Xcode/BZFlag.xcodeproj/project.pbxproj +++ b/Xcode/BZFlag.xcodeproj/project.pbxproj @@ -518,7 +518,7 @@ 03FA74341742606400573D2D /* serverSidePlayerSample.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 03FA742E1742601B00573D2D /* serverSidePlayerSample.dylib */; }; 03FA7435174260CB00573D2D /* playerHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF8950DD16E42CF800BA9DD5 /* playerHandler.cpp */; }; 03FA7436174260D700573D2D /* serverSidePlayerSample.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF8950DF16E42CF800BA9DD5 /* serverSidePlayerSample.cpp */; }; - C333EFD41E2B9F5500B4B182 /* customPollOptionSample.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C333EFCE1E2B9F5500B4B182 /* customPollOptionSample.cpp */; }; + C333EFD41E2B9F5500B4B182 /* customPollTypeSample.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C333EFCE1E2B9F5500B4B182 /* customPollTypeSample.cpp */; }; C353B1DB1AE23A0C00C5AED5 /* CustomZoneSample.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = C353B1D71AE239CC00C5AED5 /* CustomZoneSample.dylib */; }; C353B1E71AE23CA900C5AED5 /* CustomZoneSample.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C353B1E01AE23C8100C5AED5 /* CustomZoneSample.cpp */; }; DF28982B16B4F5AE006C78AC /* ShotManager.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DF28982916B4F5AE006C78AC /* ShotManager.cxx */; }; @@ -1731,9 +1731,9 @@ 03E42D121B321DF2006EE763 /* data */ = {isa = PBXFileReference; lastKnownFileType = folder; name = data; path = ../data; sourceTree = ""; }; 03E42D191B322DFC006EE763 /* COPYING */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = COPYING; path = ../COPYING; sourceTree = ""; }; 03FA742E1742601B00573D2D /* serverSidePlayerSample.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = serverSidePlayerSample.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - C333EFC91E2B9F0800B4B182 /* customPollOptionSample.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = customPollOptionSample.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - C333EFCE1E2B9F5500B4B182 /* customPollOptionSample.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = customPollOptionSample.cpp; sourceTree = ""; }; - C333EFD31E2B9F5500B4B182 /* README.customPollOptionSample.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.customPollOptionSample.txt; sourceTree = ""; }; + C333EFC91E2B9F0800B4B182 /* customPollTypeSample.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = customPollTypeSample.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; + C333EFCE1E2B9F5500B4B182 /* customPollTypeSample.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = customPollTypeSample.cpp; sourceTree = ""; }; + C333EFD31E2B9F5500B4B182 /* README.customPollTypeSample.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.customPollTypeSample.txt; sourceTree = ""; }; C353B1D71AE239CC00C5AED5 /* CustomZoneSample.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = CustomZoneSample.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; C353B1E01AE23C8100C5AED5 /* CustomZoneSample.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CustomZoneSample.cpp; sourceTree = ""; }; C353B1E81AE2489900C5AED5 /* CustomZoneSample.bzw */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CustomZoneSample.bzw; sourceTree = ""; }; @@ -3008,7 +3008,7 @@ 0315BEAF1B821C0700FC7CE0 /* bzfscron */, 0394E6E6167B1024007F4035 /* chathistory */, 0394E6EC167B1024007F4035 /* customflagsample */, - C333EFCD1E2B9F5500B4B182 /* customPollOptionSample */, + C333EFCD1E2B9F5500B4B182 /* customPollTypeSample */, C353B1DF1AE23C8100C5AED5 /* CustomZoneSample */, 0394E6F3167B1024007F4035 /* fairCTF */, 0394E6FA167B1024007F4035 /* fastmap */, @@ -3345,7 +3345,7 @@ 0315BEAB1B821BFF00FC7CE0 /* bzfscron.dylib */, 0394E7F3167B1A17007F4035 /* chathistory.dylib */, 0394E7FE167B1E66007F4035 /* customflagsample.dylib */, - C333EFC91E2B9F0800B4B182 /* customPollOptionSample.dylib */, + C333EFC91E2B9F0800B4B182 /* customPollTypeSample.dylib */, C353B1D71AE239CC00C5AED5 /* CustomZoneSample.dylib */, 0394E809167B1ECE007F4035 /* fairCTF.dylib */, 0394E814167B1F76007F4035 /* fastmap.dylib */, @@ -3435,13 +3435,13 @@ name = Frameworks; sourceTree = ""; }; - C333EFCD1E2B9F5500B4B182 /* customPollOptionSample */ = { + C333EFCD1E2B9F5500B4B182 /* customPollTypeSample */ = { isa = PBXGroup; children = ( - C333EFCE1E2B9F5500B4B182 /* customPollOptionSample.cpp */, - C333EFD31E2B9F5500B4B182 /* README.customPollOptionSample.txt */, + C333EFCE1E2B9F5500B4B182 /* customPollTypeSample.cpp */, + C333EFD31E2B9F5500B4B182 /* README.customPollTypeSample.txt */, ); - path = customPollOptionSample; + path = customPollTypeSample; sourceTree = ""; }; C353B1DF1AE23C8100C5AED5 /* CustomZoneSample */ = { @@ -4655,9 +4655,9 @@ productReference = 03FA742E1742601B00573D2D /* serverSidePlayerSample.dylib */; productType = "com.apple.product-type.library.dynamic"; }; - C333EFC81E2B9F0800B4B182 /* customPollOptionSample */ = { + C333EFC81E2B9F0800B4B182 /* customPollTypeSample */ = { isa = PBXNativeTarget; - buildConfigurationList = C333EFCC1E2B9F0800B4B182 /* Build configuration list for PBXNativeTarget "customPollOptionSample" */; + buildConfigurationList = C333EFCC1E2B9F0800B4B182 /* Build configuration list for PBXNativeTarget "customPollTypeSample" */; buildPhases = ( C333EFC51E2B9F0800B4B182 /* Sources */, C333EFC61E2B9F0800B4B182 /* Frameworks */, @@ -4667,9 +4667,9 @@ ); dependencies = ( ); - name = customPollOptionSample; - productName = customPollOptionSample; - productReference = C333EFC91E2B9F0800B4B182 /* customPollOptionSample.dylib */; + name = customPollTypeSample; + productName = customPollTypeSample; + productReference = C333EFC91E2B9F0800B4B182 /* customPollTypeSample.dylib */; productType = "com.apple.product-type.library.dynamic"; }; C353B1D61AE239CC00C5AED5 /* CustomZoneSample */ = { @@ -4775,7 +4775,7 @@ 0394E91B167B293E007F4035 /* timedctf */, 0394E926167B29CC007F4035 /* TimeLimit */, 0394E93C167B2A9E007F4035 /* wwzones */, - C333EFC81E2B9F0800B4B182 /* customPollOptionSample */, + C333EFC81E2B9F0800B4B182 /* customPollTypeSample */, ); }; /* End PBXProject section */ @@ -5582,7 +5582,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - C333EFD41E2B9F5500B4B182 /* customPollOptionSample.cpp in Sources */, + C333EFD41E2B9F5500B4B182 /* customPollTypeSample.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -7964,7 +7964,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - C333EFCC1E2B9F0800B4B182 /* Build configuration list for PBXNativeTarget "customPollOptionSample" */ = { + C333EFCC1E2B9F0800B4B182 /* Build configuration list for PBXNativeTarget "customPollTypeSample" */ = { isa = XCConfigurationList; buildConfigurations = ( C333EFCA1E2B9F0800B4B182 /* Debug */, diff --git a/include/VotingArbiter.h b/include/VotingArbiter.h index 1ac0c418ca..947eeca198 100644 --- a/include/VotingArbiter.h +++ b/include/VotingArbiter.h @@ -366,19 +366,19 @@ inline TimeKeeper VotingArbiter::getStartTime(void) const return _startTime; } -struct PollOption { +struct PollType { std::string pollParameters; - bz_CustomPollOptionHandler* pollHandler; + bz_CustomPollTypeHandler* pollHandler; - PollOption() : + PollType() : pollParameters(""), pollHandler(0) {} }; -extern std::map customPollOptions; +extern std::map customPollTypes; -void registerCustomPollOption ( const char* object, const char* parameters, bz_CustomPollOptionHandler *handler ); -void removeCustomPollOption ( const char* object ); +void registerCustomPollType ( const char* object, const char* parameters, bz_CustomPollTypeHandler *handler ); +void removeCustomPollType ( const char* object ); #else class VotingArbiter; diff --git a/include/bzfsAPI.h b/include/bzfsAPI.h index 4b37c9c76e..5a9ceabd13 100644 --- a/include/bzfsAPI.h +++ b/include/bzfsAPI.h @@ -1617,18 +1617,18 @@ BZF_API bz_APIStringList *bz_getHelpTopic( std::string name ); // custom polls -class bz_CustomPollOptionHandler +class bz_CustomPollTypeHandler { public: - virtual ~bz_CustomPollOptionHandler() {}; + virtual ~bz_CustomPollTypeHandler() {}; // Should return false to prevent the poll from starting - virtual bool PollOpen (bz_BasePlayerRecord *player, const char* action, const char* value) = 0; - virtual void PollClose (const char* action, const char* value, bool success) = 0; + virtual bool PollOpen (bz_BasePlayerRecord *player, const char* action, const char* parameters) = 0; + virtual void PollClose (const char* action, const char* parameters, bool success) = 0; }; -BZF_API bool bz_registerCustomPollOption (const char* option, const char* parameters, bz_CustomPollOptionHandler *handler); -BZF_API bool bz_removeCustomPollOption (const char* option); +BZF_API bool bz_registerCustomPollType (const char* option, const char* parameters, bz_CustomPollTypeHandler *handler); +BZF_API bool bz_removeCustomPollType (const char* option); // custom commands diff --git a/plugins/customPollOptionSample/Makefile.am b/plugins/customPollOptionSample/Makefile.am deleted file mode 100644 index a7ce26e93d..0000000000 --- a/plugins/customPollOptionSample/Makefile.am +++ /dev/null @@ -1,19 +0,0 @@ -lib_LTLIBRARIES = customPollOptionSample.la - -customPollOptionSample_la_SOURCES = customPollOptionSample.cpp -customPollOptionSample_la_CPPFLAGS= -I$(top_srcdir)/include -I$(top_srcdir)/plugins/plugin_utils -customPollOptionSample_la_LDFLAGS = -module -avoid-version -shared -customPollOptionSample_la_LIBADD = $(top_builddir)/plugins/plugin_utils/libplugin_utils.la - -AM_CPPFLAGS = $(CONF_CPPFLAGS) -AM_CFLAGS = $(CONF_CFLAGS) -AM_CXXFLAGS = $(CONF_CXXFLAGS) - -EXTRA_DIST = \ - README.customPollOptionSample.txt \ - customPollOptionSample.def \ - customPollOptionSample.sln \ - customPollOptionSample.vcxproj - -MAINTAINERCLEANFILES = \ - Makefile.in diff --git a/plugins/customPollTypeSample/Makefile.am b/plugins/customPollTypeSample/Makefile.am new file mode 100644 index 0000000000..9c1182104c --- /dev/null +++ b/plugins/customPollTypeSample/Makefile.am @@ -0,0 +1,19 @@ +lib_LTLIBRARIES = customPollTypeSample.la + +customPollTypeSample_la_SOURCES = customPollTypeSample.cpp +customPollTypeSample_la_CPPFLAGS= -I$(top_srcdir)/include -I$(top_srcdir)/plugins/plugin_utils +customPollTypeSample_la_LDFLAGS = -module -avoid-version -shared +customPollTypeSample_la_LIBADD = $(top_builddir)/plugins/plugin_utils/libplugin_utils.la + +AM_CPPFLAGS = $(CONF_CPPFLAGS) +AM_CFLAGS = $(CONF_CFLAGS) +AM_CXXFLAGS = $(CONF_CXXFLAGS) + +EXTRA_DIST = \ + README.customPollTypeSample.txt \ + customPollTypeSample.def \ + customPollTypeSample.sln \ + customPollTypeSample.vcxproj + +MAINTAINERCLEANFILES = \ + Makefile.in diff --git a/plugins/customPollOptionSample/README.customPollOptionSample.txt b/plugins/customPollTypeSample/README.customPollTypeSample.txt similarity index 72% rename from plugins/customPollOptionSample/README.customPollOptionSample.txt rename to plugins/customPollTypeSample/README.customPollTypeSample.txt index 9e67f9ed3a..f8e666f763 100644 --- a/plugins/customPollOptionSample/README.customPollOptionSample.txt +++ b/plugins/customPollTypeSample/README.customPollTypeSample.txt @@ -1,7 +1,7 @@ -BZFlag Server Plugin: customPollOptionSample +BZFlag Server Plugin: customPollTypeSample ================================================================================ -This sample plugin showing how to make use of the bz_CustomPollOptionHandler to +This sample plugin showing how to make use of the bz_CustomPollTypeHandler to introduce custom poll options. This plugin creates a very simple '/poll mute ' option in order to mute @@ -13,7 +13,7 @@ Loading the plugin This plugin takes no optional arguments, so load it with: - -loadplugin customPollOptionSample + -loadplugin customPollTypeSample bz_CustomPollOptionHandler Functions @@ -22,7 +22,7 @@ bz_CustomPollOptionHandler Functions There are two virtual functions that will need to be implemented by your plugin to support custom poll options. - - bool PollOpen (int playerID, bz_ApiString action, bz_ApiString value) + - bool PollOpen (bz_BasePlayerRecord *player, const char* action, const char* parameters) This function is called before every custom poll begins. When this function returns true, the server will proceed and begin the poll. If the plugin @@ -32,11 +32,11 @@ to support custom poll options. player from this function, otherwise it will appear as if the poll failed to start. - * playerID - the ID of the player who would like to initiate a poll - * action - the action is that being polled, e.g. 'mute' - * value - the value or target of the action, e.g. 'talkative_player' + * player - the player record of the player who would like to initiate a poll + * action - the action is that being polled, e.g. 'mute' + * value - the value or target of the action, e.g. 'talkative_player' - - void PollClose (bz_ApiString action, bz_ApiString value, bool success) + - void PollClose (const char* action, const char* parameters, bool success) This function is called after every custom poll has ended. This is where the business logic of a successful poll should be defined. diff --git a/plugins/customPollOptionSample/customPollOptionSample.cpp b/plugins/customPollTypeSample/customPollTypeSample.cpp similarity index 65% rename from plugins/customPollOptionSample/customPollOptionSample.cpp rename to plugins/customPollTypeSample/customPollTypeSample.cpp index 940b09abab..4d41e05422 100644 --- a/plugins/customPollOptionSample/customPollOptionSample.cpp +++ b/plugins/customPollTypeSample/customPollTypeSample.cpp @@ -1,10 +1,10 @@ -// customPollOptionSample.cpp : Defines the entry point for the DLL application. +// customPollTypeSample.cpp : Defines the entry point for the DLL application. // #include "bzfsAPI.h" #include "plugin_utils.h" -class customPollOptionSample : public bz_Plugin, public bz_CustomPollOptionHandler +class customPollTypeSample : public bz_Plugin, public bz_CustomPollTypeHandler { public: virtual const char* Name () {return "Custom Poll Option";} @@ -12,32 +12,32 @@ class customPollOptionSample : public bz_Plugin, public bz_CustomPollOptionHandl virtual void Cleanup ( void ); virtual void Event ( bz_EventData * /* eventData */ ) {return;} - virtual bool PollOpen (bz_BasePlayerRecord *player, const char* action, const char* value); - virtual void PollClose (const char* action, const char* value, bool success); + virtual bool PollOpen (bz_BasePlayerRecord *player, const char* action, const char* parameters); + virtual void PollClose (const char* action, const char* parameters, bool success); }; -BZ_PLUGIN(customPollOptionSample) +BZ_PLUGIN(customPollTypeSample) -void customPollOptionSample::Init ( const char* /*commandLine*/ ) +void customPollTypeSample::Init ( const char* /*commandLine*/ ) { // This will introduce a '/poll mute callsign' option - bz_registerCustomPollOption("mute", "callsign", this); + bz_registerCustomPollType("mute", "callsign", this); } -void customPollOptionSample::Cleanup () +void customPollTypeSample::Cleanup () { Flush(); // Remove the poll option when this plugin is loaded or else what other plugin would handle it? - bz_removeCustomPollOption("mute"); + bz_removeCustomPollType("mute"); } // This function is called before a `/poll mute ` poll is started. If this function returns false, then the poll will not // start. This is useful for checking permissions or other conditions. -bool customPollOptionSample::PollOpen(bz_BasePlayerRecord *player, const char* action, const char* value) +bool customPollTypeSample::PollOpen(bz_BasePlayerRecord *player, const char* action, const char* parameters) { int playerID = player->playerID; - std::string _action = action; + std::string _parameters = parameters; // If a player doesn't have the 'poll' permission, they will not be able to start a poll. Be sure to send the playerID a message // or else it'll appear as if the /poll command did not work. @@ -47,7 +47,7 @@ bool customPollOptionSample::PollOpen(bz_BasePlayerRecord *player, const char* a } // The 'action' variable will be set whichever poll option is being called - if (_action == "mute") { + if (_parameters == "mute") { // Return true in order to let BZFS start the poll return true; @@ -57,16 +57,16 @@ bool customPollOptionSample::PollOpen(bz_BasePlayerRecord *player, const char* a return false; } -void customPollOptionSample::PollClose(const char* action, const char* value, bool success) +void customPollTypeSample::PollClose(const char* action, const char* parameters, bool success) { std::string _action = action; - std::string _value = value; + std::string _parameters = parameters; if (_action == "mute" && success) { - bz_BasePlayerRecord *pr = bz_getPlayerBySlotOrCallsign(_value.c_str()); + bz_BasePlayerRecord *pr = bz_getPlayerBySlotOrCallsign(_parameters.c_str()); if (!pr) { - bz_sendTextMessagef(BZ_SERVER, BZ_ALLUSERS, "player %s not found", _value.c_str()); + bz_sendTextMessagef(BZ_SERVER, BZ_ALLUSERS, "player %s not found", _parameters.c_str()); return; } diff --git a/plugins/customPollOptionSample/customPollOptionSample.def b/plugins/customPollTypeSample/customPollTypeSample.def similarity index 74% rename from plugins/customPollOptionSample/customPollOptionSample.def rename to plugins/customPollTypeSample/customPollTypeSample.def index 64c4102dff..d991928e9f 100644 --- a/plugins/customPollOptionSample/customPollOptionSample.def +++ b/plugins/customPollTypeSample/customPollTypeSample.def @@ -1,4 +1,4 @@ -LIBRARY customPollOptionSample +LIBRARY customPollTypeSample EXPORTS ; Explicit exports can go here diff --git a/plugins/customPollOptionSample/customPollOptionSample.sln b/plugins/customPollTypeSample/customPollTypeSample.sln similarity index 90% rename from plugins/customPollOptionSample/customPollOptionSample.sln rename to plugins/customPollTypeSample/customPollTypeSample.sln index 032ea6c41d..b88c10aaec 100644 --- a/plugins/customPollOptionSample/customPollOptionSample.sln +++ b/plugins/customPollTypeSample/customPollTypeSample.sln @@ -1,6 +1,6 @@ Microsoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "customPollOptionSample", "customPollOptionSample.vcxproj", "{1F43075E-8AF6-486F-AEDF-6B350A6CE141}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "customPollTypeSample", "customPollTypeSample.vcxproj", "{1F43075E-8AF6-486F-AEDF-6B350A6CE141}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "plugin_utils", "..\plugin_utils\plugin_utils.vcxproj", "{645768BE-97C8-4DE4-9100-111BD2808B35}" EndProject diff --git a/plugins/customPollOptionSample/customPollOptionSample.vcxproj b/plugins/customPollTypeSample/customPollTypeSample.vcxproj similarity index 87% rename from plugins/customPollOptionSample/customPollOptionSample.vcxproj rename to plugins/customPollTypeSample/customPollTypeSample.vcxproj index 2caafd96db..7aef98c947 100644 --- a/plugins/customPollOptionSample/customPollOptionSample.vcxproj +++ b/plugins/customPollTypeSample/customPollTypeSample.vcxproj @@ -20,7 +20,7 @@ {1F43075E-8AF6-486F-AEDF-6B350A6CE141} - customPollOptionSample + customPollTypeSample Win32Proj @@ -79,7 +79,7 @@ Disabled $(ProjectDir)\..\..\include\;$(ProjectDir)\..\plugin_utils\;$(BZAPI_INC_DIR)\;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;_USRDLL;customPollOptionSample_EXPORTS;%(PreprocessorDefinitions) + WIN32;_DEBUG;_WINDOWS;_USRDLL;customPollTypeSample_EXPORTS;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL @@ -90,16 +90,16 @@ bzfs.lib;%(AdditionalDependencies) - $(OutDir)customPollOptionSample.dll + $(OutDir)customPollTypeSample.dll $(SolutionDir)\BZFS_$(Platform)_$(Configuration)\;$(ProjectDir)\..\..\bin_$(Configuration)_$(Platform)\;$(BZAPI_LIB_DIR)\;%(AdditionalLibraryDirectories) - customPollOptionSample.def + customPollTypeSample.def true - $(OutDir)customPollOptionSample.pdb + $(OutDir)customPollTypeSample.pdb Windows false - $(OutDir)customPollOptionSample.lib + $(OutDir)customPollTypeSample.lib MachineX86 @@ -119,7 +119,7 @@ copy "$(ProjectDir)*.txt" "$(ProjectDir)\..\..\bin_$(Configuration)_$(Platform)\ Disabled $(ProjectDir)\..\..\include\;$(ProjectDir)\..\plugin_utils\;$(BZAPI_INC_DIR)\;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;_USRDLL;customPollOptionSample_EXPORTS;%(PreprocessorDefinitions) + WIN32;_DEBUG;_WINDOWS;_USRDLL;customPollTypeSample_EXPORTS;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL @@ -130,16 +130,16 @@ copy "$(ProjectDir)*.txt" "$(ProjectDir)\..\..\bin_$(Configuration)_$(Platform)\ bzfs.lib;%(AdditionalDependencies) - $(OutDir)customPollOptionSample.dll + $(OutDir)customPollTypeSample.dll $(SolutionDir)\BZFS_$(Platform)_$(Configuration)\;$(ProjectDir)\..\..\bin_$(Configuration)_$(Platform)\;$(BZAPI_LIB_DIR)\;%(AdditionalLibraryDirectories) - customPollOptionSample.def + customPollTypeSample.def true - $(OutDir)customPollOptionSample.pdb + $(OutDir)customPollTypeSample.pdb Windows false - $(OutDir)customPollOptionSample.lib + $(OutDir)customPollTypeSample.lib MachineX64 @@ -153,7 +153,7 @@ copy "$(ProjectDir)*.txt" "$(ProjectDir)\..\..\bin_$(Configuration)_$(Platform)\ $(ProjectDir)\..\..\include\;$(ProjectDir)\..\plugin_utils\;$(BZAPI_INC_DIR)\;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;_USRDLL;customPollOptionSample_EXPORTS;%(PreprocessorDefinitions) + WIN32;NDEBUG;_WINDOWS;_USRDLL;customPollTypeSample_EXPORTS;%(PreprocessorDefinitions) MultiThreadedDLL @@ -162,9 +162,9 @@ copy "$(ProjectDir)*.txt" "$(ProjectDir)\..\..\bin_$(Configuration)_$(Platform)\ bzfs.lib;%(AdditionalDependencies) - $(OutDir)customPollOptionSample.dll + $(OutDir)customPollTypeSample.dll $(SolutionDir)\BZFS_$(Platform)_$(Configuration)\;$(ProjectDir)\..\..\bin_$(Configuration)_$(Platform)\;$(BZAPI_LIB_DIR)\;%(AdditionalLibraryDirectories) - customPollOptionSample.def + customPollTypeSample.def true Release/$(ProjectName).pdb Windows @@ -173,7 +173,7 @@ copy "$(ProjectDir)*.txt" "$(ProjectDir)\..\..\bin_$(Configuration)_$(Platform)\ false - $(OutDir)customPollOptionSample.lib + $(OutDir)customPollTypeSample.lib MachineX86 @@ -190,7 +190,7 @@ copy "$(ProjectDir)*.txt" "$(ProjectDir)\..\..\bin_$(Configuration)_$(Platform)\ $(ProjectDir)\..\..\include\;$(ProjectDir)\..\plugin_utils\;$(BZAPI_INC_DIR)\;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;_USRDLL;customPollOptionSample_EXPORTS;%(PreprocessorDefinitions) + WIN32;NDEBUG;_WINDOWS;_USRDLL;customPollTypeSample_EXPORTS;%(PreprocessorDefinitions) MultiThreadedDLL @@ -199,9 +199,9 @@ copy "$(ProjectDir)*.txt" "$(ProjectDir)\..\..\bin_$(Configuration)_$(Platform)\ bzfs.lib;%(AdditionalDependencies) - $(OutDir)customPollOptionSample.dll + $(OutDir)customPollTypeSample.dll $(SolutionDir)\BZFS_$(Platform)_$(Configuration)\;$(ProjectDir)\..\..\bin_$(Configuration)_$(Platform)\;$(BZAPI_LIB_DIR)\;%(AdditionalLibraryDirectories) - customPollOptionSample.def + customPollTypeSample.def true Release/$(ProjectName).pdb Windows @@ -210,7 +210,7 @@ copy "$(ProjectDir)*.txt" "$(ProjectDir)\..\..\bin_$(Configuration)_$(Platform)\ false - $(OutDir)customPollOptionSample.lib + $(OutDir)customPollTypeSample.lib MachineX64 @@ -229,11 +229,11 @@ copy "$(ProjectDir)*.txt" "$(ProjectDir)\..\..\bin_$(Configuration)_$(Platform)\ true true - - + + - + @@ -248,4 +248,4 @@ copy "$(ProjectDir)*.txt" "$(ProjectDir)\..\..\bin_$(Configuration)_$(Platform)\ - \ No newline at end of file + diff --git a/src/bzfs/bzfs.cxx b/src/bzfs/bzfs.cxx index 4ab3420252..6489eaac94 100644 --- a/src/bzfs/bzfs.cxx +++ b/src/bzfs/bzfs.cxx @@ -6794,8 +6794,8 @@ int main(int argc, char **argv) apiEventCalled = true; } - if (!calledCustomHandler && customPollOptions.find(votingarbiter->getPollAction()) != customPollOptions.end()) { - customPollOptions[votingarbiter->getPollAction()].pollHandler->PollClose(votingarbiter->getPollAction().c_str(), votingarbiter->getPollTarget().c_str(), votingarbiter->isPollSuccessful()); + if (!calledCustomHandler && customPollTypes.find(votingarbiter->getPollAction()) != customPollTypes.end()) { + customPollTypes[votingarbiter->getPollAction()].pollHandler->PollClose(votingarbiter->getPollAction().c_str(), votingarbiter->getPollTarget().c_str(), votingarbiter->isPollSuccessful()); calledCustomHandler = true; } diff --git a/src/bzfs/bzfsAPI.cxx b/src/bzfs/bzfsAPI.cxx index 1b680595f8..69b85b48ab 100644 --- a/src/bzfs/bzfsAPI.cxx +++ b/src/bzfs/bzfsAPI.cxx @@ -2462,21 +2462,21 @@ BZF_API bz_APIStringList *bz_getHelpTopic(std::string name) return new bz_APIStringList(*clOptions->textChunker.getTextChunk(name)); } -BZF_API bool bz_registerCustomPollOption ( const char* option, const char* parameters, bz_CustomPollOptionHandler *handler ) +BZF_API bool bz_registerCustomPollType ( const char* option, const char* parameters, bz_CustomPollTypeHandler *handler ) { if (!option || !handler) return false; - registerCustomPollOption(option, parameters, handler); + registerCustomPollType(option, parameters, handler); return true; } -BZF_API bool bz_removeCustomPollOption ( const char* option ) +BZF_API bool bz_removeCustomPollType ( const char* option ) { if (!option) return false; - removeCustomPollOption(option); + removeCustomPollType(option); return true; } diff --git a/src/bzfs/commands.cxx b/src/bzfs/commands.cxx index 30d93fa416..d89b6c3553 100644 --- a/src/bzfs/commands.cxx +++ b/src/bzfs/commands.cxx @@ -2866,8 +2866,8 @@ bool PollCommand::operator() (const char *message, /* handle subcommands */ - bool customPollOption = customPollOptions.find(cmd) != customPollOptions.end(); - if ((cmd == "ban") || (cmd == "kick") || (cmd == "kill") || (cmd == "set") || (cmd == "flagreset") || customPollOption) { + bool customPollType = customPollTypes.find(cmd) != customPollTypes.end(); + if ((cmd == "ban") || (cmd == "kick") || (cmd == "kill") || (cmd == "set") || (cmd == "flagreset") || customPollType) { std::string target; std::string targetIP = ""; @@ -2952,11 +2952,11 @@ bool PollCommand::operator() (const char *message, return true; } - if (customPollOption) + if (customPollType) { bz_BasePlayerRecord *pr = bz_getPlayerByIndex(t); - bool stopPoll = (customPollOptions[cmd].pollHandler->PollOpen(pr, cmd.c_str(), target.c_str())); + bool stopPoll = (customPollTypes[cmd].pollHandler->PollOpen(pr, cmd.c_str(), target.c_str())); bz_freePlayerRecord(pr); @@ -2965,7 +2965,7 @@ bool PollCommand::operator() (const char *message, } } - if ((cmd != "set") && (cmd != "flagreset") && !customPollOption) { + if ((cmd != "set") && (cmd != "flagreset") && !customPollType) { // kick, kill, and ban polls take a player name /* make sure the requested player is actually here */ @@ -3038,7 +3038,7 @@ bool PollCommand::operator() (const char *message, /* create and announce the new poll */ bool canDo = false; - if (customPollOption) { + if (customPollType) { canDo = (arbiter->poll(target, t, cmd)); } else if (cmd == "ban") { canDo = (arbiter->pollToBan(target, t, targetIP)); @@ -3120,9 +3120,9 @@ bool PollCommand::operator() (const char *message, if (playerData->accessInfo.hasPerm(PlayerAccessInfo::pollFlagReset)) sendMessage(ServerPlayer, t, " or /poll flagreset"); - if (!customPollOptions.empty()) { - for (auto pollOption : customPollOptions) { - snprintf(reply, MessageLen, " or /poll %s %s", pollOption.first.c_str(), pollOption.second.pollParameters.c_str()); + if (!customPollTypes.empty()) { + for (auto pollType : customPollTypes) { + snprintf(reply, MessageLen, " or /poll %s %s", pollType.first.c_str(), pollType.second.pollParameters.c_str()); sendMessage(ServerPlayer, t, reply); } } diff --git a/src/game/VotingArbiter.cxx b/src/game/VotingArbiter.cxx index f53cb3c0de..3b2278ca90 100644 --- a/src/game/VotingArbiter.cxx +++ b/src/game/VotingArbiter.cxx @@ -338,26 +338,26 @@ bool VotingArbiter::retractVote(const std::string &player) // Custom Poll Types -std::map customPollOptions; +std::map customPollTypes; -void registerCustomPollOption ( const char* object, const char* parameters, bz_CustomPollOptionHandler *handler ) +void registerCustomPollType ( const char* object, const char* parameters, bz_CustomPollTypeHandler *handler ) { - PollOption o; + PollType o; o.pollParameters = parameters; o.pollHandler = handler; std::string objectName = object; - customPollOptions[TextUtils::tolower(objectName)] = o; + customPollTypes[TextUtils::tolower(objectName)] = o; } -void removeCustomPollOption ( const char* object ) +void removeCustomPollType ( const char* object ) { std::string objectName = object; objectName = TextUtils::tolower(objectName); - if (customPollOptions.find(objectName) != customPollOptions.end()) - customPollOptions.erase(customPollOptions.find(objectName)); + if (customPollTypes.find(objectName) != customPollTypes.end()) + customPollTypes.erase(customPollTypes.find(objectName)); }