summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2006-09-16 22:09:26 +0000
committerbjarni <bjarni@openttd.org>2006-09-16 22:09:26 +0000
commite4d044871b03b3f77c17bbb59b9f940bcbc71fc2 (patch)
treeae15e325e94d98f85b6f6a9023cf5c42a2a216e2
parent03d3d5677f8f6f260c6e6e2ecb4aad988c4245c8 (diff)
downloadopenttd-e4d044871b03b3f77c17bbb59b9f940bcbc71fc2.tar.xz
(svn r6468) -Codechange r6464: now use error() when failing refit in autoreplace to ensure that such a failure will not break a game
We should only reach this error() if there is a bug, that would otherwise make the vehicles carry a different type of cargo without telling the user This also kills the warning added in r6464 (oops)
-rw-r--r--lang/english.txt2
-rw-r--r--vehicle.c10
2 files changed, 2 insertions, 10 deletions
diff --git a/lang/english.txt b/lang/english.txt
index 793d83e13..467fc8523 100644
--- a/lang/english.txt
+++ b/lang/english.txt
@@ -2906,8 +2906,6 @@ STR_REPLACE_REMOVE_WAGON_HELP :{BLACK}Make aut
STR_REPLACE_ENGINE_WAGON_SELECT :{BLACK}Replacing: {ORANGE}{SKIP}{SKIP}{STRING}
STR_REPLACE_ENGINE_WAGON_SELECT_HELP :{BLACK} EXPERIMENTAL FEATURE {}Switch between engine and wagon replacement windows.{}Wagon replacement will only be done if the new wagon can be refitted into carrying the same type of cargo as the old one. This is checked for each wagon when the actual replacement takes place.
STR_ENGINE_NOT_BUILDABLE :{WHITE}Engine is not buildable
-STR_AUTOREPLACE_FAILED :{WHITE}BUG: Autoreplace refit failure
-STR_AUTOREPLACE_REFIT_FAILURE :{WHITE}{STRING} replaced into {STRING} failed to refit to {STRING}
STR_ENGINES :Engines
STR_WAGONS :Wagons
diff --git a/vehicle.c b/vehicle.c
index 17cc63f1b..7081c5fc5 100644
--- a/vehicle.c
+++ b/vehicle.c
@@ -1779,14 +1779,8 @@ static int32 ReplaceVehicle(Vehicle **w, byte flags, int32 total_cost)
/* refit if needed */
if (replacement_cargo_type != CT_NO_REFIT) {
if (CmdFailed(DoCommand(0, new_v->index, replacement_cargo_type, DC_EXEC, CMD_REFIT_VEH(new_v->type)))) {
- /* We should not be here
- * being here shows a failure indicates a bug in GetNewCargoTypeForReplace() or incorrect estimation costs */
- SetDParam(0, GetCustomEngineName(old_v->engine_type));
- SetDParam(1, GetCustomEngineName(new_v->engine_type));
- SetDParam(2, _cargoc.names_s[replacement_cargo_type]);
- ShowInfo("Error: Autoreplace failed to refit (bug)");
- ShowErrorMessage(STR_AUTOREPLACE_REFIT_FAILURE, STR_AUTOREPLACE_FAILED, 0 ,0);
- NOT_REACHED(); // stop debug builds at this error for easier debugging
+ /* Being here shows a failure, which most likely is in GetNewCargoTypeForReplace() or incorrect estimation costs */
+ error("Autoreplace failed to refit. Replace engine %d to %d and refit to cargo %d", old_v->engine_type, new_v->engine_type, replacement_cargo_type);
}
}