Codechange: Use IsValidCargoID/IsValidCargoType.
IsValidCargoType() is used only for unmapped IDs.
This commit is contained in:
@@ -3023,7 +3023,7 @@ bool AfterLoadGame()
|
||||
/* Make sure last_cargo_accepted_at is copied to elements for every valid input cargo.
|
||||
* The loading routine should put the original singular value into the first array element. */
|
||||
for (size_t ci = 0; ci < lengthof(i->accepts_cargo); ci++) {
|
||||
if (i->accepts_cargo[ci] != CT_INVALID) {
|
||||
if (IsValidCargoID(i->accepts_cargo[ci])) {
|
||||
i->last_cargo_accepted_at[ci] = i->last_cargo_accepted_at[0];
|
||||
} else {
|
||||
i->last_cargo_accepted_at[ci] = 0;
|
||||
|
@@ -1440,7 +1440,7 @@ static bool LoadOldSubsidy(LoadgameState *ls, int num)
|
||||
{
|
||||
Subsidy *s = new (num) Subsidy();
|
||||
bool ret = LoadChunk(ls, s, subsidy_chunk);
|
||||
if (s->cargo_type == CT_INVALID) delete s;
|
||||
if (!IsValidCargoID(s->cargo_type)) delete s;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user