# Updates to the tech system, and bug fixes.

Techs: Made a separate list of technologies for every player, rather
than array fields in CTechnology. This also involved changing the
tech-related JS functions.

Bugs:
- PS_MAX_PLAYERS should be 8 (the way it's used for array sizes, etc
indicates that it's the maximum possible number of players ever, but it
used to be 6 while the game had 8 players).
- When you changed a CJSSharedProperty that was inherited, m_Inherited
was set to false, so it was no longer inherited by subsequent entities
you created. They got initialized to garbage values as a result.

This was SVN commit r4138.
This commit is contained in:
Matei
2006-07-18 04:17:46 +00:00
parent 1828443b02
commit 845b606763
13 changed files with 127 additions and 95 deletions
+16 -3
View File
@@ -345,12 +345,25 @@ JSBool isFormationLocked( JSContext* cx, JSObject* UNUSED(obj), uint argc, jsval
JSBool getTechnology( JSContext* cx, JSObject* UNUSED(obj), uint argc, jsval* argv, jsval* rval )
{
REQUIRE_MIN_PARAMS(1, getTechnology);
REQUIRE_MIN_PARAMS(2, getTechnology);
CStrW name = ToPrimitive<CStrW>( argv[0] );
CStrW name;
CPlayer* player;
try
{
name = g_ScriptingHost.ValueToUCString( argv[0] );
player = ToNative<CPlayer>( argv[1] );
}
catch( PSERROR_Scripting_ConversionFailed )
{
JS_ReportError( cx, "Invalid parameters for getTechnology (expected name and player)" );
return( JS_TRUE );
}
*rval = JSVAL_NULL;
CTechnology* tech = g_TechnologyCollection.getTechnology( name );
CTechnology* tech = g_TechnologyCollection.getTechnology( name, player );
if ( tech )
*rval = ToJSVal( tech );
else