Author Topic: Small FRED bug  (Read 699 times)

0 Members and 1 Guest are viewing this topic.

Hello I noticed a small problem in FRED.
When you set the number of missiles on a ship other than the default, it is saved as a % of the bank capacity in the mission file. For example if a ship can carry 3 missiles of a type in a bank and you set the number to 2 in FRED, it'll be saved with the number 66 in secondarybanks. But if you open the weapon tab again, the number is now 1 in this example. If you close the weapon tab and open it again, the number is now 0.
The problem is probably caused by the way rounding the number is handled in FRED.

To repoduce the issue, use for my example a secondary weapon with cargo size of 4.0 in a ship with a secondarybank capacity of 15.
On the loadout screen, the ship can carry up to 4 missiles (15/4=3.75 so rounded to 4) but in FRED the max is 3 (rounded down even if the decimal is > 0.5), and if you set 2, close the tab then open it again it will display 1. Rince and repeat...

Edit: I forgot, I'm using the stable 3.7.4 version of FRED.

 

Offline Yarn

  • 210
Confirmed in both retail and the February 10, 2017 nightly. I think I also found the lines where the incorrect rounding occurs. Expect a pull request on GitHub shortly.

For anyone else who wants to test this, I found that this happens with the GTF Ulysses and the Harpoon if the number of Harpoons isn't a multiple of 4.

EDIT: Here's the PR: https://github.com/scp-fs2open/fs2open.github.com/pull/1213
« Last Edit: February 10, 2017, 07:50:20 pm by Yarn »
"Your fighter is running out of oil.  Please check under the hood and add more if necessary"
--strings.tbl, entry 177

"Freespace is very tired.  It is shutting down to get some rest."
--strings.tbl, entry 178

 

Offline Yarn

  • 210
The fix for your first issue (where missile counts in the weapons dialog sometimes drop) will be in the next nightly build. Keep in mind, however, that if a bank can hold more than 100 missiles, not every missile count is possible. (For example, the GTF Myrmidon can carry 160 Tempests in its third bank. If you try to load 159 Tempests in that bank, it will end up having only 158 Tempests. But at least that count won't keep dropping.)

As for your second issue:
To repoduce the issue, use for my example a secondary weapon with cargo size of 4.0 in a ship with a secondarybank capacity of 15.
On the loadout screen, the ship can carry up to 4 missiles (15/4=3.75 so rounded to 4) but in FRED the max is 3 (rounded down even if the decimal is > 0.5),
Of course, this discrepancy should be fixed, but the question is whether to fix the game or FRED. Technically, FRED is handling this correctly (after all, if a truck's capacity is 3.75 tons, it shouldn't be able to hold four 1-ton crates), but the in-game behavior goes all the way back to retail, and I'm sure there are missions that depend on this behavior for proper balance. Thus, I think FRED should be changed to match the game, but I'd like to hear from others before I make a pull request.
"Your fighter is running out of oil.  Please check under the hood and add more if necessary"
--strings.tbl, entry 177

"Freespace is very tired.  It is shutting down to get some rest."
--strings.tbl, entry 178

 
Personnaly I would stick to the game behavior as you said probably for game balance reasons as number are rounded like this since retail it seems.
Anyway thanks for the fix!

 

Offline AdmiralRalwood

  • 211
  • The Cthulhu programmer himself!
    • Skype
    • Steam
    • Twitter
As for your second issue:
To repoduce the issue, use for my example a secondary weapon with cargo size of 4.0 in a ship with a secondarybank capacity of 15.
On the loadout screen, the ship can carry up to 4 missiles (15/4=3.75 so rounded to 4) but in FRED the max is 3 (rounded down even if the decimal is > 0.5),
Of course, this discrepancy should be fixed, but the question is whether to fix the game or FRED. Technically, FRED is handling this correctly (after all, if a truck's capacity is 3.75 tons, it shouldn't be able to hold four 1-ton crates), but the in-game behavior goes all the way back to retail, and I'm sure there are missions that depend on this behavior for proper balance. Thus, I think FRED should be changed to match the game, but I'd like to hear from others before I make a pull request.
Your reasoning makes sense to me (and it would not be the first time a discrepancy between FSO and FRED was resolved in favour of the former).
Ph'nglui mglw'nafh Codethulhu GitHub wgah'nagl fhtagn.

schrödinbug (noun) - a bug that manifests itself in running software after a programmer notices that the code should never have worked in the first place.

When you gaze long into BMPMAN, BMPMAN also gazes into you.

"I am one of the best FREDders on Earth" -General Battuta

<Aesaar> literary criticism is vladimir putin

<MageKing17> "There's probably a reason the code is the way it is" is a very dangerous line of thought. :P
<MageKing17> Because the "reason" often turns out to be "nobody noticed it was wrong".
(the very next day)
<MageKing17> this ****ing code did it to me again
<MageKing17> "That doesn't really make sense to me, but I'll assume it was being done for a reason."
<MageKing17> **** ME
<MageKing17> THE REASON IS PEOPLE ARE STUPID
<MageKing17> ESPECIALLY ME

<MageKing17> God damn, I do not understand how this is breaking.
<MageKing17> Everything points to "this should work fine", and yet it's clearly not working.
<MjnMixael> 2 hours later... "God damn, how did this ever work at all?!"
(...)
<MageKing17> so
<MageKing17> more than two hours
<MageKing17> but once again we have reached the inevitable conclusion
<MageKing17> How did this code ever work in the first place!?

<@The_E> Welcome to OpenGL, where standards compliance is optional, and error reporting inconsistent

<MageKing17> It was all working perfectly until I actually tried it on an actual mission.

<IronWorks> I am useful for FSO stuff again. This is a red-letter day!
* z64555 erases "Thursday" and rewrites it in red ink

<MageKing17> TIL the entire homing code is held up by shoestrings and duct tape, basically.

 

Offline Yarn

  • 210
"Your fighter is running out of oil.  Please check under the hood and add more if necessary"
--strings.tbl, entry 177

"Freespace is very tired.  It is shutting down to get some rest."
--strings.tbl, entry 178