buenzliai/main/states.cpp

62 lines
1.1 KiB
C++
Raw Normal View History

2024-05-17 13:04:36 +00:00
#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;
}
2024-05-17 13:37:03 +00:00
//-------
// 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]);
2024-05-17 13:37:03 +00:00
}