|
|
|
|
Re: Vehicle WEAPON names no longer shows up [message #487420 is a reply to message #487417] |
Tue, 29 April 2014 14:06 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
![](/images/custom_avatars/21300.png) |
Jerad2142
Messages: 3807 Registered: July 2006 Location: USA
Karma: 6
|
General (3 Stars) |
|
|
danpaul88 wrote on Tue, 29 April 2014 13:11 | Using scripts.dll 4.1;
![index.php?t=getfile&id=14933&private=0](index.php?t=getfile&id=14933&private=0)
So it obviously is possible still... don't have LE on me at the moment to check where that comes from though
|
Maybe its just a bug with temps? Because I can say with 95% certainty in original 3.4.4 it was set by VehicleNameID (as I had to do it about 30 times at least for Rp2)...
Or perhaps it only works if it was set in the old LE, maybe it was disconnected from the correct value in 4.X's LE?
Visit Jerad's deer sweat shop
[Updated on: Tue, 29 April 2014 14:10] Report message to a moderator
|
|
|
|
Re: Vehicle WEAPON names no longer shows up [message #487422 is a reply to message #487407] |
Tue, 29 April 2014 16:53 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
|
I dont know why it wouldn't be working either.
The hud code is using VehicleGameObj::Get_Vehicle_Name (in engine_tdb.cpp) when it displays the name.
Jonathan Wilson aka Jonwil
Creator and Lead Coder of the Custom scripts.dll
Renegade Engine Guru
Creator and Lead Coder of TT.DLL
Official member of Tiberian Technologies
|
|
|
|
|
|
Re: Vehicle WEAPON names no longer shows up [message #487427 is a reply to message #487407] |
Wed, 30 April 2014 06:54 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
![](http://renegadeforums.com/images/custom_avatars/2893.jpg) |
danpaul88
Messages: 5795 Registered: June 2004 Location: England
Karma: 0
|
General (5 Stars) |
|
|
Hmm, looking in the code I noticed something a bit... odd...
const wchar_t *VehicleGameObj::Get_Vehicle_Name()
{
if (( Get_Definition().VehicleNameID != 0 ) && (Get_Definition().VehicleNameID < TranslateDBClass::Get_Object_Count())) {
return TranslateDBClass::Get_String( Get_Definition().VehicleNameID );
}
return TRANSLATE(12648);
}
It is checking the ID against the number of entries in the translation table... but I believe it is perfectly valid and, in fact, expected, for there to be gaps in the table so the highest indexes would be > the count of entries in the table, resulting in it failing that check. What's your take on that jonwil?
It could be that is the source of the bug, try using a string with a low ID and see if that shows up properly to prove it out.
The extra check was added in commit c4ce60fa629cbdaebc3a2e825f8d67c8391d9dc2 in 2009, apparently to fix an FDS bug, so that explains why it's not an issue in 3.4.4
It's also worth checking out BeaconGameObj.cpp (line 475) and tdbedit.cpp (line 92) as those also appear to check an ID against the number of entries in the translation database...
[Updated on: Wed, 30 April 2014 07:01] Report message to a moderator
|
|
|
|
|
|
Re: Vehicle WEAPON names no longer shows up [message #487431 is a reply to message #487407] |
Wed, 30 April 2014 08:12 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
![](http://renegadeforums.com/images/custom_avatars/2893.jpg) |
danpaul88
Messages: 5795 Registered: June 2004 Location: England
Karma: 0
|
General (5 Stars) |
|
|
Jonwil added it in 2009 with a comment about fixing a bug in the FDS along with a bunch of other changes, presumably it was hitting some invalid indexes somewhere which did bad things but the change would appear to have some flawed logic. You'd have to ask him what exactly it was fixing but I suspect that, given it was 5 years ago, he probably won't remember.
[Updated on: Wed, 30 April 2014 08:18] Report message to a moderator
|
|
|
|
|
Re: Vehicle WEAPON names no longer shows up [message #487436 is a reply to message #487407] |
Wed, 30 April 2014 14:58 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
|
I cant remember why I made the change.
Based on a reading of TranslateDBClass::Find_Object(uint32 id) in TranslateDBClass.h and other stuff in TranslateDBClass.h, the correct way to do what I was doing would have been to do something like this:
const wchar_t *VehicleGameObj::Get_Vehicle_Name()
{
if (( Get_Definition().VehicleNameID != 0 ) && (Get_Definition().VehicleNameID-1000 < TranslateDBClass::Get_Object_Count())) {
return TranslateDBClass::Get_String( Get_Definition().VehicleNameID );
}
return TRANSLATE(12648);
}
In the case of BeaconGameObj.cpp, its correctly subtracting 1000 (aka ID_MIN) before doing the comparison.
Checking tdbedit, it looks like Goto in tdbedit.cpp (based on the things that call it) is supposed to take an index into the TranslateDBClass array and therefore is doing what it should be doing.
So in theory if you make sure that there is a string with an ID that's at least 1000 more than the IDs you are using for your weapon strings, it SHOULD work. (hence why it works for other people)
As for an actual fix, I will commit a fix to 5.0 (where work is going forward) and to 4.2 (our stable branch) but we wont be releasing a fix for 4.1 at this time.
Jonathan Wilson aka Jonwil
Creator and Lead Coder of the Custom scripts.dll
Renegade Engine Guru
Creator and Lead Coder of TT.DLL
Official member of Tiberian Technologies
|
|
|
|
Re: Vehicle WEAPON names no longer shows up [message #487439 is a reply to message #487407] |
Thu, 01 May 2014 01:28 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
![](http://renegadeforums.com/images/custom_avatars/2893.jpg) |
danpaul88
Messages: 5795 Registered: June 2004 Location: England
Karma: 0
|
General (5 Stars) |
|
|
But that still doesn't explain why you'd compare a non-sequential ID against the object count. String IDs are not, to my knowledge anyway, re-numbered when entries are deleted (or things referencing them would break if they were not also updated) so a list of IDs as follows;
1, 2, 6, 7, 10
would have a count of 5, so indexes 6, 7 and 10 would become inaccessible because they are > 5 (ignoring the MIN_ID bit for now). It still looks like a flaw to me...
[Updated on: Thu, 01 May 2014 01:28] Report message to a moderator
|
|
|
Re: Vehicle WEAPON names no longer shows up [message #487441 is a reply to message #487407] |
Thu, 01 May 2014 03:20 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
|
Here is TranslateDBClass::Add_Object from TranslateDBClass.cpp:
bool TranslateDBClass::Add_Object(TDBObjClass *object)
{
if (object)
{
if (object->Get_ID() <= 999)
{
object->Set_ID(Find_Unique_ID());
}
int id = object->Get_ID() - 1000;
while (m_ObjectList.Count() <= id)
{
TDBObjClass *obj = 0;
m_ObjectList.Add(obj);
}
m_ObjectList[id] = object;
StringClass str = object->Get_ID_Desc();
_strlwr(str.Peek_Buffer());
m_ObjectHash.Insert(str,object);
return true;
}
return false;
}
If you look at it, you can see clearly that it specifically adds empty strings such that the index into the array is always equal to the ID - 1000 (the while() loop in the code above)
In your example, element 0 in the array would contain string ID 1, element 1 would contain string ID 2, element 3 would be empty, element 4 would be empty, element 5 would contain string ID 6, element 6 would contain string ID 7, element 7 would be empty, element 8 would be empty and element 9 would contain string ID 10. Count would be 10.
Jonathan Wilson aka Jonwil
Creator and Lead Coder of the Custom scripts.dll
Renegade Engine Guru
Creator and Lead Coder of TT.DLL
Official member of Tiberian Technologies
[Updated on: Thu, 01 May 2014 03:23] Report message to a moderator
|
|
|
|
|
Re: Vehicle WEAPON names no longer shows up [message #487446 is a reply to message #487407] |
Thu, 01 May 2014 07:06 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
![](http://renegadeforums.com/images/custom_avatars/2893.jpg) |
danpaul88
Messages: 5795 Registered: June 2004 Location: England
Karma: 0
|
General (5 Stars) |
|
|
No, we do know why it isn't working, as jonwil explained above. The top 999 allocated IDs are un-usuable for vehicle weapon names currently, as indicated above. It will be patched for 5.0 and in the 4.2 branch.
Checking against the object count IS valid due to how it populates gaps in the table but there is a different bug whereby it should have subtracted 1000 from the ID first before comparing it to the count.
[Updated on: Thu, 01 May 2014 07:08] Report message to a moderator
|
|
|
Re: Vehicle WEAPON names no longer shows up [message #487447 is a reply to message #487446] |
Thu, 01 May 2014 07:30 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) |
![](/images/custom_avatars/21300.png) |
Jerad2142
Messages: 3807 Registered: July 2006 Location: USA
Karma: 6
|
General (3 Stars) |
|
|
jonwil wrote on Wed, 30 April 2014 15:58 |
const wchar_t *VehicleGameObj::Get_Vehicle_Name()
{
if (( Get_Definition().VehicleNameID != 0 ) && (Get_Definition().VehicleNameID-1000 < TranslateDBClass::Get_Object_Count())) {
return TranslateDBClass::Get_String( Get_Definition().VehicleNameID );
}
return TRANSLATE(12648);
}
|
I went ahead and tried that but of course it didn't work, I assume that its called via client side code instead of scripts code so my change doesn't actually persist to the .dll it needs to.
Visit Jerad's deer sweat shop
[Updated on: Thu, 01 May 2014 07:53] Report message to a moderator
|
|
|