From 0f7392bd616e0bd256b5ec241ad52d7230bcc454 Mon Sep 17 00:00:00 2001 From: peter1138 Date: Sat, 12 Jan 2008 19:58:06 +0000 Subject: (svn r11822) -Codechange: Replaced fixed size custom name array. Names are now attached to their object directly and there is no limit to the amount of names. -Fix: NewGRF engines could not be renamed. --- src/oldloader.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/oldloader.cpp') diff --git a/src/oldloader.cpp b/src/oldloader.cpp index 86782a263..27e7fab43 100644 --- a/src/oldloader.cpp +++ b/src/oldloader.cpp @@ -1235,7 +1235,8 @@ bool LoadOldVehicle(LoadgameState *ls, int num) if (_old_next_ptr != 0xFFFF) v->next = GetVehiclePoolSize() <= _old_next_ptr ? new (_old_next_ptr) InvalidVehicle() : GetVehicle(_old_next_ptr); - v->string_id = RemapOldStringID(_old_string_id); + _old_string_id = RemapOldStringID(_old_string_id); + v->name = CopyFromOldName(_old_string_id); /* Vehicle-subtype is different in TTD(Patch) */ if (v->type == VEH_SPECIAL) v->subtype = v->subtype >> 1; @@ -1251,7 +1252,7 @@ bool LoadOldVehicle(LoadgameState *ls, int num) } static const OldChunks sign_chunk[] = { - OCL_SVAR( OC_UINT16, Sign, str ), + OCL_VAR ( OC_UINT16, 1, &_old_string_id ), OCL_SVAR( OC_FILE_U16 | OC_VAR_I32, Sign, x ), OCL_SVAR( OC_FILE_U16 | OC_VAR_I32, Sign, y ), OCL_SVAR( OC_FILE_U16 | OC_VAR_I8, Sign, z ), @@ -1263,7 +1264,12 @@ static const OldChunks sign_chunk[] = { static bool LoadOldSign(LoadgameState *ls, int num) { - return LoadChunk(ls, new (num) Sign(), sign_chunk); + if (!LoadChunk(ls, new (num) Sign(), sign_chunk)) return false; + + _old_string_id = RemapOldStringID(_old_string_id); + // XXX copy if custom name$$$ + + return true; } static const OldChunks engine_chunk[] = { -- cgit v1.2.3-70-g09d2