no bounty message when shooting boulders (rev 4580)

For test results, bug reports, announcements of new builds etc.

Moderators: winston, another_commander, Getafix

Post Reply
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

no bounty message when shooting boulders (rev 4580)

Post by Commander McLane »

I've just started a completely new Jameson without any OXPs (except debug.oxp) installed. I also have no equipment yet.

I notice that when shooting a boulder the bounty message

Code: Select all

Bounty: 0.5 ₢
Total: x.y ₢
isn't triggered.

It is displayed after shooting an asteroid, but not for boulders. The credits are correctly awarded, though.
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6683
Joined: Wed Feb 28, 2007 7:54 am

Re: no bounty message when shooting boulders (rev 4580)

Post by another_commander »

It looks like this is deliberate. The code that displays the message is in this method:

Code: Select all

- (void) collectBountyFor:(ShipEntity *)other
{
	if (other == nil || [other isSubEntity])  return;
	
	OOCreditsQuantity	score = 10 * [other bounty];
	OOScanClass			killClass = [other scanClass]; // **tgape** change (+line)
	BOOL				killAward = [other countsAsKill];
	
	if ([other isPolice])   // oops, we shot a copper!
	{
		legalStatus |= 64;
	}
	
	if (![UNIVERSE strict])	// only mess with the scores if we're not in 'strict' mode
	{
		BOOL killIsCargo = ((killClass == CLASS_CARGO) && ([other commodityAmount] > 0));
		if ((killIsCargo) || (killClass == CLASS_BUOY) || (killClass == CLASS_ROCK))
		{
			// EMMSTRAN: no killaward (but full bounty) for tharglets?
			if (![other hasRole:@"tharglet"])	// okay, we'll count tharglets as proper kills
			{
				score /= 10;	// reduce bounty awarded
				killAward = NO;	// don't award a kill
			}
		}
	}
	
	credits += score;
	
	if (score > 9)
	{
		NSString *bonusMsg = [NSString stringWithFormat:DESC(@"bounty-@-total-@"), OOCredits(score), OOCredits(credits)];
		
		[UNIVERSE addDelayedMessage:bonusMsg forCount:6 afterDelay:0.15];
	}
	
... <rest of method>
}
See what happens? The message is triggered only if the score of the target is higher than 9. But for boulders and asteroids, because they are scan class CLASS_ROCK, we enter in the part where it sets the kill to not-a-kill. In doing so, the score is divided by 10. For asteroids this is fine because the resulting score is 10, which is higher than 9 so the message triggers. For boulders though, the score gets set back to 5, so the message is skipped.
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Re: no bounty message when shooting boulders (rev 4580)

Post by Commander McLane »

You're right. Seems I was confused by the fact that BountyScanner.oxp displays a boulder's bounty. I'm usually paying more attention to the display next to the target reticle than to the consoleMessage. Thus I assumed that with my normal commander the commsMessage was displayed when shooting a boulder. This assumption was wrong.

...Which means that I have to revise Railgun.oxp, because I scripted it to display the commsMessage also for boulders, because of my incorrect general assumption.
Post Reply