From: Sam Moore Date: Sun, 26 Feb 2012 06:58:08 +0000 (+0800) Subject: [PATCH] Allow Human_Controller to move scouts further X-Git-Url: https://git.ucc.asn.au/?p=progcomp2012.git;a=commitdiff_plain;h=168375bf0ab8b7745886c39ca9cbe5f11219714f [PATCH] Allow Human_Controller to move scouts further Thanks to David Gow (sulix) for this patch. I was aware of the limitation, but decided to wait until someone complained before fixing it (I also overestimated the effort required to fix it). So I'd like to congratulate David for being the first person to actually try and use the manager program! I'll have to allocate a prize for that. --- diff --git a/judge/manager/human_controller.cpp b/judge/manager/human_controller.cpp index c2470d3..e2b5845 100644 --- a/judge/manager/human_controller.cpp +++ b/judge/manager/human_controller.cpp @@ -145,6 +145,7 @@ MovementResult Human_Controller::QueryMove(string & buffer) { int xDist = x[1] - x[0]; int yDist = y[1] - y[0]; + int magnitude = max(abs(xDist), abs(yDist)); if (abs(xDist) > abs(yDist)) { if (xDist < 0) @@ -156,6 +157,13 @@ MovementResult Human_Controller::QueryMove(string & buffer) buffer += "UP"; else buffer += "DOWN"; + + if (magnitude > 1) + { + stringstream s(""); + s << " " << magnitude; + buffer += s.str(); + } } mouseClick++; break;