[PATCH] Allow Human_Controller to move scouts further
authorSam Moore <[email protected]>
Sun, 26 Feb 2012 06:58:08 +0000 (14:58 +0800)
committerSam Moore <[email protected]>
Sun, 26 Feb 2012 06:58:08 +0000 (14:58 +0800)
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.

judge/manager/human_controller.cpp

index c2470d3..e2b5845 100644 (file)
@@ -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;

UCC git Repository :: git.ucc.asn.au