Permalink
Browse files

qtscript: Change eventResearched() to always have 3 parameters, where…

… the

new third parameter is player called. Second parameter may be null.

Remove unused power parameter for ECM. Remove some dead code.
  • Loading branch information...
1 parent 07a8df0 commit c4f03621fdff2f3baea58cff6edbcc82d1eab123 @perim perim committed Mar 25, 2013
Showing with 8 additions and 13 deletions.
  1. +0 −3 data/mp/stats/ecm.ini
  2. +7 −2 src/qtscript.cpp
  3. +1 −2 src/stats.cpp
  4. +0 −6 src/stats.h
View
@@ -4,7 +4,6 @@ buildPoints = 0
weight = 0
body = 0
location = DEFAULT
-power = 0
range = 0
designable = 0
name = Z NULL ECM
@@ -16,7 +15,6 @@ weight = 0
body = 0
sensorModel = GNHREPAR.PIE
location = TURRET
-power = 0
range = 0
designable = 0
name = *Repair Center*
@@ -29,7 +27,6 @@ body = 200
sensorModel = gnmecm1.pie
mountModel = trmecm2.pie
location = TURRET
-power = 0
range = 1024
designable = 1
name = Jammer Turret
View
@@ -1074,11 +1074,11 @@ bool triggerEventAttacked(BASE_OBJECT *psVictim, BASE_OBJECT *psAttacker, int la
return true;
}
-//__ \subsection{eventResearched(research[, structure])}
+//__ \subsection{eventResearched(research, structure, player)}
//__ An event that is run whenever a new research is available. The structure
//__ parameter is set if the research comes from a research lab owned by the
//__ current player. If an ally does the research, the structure parameter will
-//__ be set to null.
+//__ be set to null. The player parameter gives the player it is called for.
bool triggerEventResearched(RESEARCH *psResearch, STRUCTURE *psStruct, int player)
{
for (int i = 0; i < scripts.size() && psStruct; ++i)
@@ -1093,6 +1093,11 @@ bool triggerEventResearched(RESEARCH *psResearch, STRUCTURE *psStruct, int playe
{
args += convStructure(psStruct, engine);
}
+ else
+ {
+ args += QScriptValue::NullValue;
+ }
+ args += QScriptValue(player);
callFunction(engine, "eventResearched", args);
}
}
View
@@ -591,7 +591,7 @@ bool statsAllocConstruct(UDWORD numStats)
const char *getStatName(const void *Stat)
{
const BASE_STATS *const psStats = (const BASE_STATS *)Stat;
-
+ ASSERT(psStats->pName, "No pName for stats!");
return getName(psStats->pName);
}
@@ -1188,7 +1188,6 @@ bool loadECMStats(const char *pFileName)
psStats->weight = ini.value("weight", 0).toInt();
psStats->body = ini.value("body", 0).toInt();
psStats->range = ini.value("range").toInt();
- psStats->power = ini.value("power").toInt();
psStats->designable = ini.value("designable", false).toBool();
allocateStatName((BASE_STATS *)psStats, list[i].toUtf8().constData());
View
@@ -38,7 +38,6 @@ extern BRAIN_STATS *asBrainStats;
extern PROPULSION_STATS *asPropulsionStats;
extern SENSOR_STATS *asSensorStats;
extern ECM_STATS *asECMStats;
-//extern ARMOUR_STATS *asArmourStats;
extern REPAIR_STATS *asRepairStats;
extern WEAPON_STATS *asWeaponStats;
extern CONSTRUCT_STATS *asConstructStats;
@@ -74,11 +73,9 @@ extern UDWORD numTerrainTypes;
/* What number the ref numbers start at for each type of stat */
#define REF_BODY_START 0x010000
#define REF_BRAIN_START 0x020000
-//#define REF_POWER_START 0x030000
#define REF_PROPULSION_START 0x040000
#define REF_SENSOR_START 0x050000
#define REF_ECM_START 0x060000
-//#define REF_ARMOUR_START 0x070000
#define REF_REPAIR_START 0x080000
#define REF_WEAPON_START 0x0a0000
#define REF_RESEARCH_START 0x0b0000
@@ -119,9 +116,6 @@ extern bool statsAllocBody(UDWORD numEntries);
/*Allocate Brain stats*/
extern bool statsAllocBrain(UDWORD numEntries);
-/*Allocate Power stats*/
-//extern bool statsAllocPower(UDWORD numEntries);
-
/*Allocate Propulsion stats*/
extern bool statsAllocPropulsion(UDWORD numEntries);

0 comments on commit c4f0362

Please sign in to comment.