Eliminate extraneous view_as calls and also update mapchooser.inc.

This commit is contained in:
Ross Bemrose 2014-12-16 13:53:54 -05:00
parent 46839b9752
commit bc4d6b7104
2 changed files with 20 additions and 16 deletions

View File

@ -27,7 +27,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 +35,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 +43,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 +51,7 @@ native bool:RemoveNominationByOwner(owner);
* @param array An ADT array handle to add the map strings to.
* @noreturn
*/
native GetExcludeMapList(Handle:array);
native GetExcludeMapList(ArrayList array);
/**
* Gets the current list of nominated maps.
@ -60,14 +60,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 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 +78,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 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,7 +105,6 @@ forward void OnNominationRemoved(const char[] map, int owner);
*/
forward void OnMapVoteStarted();
public SharedPlugin:__pl_mapchooser =
{
name = "mapchooser",

View File

@ -1036,7 +1036,7 @@ NominateResult InternalNominateMap(char[] map, bool force, int owner)
/* Add natives to allow nominate and initiate vote to be call */
/* native bool:NominateMap(const String:map[], bool:force, &NominateError:error); */
/* native NominateResult NominateMap(const char[] map, bool force, int owner); */
public int Native_NominateMap(Handle plugin, int numParams)
{
int len;
@ -1077,7 +1077,7 @@ bool InternalRemoveNominationByMap(char[] map)
return false;
}
/* native bool:RemoveNominationByMap(const String:map[]); */
/* native bool RemoveNominationByMap(const char[] map); */
public int Native_RemoveNominationByMap(Handle plugin, int numParams)
{
int len;
@ -1091,7 +1091,7 @@ public int Native_RemoveNominationByMap(Handle plugin, int numParams)
char[] map = new char[len+1];
GetNativeString(1, map, len+1);
return view_as<int>(InternalRemoveNominationByMap(map));
return InternalRemoveNominationByMap(map);
}
bool InternalRemoveNominationByOwner(int owner)
@ -1117,13 +1117,13 @@ bool InternalRemoveNominationByOwner(int owner)
return false;
}
/* native bool:RemoveNominationByOwner(owner); */
/* native bool RemoveNominationByOwner(int owner); */
public int Native_RemoveNominationByOwner(Handle plugin, int numParams)
{
return view_as<int>(InternalRemoveNominationByOwner(GetNativeCell(1)));
return InternalRemoveNominationByOwner(GetNativeCell(1));
}
/* native InitiateMapChooserVote(); */
/* native InitiateMapChooserVote(MapChange when, ArrayList inputarray=null); */
public int Native_InitiateVote(Handle plugin, int numParams)
{
MapChange when = view_as<MapChange>(GetNativeCell(1));
@ -1133,21 +1133,25 @@ public int Native_InitiateVote(Handle plugin, int numParams)
InitiateVote(when, inputarray);
}
/* native bool CanMapChooserStartVote(); */
public int Native_CanVoteStart(Handle plugin, int numParams)
{
return CanVoteStart();
}
/* native bool HasEndOfMapVoteFinished(); */
public int Native_CheckVoteDone(Handle plugin, int numParams)
{
return g_MapVoteCompleted;
}
/* native bool EndOfMapVoteEnabled(); */
public int Native_EndOfMapVoteEnabled(Handle plugin, int numParams)
{
return g_Cvar_EndOfMapVote.BoolValue;
}
/* native GetExcludeMapList(ArrayList array); */
public int Native_GetExcludeMapList(Handle plugin, int numParams)
{
ArrayList array = view_as<ArrayList>(GetNativeCell(1));
@ -1168,6 +1172,7 @@ public int Native_GetExcludeMapList(Handle plugin, int numParams)
return;
}
/* native GetNominatedMapList(ArrayList maparray, ArrayList ownerarray = null); */
public int Native_GetNominatedMapList(Handle plugin, int numParams)
{
ArrayList maparray = view_as<ArrayList>(GetNativeCell(1));