CommandFactory uses BoatActionEnum instead of raw ints.

#story[1094]
main
fjc40 8 years ago
parent c83442761c
commit 148108a658

@ -2,6 +2,7 @@ package mock.model.commandFactory;
import mock.model.MockBoat; import mock.model.MockBoat;
import mock.model.MockRace; import mock.model.MockRace;
import network.Messages.Enums.BoatActionEnum;
/** /**
* Factory class for Command objects * Factory class for Command objects
@ -14,10 +15,10 @@ public class CommandFactory {
* @param action number to select command * @param action number to select command
* @return * @return
*/ */
public static Command createCommand(MockRace race, MockBoat boat, int action) { public static Command createCommand(MockRace race, MockBoat boat, BoatActionEnum action) {
switch(action) { switch(action) {
case 1: return new VMGCommand(race, boat); case AUTO_PILOT: return new VMGCommand(race, boat);
case 4: return new TackGybeCommand(race, boat); case TACK_GYBE: return new TackGybeCommand(race, boat);
default: return null; // TODO - please please have discussion over what to default to default: return null; // TODO - please please have discussion over what to default to
} }
} }

Loading…
Cancel
Save