Attached Files |
-
COB_KILLUNIT.patch (1,322 bytes) 2007-11-20 04:53
Index: CobInstance.cpp
===================================================================
--- CobInstance.cpp (revision 4836)
+++ CobInstance.cpp (working copy)
@@ -115,8 +115,8 @@
#define FLANK_B_MOBILITY_ADD 122 // set or get
#define FLANK_B_MAX_DAMAGE 123 // set or get
#define FLANK_B_MIN_DAMAGE 124 // set or get
+#define KILL_UNIT 125 // get KILL_UNIT(unitId, bSelfDestruct=true, bReclaimed=false)
-
// NOTE: shared variables use codes [1024 - 5119]
int CCobInstance::teamVars[MAX_TEAMS][TEAM_VAR_COUNT] = { 0 };
@@ -1208,6 +1208,21 @@
return int((unit->flankingBonusAvgDamage + unit->flankingBonusDifDamage) * COBSCALE);
case FLANK_B_MIN_DAMAGE:
return int((unit->flankingBonusAvgDamage - unit->flankingBonusDifDamage) * COBSCALE);
+ case KILL_UNIT:
+ if (p1 > 0 && p1 < MAX_UNITS) {
+ if (uh->units[p1]) {
+ if (!uh->units[p1]->beingBuilt) {
+ uh->units[p1]->KillUnit((!!p2?!!p2:true), (!!p3?!!p3:false), NULL);
+ return true;
+ }
+ else {
+ uh->units[p1]->KillUnit(false, true, NULL); // no explosions for units under construction
+ return true;
+ }
+ }
+ else return false;
+ }
+ else return false;
default:
if ((val >= GLOBAL_VAR_START) && (val <= GLOBAL_VAR_END)) {
return globalVars[val - GLOBAL_VAR_START];
-
COB_KILLUNIT_typofix.patch (1,321 bytes) 2007-11-21 00:50
Index: CobInstance.cpp
===================================================================
--- CobInstance.cpp (revision 4841)
+++ CobInstance.cpp (working copy)
@@ -115,8 +115,8 @@
#define FLANK_B_MOBILITY_ADD 122 // set or get
#define FLANK_B_MAX_DAMAGE 123 // set or get
#define FLANK_B_MIN_DAMAGE 124 // set or get
+#define KILL_UNIT 125 // get KILL_UNIT(unitId, SelfDestruct=true, Reclaimed=false)
-
// NOTE: shared variables use codes [1024 - 5119]
int CCobInstance::teamVars[MAX_TEAMS][TEAM_VAR_COUNT] = { 0 };
@@ -1208,6 +1208,21 @@
return int((unit->flankingBonusAvgDamage + unit->flankingBonusDifDamage) * COBSCALE);
case FLANK_B_MIN_DAMAGE:
return int((unit->flankingBonusAvgDamage - unit->flankingBonusDifDamage) * COBSCALE);
+ case KILL_UNIT:
+ if (p1 >= 0 && p1 < MAX_UNITS) {
+ if (uh->units[p1]) {
+ if (!uh->units[p1]->beingBuilt) {
+ uh->units[p1]->KillUnit((!!p2?!!p2:true), (!!p3?!!p3:false), NULL);
+ return true;
+ }
+ else {
+ uh->units[p1]->KillUnit(false, true, NULL); // no explosions for units under construction
+ return true;
+ }
+ }
+ else return false;
+ }
+ else return false;
default:
if ((val >= GLOBAL_VAR_START) && (val <= GLOBAL_VAR_END)) {
return globalVars[val - GLOBAL_VAR_START];
-
COB_KILLUNIT2.patch (1,377 bytes) 2007-11-21 05:59
Index: rts/Sim/Units/COB/CobInstance.cpp
===================================================================
--- rts/Sim/Units/COB/CobInstance.cpp (revision 4844)
+++ rts/Sim/Units/COB/CobInstance.cpp (working copy)
@@ -115,8 +115,8 @@
#define FLANK_B_MOBILITY_ADD 122 // set or get
#define FLANK_B_MAX_DAMAGE 123 // set or get
#define FLANK_B_MIN_DAMAGE 124 // set or get
+#define KILL_UNIT 125 // get KILL_UNIT(unitId, SelfDestruct=true, Reclaimed=false)
-
// NOTE: shared variables use codes [1024 - 5119]
int CCobInstance::teamVars[MAX_TEAMS][TEAM_VAR_COUNT] = { 0 };
@@ -1208,6 +1208,17 @@
return int((unit->flankingBonusAvgDamage + unit->flankingBonusDifDamage) * COBSCALE);
case FLANK_B_MIN_DAMAGE:
return int((unit->flankingBonusAvgDamage - unit->flankingBonusDifDamage) * COBSCALE);
+ case KILL_UNIT: {
+ const bool SelfDestruct = p2 ? p2 : true;
+ const bool Reclaimed = p3 ? p3 : false;
+ CUnit *u = (p1 >= 0 && p1 < MAX_UNITS) ? uh->units[p1] : NULL;
+ if (u != NULL)
+ {
+ if (u->beingBuilt) u->KillUnit(false, true, NULL); // no explosions and no corpse for units under construction
+ else u->KillUnit(SelfDestruct, Reclaimed, NULL);
+ }
+ return u != NULL ? true : false;
+ }
default:
if ((val >= GLOBAL_VAR_START) && (val <= GLOBAL_VAR_END)) {
return globalVars[val - GLOBAL_VAR_START];
|
---|