62 lines
No EOL
1.1 KiB
C++
62 lines
No EOL
1.1 KiB
C++
#include "states.h"
|
|
#include "state.h"
|
|
#include "station.h"
|
|
|
|
//-------
|
|
// On the Move
|
|
//-------
|
|
|
|
|
|
OnTheMove::OnTheMove(Station* targetStation) {
|
|
this->targetStation = targetStation;
|
|
}
|
|
|
|
State* OnTheMove::putDown(Station* newStation) {
|
|
return new Hacking(newStation);
|
|
}
|
|
|
|
|
|
//-------
|
|
// Hacking
|
|
//-------
|
|
|
|
Hacking::Hacking(Station* currentStation) {
|
|
this->currentStation = currentStation;
|
|
}
|
|
|
|
State* Hacking::pickedUp() {
|
|
return this;
|
|
}
|
|
|
|
//-------
|
|
// Waiting F orPickup
|
|
//-------
|
|
|
|
WaitingForPickup::WaitingForPickup(Station* currentStation, Station* targetStation) {
|
|
this->currentStation = currentStation;
|
|
this->targetStation = targetStation;
|
|
}
|
|
|
|
State* WaitingForPickup::pickedUp() {
|
|
return this;
|
|
}
|
|
|
|
//-------
|
|
// Startup
|
|
//-------
|
|
|
|
State* Startup::putDown(Station* newStation) {
|
|
return new NewTargetFinder(newStation);
|
|
}
|
|
|
|
//-------
|
|
// NewTargetFinder
|
|
//-------
|
|
|
|
NewTargetFinder::NewTargetFinder(Station* currentStation) {
|
|
this->currentStation = currentStation;
|
|
}
|
|
|
|
State* NewTargetFinder::update(Context context) {
|
|
return new WaitingForPickup(this->currentStation, (&context.stations)[0]);
|
|
} |