Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 [2] 3 4 ... 11

Author Topic: Random Code Mistakes Thread  (Read 36250 times)

Dark.Revenant

  • Admiral
  • *****
  • Posts: 2806
    • View Profile
    • Sc2Mafia
Re: Random Code Mistakes Thread
« Reply #15 on: January 01, 2015, 07:06:11 PM »

Found another one!  Oh boy, this is why bounties kept spawning next to multiple markets.

line 503 of Misc.java:
Code: java
			if (!market.getPrimaryEntity().isInCurrentLocation()) continue;

This should be
Code: java
			if (market.getPrimaryEntity().getContainingLocation() != token.getContainingLocation()) continue;

As an aside, named bounties should probably use a market filter that takes into account diplomacy.  After all, it wouldn't be strange for a bounty to be hanging around Barad.
« Last Edit: January 01, 2015, 07:15:02 PM by Dark.Revenant »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Random Code Mistakes Thread
« Reply #16 on: January 01, 2015, 10:13:11 PM »

Hoo boy - thanks for spotting that, fixed!

(Yeah, named bounties are rather rough around the edges; I'll probably just end up reworking them completely at some point.)
Logged

Dark.Revenant

  • Admiral
  • *****
  • Posts: 2806
    • View Profile
    • Sc2Mafia
Re: Random Code Mistakes Thread
« Reply #17 on: March 13, 2015, 10:32:03 AM »

While looking at the autoresolver to see what affects it...

Line 655
Code: java
			float shieldMult = stats.getShieldAbsorptionMult().getModifiedValue() * stats.getShieldDamageTakenMult().getModifiedValue();

This doesn't use the new (proper) method of getting true shield strength, and beyond that will actually make the game think the shield is weaker if it takes less damage.  For example, an indestructible shield (damage taken mult = 0) is treated like the ship is unshielded.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Random Code Mistakes Thread
« Reply #18 on: March 13, 2015, 10:59:41 AM »

Thanks!

So it should basically just be 1 - that, or am I missing something else here?
Logged

Dark.Revenant

  • Admiral
  • *****
  • Posts: 2806
    • View Profile
    • Sc2Mafia
Re: Random Code Mistakes Thread
« Reply #19 on: March 13, 2015, 11:15:57 AM »

Would be (1 / shield efficiency) * (1 / damage taken mult) * absorption mult, if I'm not mistaken on what absorption mult actually does, since I don't use it.

This will also require a division by zero check to skip all logic and set shield ratio to 1 if either efficiency or damage taken mult are sufficiently close to zero.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Random Code Mistakes Thread
« Reply #20 on: March 13, 2015, 11:39:31 AM »

Riight, wasn't thinking straight.

Changed to:
Code: java
float shieldFluxPerDamage = hullSpec.getBaseShieldFluxPerDamageAbsorbed(); 
shieldFluxPerDamage *= stats.getShieldAbsorptionMult().getModifiedValue() * stats.getShieldDamageTakenMult().getModifiedValue();;
if (shieldFluxPerDamage < 0.1f) shieldFluxPerDamage = 0.1f;
float shieldMult = 1f / shieldFluxPerDamage;
normalizedShieldStr *= shieldMult;

Had to add a new API method; base shield flux/dam wasn't available from a hull spec API.
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4682
    • View Profile
    • GitHub profile
Re: Random Code Mistakes Thread
« Reply #21 on: May 15, 2015, 06:48:27 AM »

Are the following properties of market conditions intentional?
- Marine demand from Outpost is entirely consuming demand (while Military Base's is 99% non-consuming)
- Cryosanctum demand for regular crew, volatiles, organics and machinery is multiplied by population, but supply of green crew and organs is flat
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Random Code Mistakes Thread
« Reply #22 on: May 15, 2015, 07:47:43 AM »

Thank you - bug with Outpost (fixed), not a bug with Cryosanctum.
Logged

TJJ

  • Admiral
  • *****
  • Posts: 1905
    • View Profile
Re: Random Code Mistakes Thread
« Reply #23 on: May 26, 2015, 06:29:11 AM »

Not a code mistake as such, but "com/fs/graphics/TextureLoader" (in fs.common_obf.jar) references "de/matthiasmann/twl/utils/PNGDecoder$Format". (
PNGDecoder is not in the classpath, and is in fact not even included in the Starsector distribution.

I don't think it'll ever impact upon normal operation of the game, just an exceptional case I've had to code-around while developing SSME.
« Last Edit: May 26, 2015, 08:09:35 AM by TJJ »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Random Code Mistakes Thread
« Reply #24 on: May 26, 2015, 08:35:07 AM »

Yeah, that bit of code is never called, so... :)

(Was trying out some stuff to see if I could get faster PNG loading, but no dice on that attempt.)
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4682
    • View Profile
    • GitHub profile
Re: Random Code Mistakes Thread
« Reply #25 on: October 30, 2015, 04:12:44 AM »

(0.7 spoilers!)
Spoiler
InvestigationEventGoodRepWithOther.java, line 124 (in startEvent()):
Code: java
numPrior = faction.getMemoryWithoutUpdate().getFloat(MemFlags.MEMORY_KEY_NUM_GR_INVESTIGATIONS);
Lines 288-289 (in endEvent()):
Code: java
numPrior++;
faction.getMemoryWithoutUpdate().set(MemFlags.MEMORY_KEY_NUM_GR_INVESTIGATIONS, numPrior);
It increments numPrior even if the investigation is cancelled at start due to invalid relationships or faction settings, or somehow failing to find a market.
[close]
« Last Edit: October 30, 2015, 04:15:15 AM by Histidine »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Random Code Mistakes Thread
« Reply #26 on: October 30, 2015, 10:05:04 AM »

Nice catch, thanks! Fixed.
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4682
    • View Profile
    • GitHub profile
Re: Random Code Mistakes Thread
« Reply #27 on: November 01, 2015, 01:14:07 AM »

More 0.7 stuff (FleetFactoryV2.java, lines 109-117)

Code: java
		addRandomShips(transportPts, qf, fleet, random, market, 
ShipRoles.PERSONNEL_SMALL,
ShipRoles.PERSONNEL_MEDIUM,
ShipRoles.PERSONNEL_LARGE);

addRandomShips(transportPts, qf, fleet, random, market,
ShipRoles.PERSONNEL_SMALL,
ShipRoles.PERSONNEL_MEDIUM,
ShipRoles.PERSONNEL_LARGE);
I think the second batch of personnel transports are supposed to be liners instead.
Logged

Dark.Revenant

  • Admiral
  • *****
  • Posts: 2806
    • View Profile
    • Sc2Mafia
Re: Random Code Mistakes Thread
« Reply #28 on: November 01, 2015, 01:17:13 AM »

Not that liners are ever actually used in the core campaign.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Random Code Mistakes Thread
« Reply #29 on: November 01, 2015, 09:44:00 AM »

Right, thanks - yeah, that was a placeholder for liners; changed it to add liners a couple of days ago :)
Logged
Pages: 1 [2] 3 4 ... 11