/// Wenn die Ware vernichtet werden muss void Ware::WareLost(const unsigned char player) { // Inventur verringern gwg->GetPlayer(player)->DecreaseInventoryWare(type,1); // Ziel der Ware Bescheid sagen NotifyGoalAboutLostWare(); // Zentrale Registrierung der Ware löschen gwg->GetPlayer(player)->RemoveWare(this); }
void Ware::RecalcRoute() { // Nächste Richtung nehmen if(location && goal) next_dir = gwg->FindPathForWareOnRoads(*location, *goal, NULL, &next_harbor); else next_dir = INVALID_DIR; // Evtl gibts keinen Weg mehr? Dann wieder zurück ins Lagerhaus (wenns vorher überhaupt zu nem Ziel ging) if(next_dir == INVALID_DIR && goal) { RTTR_Assert(location); // Tell goal about this NotifyGoalAboutLostWare(); if(state == STATE_WAITFORSHIP) { // Ware was waiting for a ship so send the ware into the harbor RTTR_Assert(location->GetGOT() == GOT_NOB_HARBORBUILDING); state = STATE_WAITINWAREHOUSE; SetGoal(static_cast<nobHarborBuilding*>(location)); // but not going by ship static_cast<nobHarborBuilding*>(goal)->WareDontWantToTravelByShip(this); } else { FindRouteToWarehouse(); } } else { // If we waited in the harbor for the ship before and don't want to travel now // -> inform the harbor so that it can remove us from its list if(state == STATE_WAITFORSHIP && next_dir != SHIP_DIR) { RTTR_Assert(location); RTTR_Assert(location->GetGOT() == GOT_NOB_HARBORBUILDING); state = STATE_WAITINWAREHOUSE; static_cast<nobHarborBuilding*>(location)->WareDontWantToTravelByShip(this); } } }