Copy-paste mistake (probably)

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

Moderators: winston, another_commander, Getafix

Post Reply
User avatar
Milo
---- E L I T E ----
---- E L I T E ----
Posts: 462
Joined: Mon Sep 17, 2018 5:01 pm

Copy-paste mistake (probably)

Post by Milo »

The string passed to OOJSReportBadArguments at line 390 of OOJSGlobal.m is inconsistent with the method calling it: displayNameForCommodity should be randomInhabitantsDescription

Code: Select all

// randomInhabitantsDescription() : String
static JSBool GlobalRandomInhabitantsDescription(JSContext *context, uintN argc, jsval *vp)
{
	OOJS_NATIVE_ENTER(context)
	
	NSString			*string = nil;
	Random_Seed			aSeed;
	JSBool				isPlural = YES;
	
	if (argc > 0 && !JS_ValueToBoolean(context, OOJS_ARGV[0], &isPlural))
	{
		OOJSReportBadArguments(context, nil, @"displayNameForCommodity", 1, OOJS_ARGV, nil, @"boolean");
		return NO;
	}
	
	make_pseudo_random_seed(&aSeed);
	string = [UNIVERSE getSystemInhabitants:Ranrot()%OO_SYSTEMS_PER_GALAXY plural:isPlural];
	OOJS_RETURN_OBJECT(string);
	
	OOJS_NATIVE_EXIT
}
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4891
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Copy-paste mistake (probably)

Post by phkb »

Fixed in commit 4e97ce7
User avatar
Milo
---- E L I T E ----
---- E L I T E ----
Posts: 462
Joined: Mon Sep 17, 2018 5:01 pm

Re: Copy-paste mistake (probably)

Post by Milo »

Actually, is the condition surrounding that log message correct? I guess it is, but the function syntax comment above the function definition wasn’t updated to reflect the optional parameter.
Post Reply