From: <ken...@us...> - 2008-09-24 06:38:23
|
Revision: 2189 http://planeshift.svn.sourceforge.net/planeshift/?rev=2189&view=rev Author: kennygraunke Date: 2008-09-24 06:38:15 +0000 (Wed, 24 Sep 2008) Log Message: ----------- - Made range required for area: targeting, to avoid GMs accidentally applying commands to...everything. Also sanity check range. Patch requested by Kerol. Modified Paths: -------------- trunk/docs/history.txt trunk/src/server/usermanager.cpp Modified: trunk/docs/history.txt =================================================================== --- trunk/docs/history.txt 2008-09-23 21:52:50 UTC (rev 2188) +++ trunk/docs/history.txt 2008-09-24 06:38:15 UTC (rev 2189) @@ -1,4 +1,8 @@ -*** 2008-09-23 by Stefano Angeleri +*** 2008-09-24 by Kenny Graunke +- Made range required for area: targeting, to avoid GMs accidentally applying + commands to...everything. Also sanity check range. Patch requested by Kerol. + +*** 2008-09-23 by Stefano Angeleri - Reworked Changename and Charlist to get the target from the generic function, fixed a bug in the changename function with npc which didn't update some things with the new name and added some additional error checking. Modified: trunk/src/server/usermanager.cpp =================================================================== --- trunk/src/server/usermanager.cpp 2008-09-23 21:52:50 UTC (rev 2188) +++ trunk/src/server/usermanager.cpp 2008-09-24 06:38:15 UTC (rev 2189) @@ -400,20 +400,23 @@ csArray<csString> splitTarget = psSplit(target, ':'); size_t splitSize = splitTarget.GetSize(); - if ((2>splitSize) || (splitSize>4)) + if (splitSize < 3 || splitSize > 4) { psserver->SendSystemError(client->GetClientNum(), - "Try /$CMD area:item[:range[:name]]"); + "Try /$CMD area:item:range[:name]"); return result; } csString itemName = splitTarget[1]; - csString* rangeName = splitSize > 2 ? &splitTarget[2] : 0; csString* nameFilter = splitSize > 3 ? &splitTarget[3] : 0; - int range = 99999; /* TODO: check is this value is large enough */ - if (rangeName) - range = atoi(rangeName->GetData()); + const int range = atoi(splitTarget[2].GetData()); + if (range <= 0) + { + psserver->SendSystemError(client->GetClientNum(), + "You must specify a positive integer for the area: range."); + return result; + } bool allNames = true; if (nameFilter && (*nameFilter!="all")) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |