Merge pull request #226 from powerlord/mapchooser-updates

More New API changes for MapChooser, Nominations, RockTheVote, RandomCycle, and NextMap.
This commit is contained in:
Nicholas Hastings
2015-06-12 14:58:12 -04:00
7 changed files with 328 additions and 287 deletions
+42 -12
View File
@@ -1,3 +1,34 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2014 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2," the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation. You must obey the GNU General Public License in
* all respects for all other code used. Additionally, AlliedModders LLC grants
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id$
*/
#if defined _mapchooser_included_
#endinput
#endif
@@ -27,7 +58,7 @@ enum MapChange
* @param owner Client index of the nominater. If the client disconnects the nomination will be removed. Use 0 for constant nominations
* @return Nominate Result of the outcome
*/
native NominateResult:NominateMap(const String:map[], bool:force, owner);
native NominateResult NominateMap(const char[] map, bool force, int owner);
/**
* Attempt to remove a map from the mapchooser map list.
@@ -35,7 +66,7 @@ native NominateResult:NominateMap(const String:map[], bool:force, owner);
* @param map Map to remove.
* @return True if the nomination was found and removed, or false if the nomination was not found.
*/
native bool:RemoveNominationByMap(const String:map[]);
native bool RemoveNominationByMap(const char[] map);
/**
* Attempt to remove a map from the mapchooser map list.
@@ -43,7 +74,7 @@ native bool:RemoveNominationByMap(const String:map[]);
* @param owner Client index of the nominater.
* @return True if the nomination was found and removed, or false if the nomination was not found.
*/
native bool:RemoveNominationByOwner(owner);
native bool RemoveNominationByOwner(int owner);
/**
* Gets the current list of excluded maps.
@@ -51,7 +82,7 @@ native bool:RemoveNominationByOwner(owner);
* @param array An ADT array handle to add the map strings to.
* @noreturn
*/
native GetExcludeMapList(Handle:array);
native void GetExcludeMapList(ArrayList array);
/**
* Gets the current list of nominated maps.
@@ -60,14 +91,14 @@ native GetExcludeMapList(Handle:array);
* @param ownerarray An optional ADT array handle to add the nominator client indexes to.
* @noreturn
*/
native GetNominatedMapList(Handle:maparray, Handle:ownerarray = INVALID_HANDLE);
native void GetNominatedMapList(ArrayList maparray, ArrayList ownerarray = null);
/**
* Checks if MapChooser will allow a vote
*
* @return True if a vote can be held, or false if mapchooser is already holding a vote.
*/
native bool:CanMapChooserStartVote();
native bool CanMapChooserStartVote();
/**
* Initiates a MapChooser map vote
@@ -78,21 +109,21 @@ native bool:CanMapChooserStartVote();
* @param when MapChange consant of when the resulting mapchange should occur.
* @param inputarray ADT array list of maps to add to the vote.
*/
native InitiateMapChooserVote(MapChange:when, Handle:inputarray=INVALID_HANDLE);
native void InitiateMapChooserVote(MapChange when, ArrayList inputarray=null);
/**
* Checks if MapChooser's end of map vote has completed.
*
* @return True if complete, false otherwise.
*/
native bool:HasEndOfMapVoteFinished();
native bool HasEndOfMapVoteFinished();
/**
* Checks if MapChooser is set to run an end of map vote.
*
* @return True if enabled, false otherwise.
*/
native bool:EndOfMapVoteEnabled();
native bool EndOfMapVoteEnabled();
/**
* Called when mapchooser removes a nomination from its list.
@@ -105,8 +136,7 @@ forward void OnNominationRemoved(const char[] map, int owner);
*/
forward void OnMapVoteStarted();
public SharedPlugin:__pl_mapchooser =
public SharedPlugin __pl_mapchooser =
{
name = "mapchooser",
file = "mapchooser.smx",
@@ -117,7 +147,7 @@ public SharedPlugin:__pl_mapchooser =
#endif
};
public __pl_mapchooser_SetNTVOptional()
public void __pl_mapchooser_SetNTVOptional()
{
MarkNativeAsOptional("NominateMap");
MarkNativeAsOptional("RemoveNominationByMap");
+6 -6
View File
@@ -1,7 +1,7 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* SourceMod (C)2004-2014 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
@@ -42,7 +42,7 @@
* @param map Next map to set.
* @return True if the nextmap was set, false if map was invalid.
*/
native bool:SetNextMap(const String:map[]);
native bool SetNextMap(const char[] map);
/**
* Returns SourceMod's internal nextmap.
@@ -51,7 +51,7 @@ native bool:SetNextMap(const String:map[]);
* @param maxlen Maximum length of the map buffer.
* @return True if a Map was found and copied, false if no nextmap is set (map will be unchanged).
*/
native bool:GetNextMap(String:map[], maxlen);
native bool GetNextMap(char[] map, int maxlen);
/**
* Changes the current map and records the reason for the change with maphistory
@@ -60,14 +60,14 @@ native bool:GetNextMap(String:map[], maxlen);
* @param reason Reason for change.
* @noreturn
*/
native ForceChangeLevel(const String:map[], const String:reason[]);
native void ForceChangeLevel(const char[] map, const char[] reason);
/**
* Gets the current number of maps in the map history
*
* @return Number of maps.
*/
native GetMapHistorySize();
native int GetMapHistorySize();
/**
* Retrieves a map from the map history list.
@@ -81,4 +81,4 @@ native GetMapHistorySize();
* @noreturn
* @error Invalid item number.
*/
native GetMapHistory(item, String:map[], mapLen, String:reason[], reasonLen, &startTime);
native void GetMapHistory(int item, char[] map, int mapLen, char[] reason, int reasonLen, int &startTime);