2019-12-06 11:47 CET

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000689Spring engineGeneralpublic2007-12-16 14:21
Reporterrattle 
Assigned ToKDR_11k 
PrioritynormalSeverityfeatureReproducibilityalways
StatusresolvedResolutionfixed 
Product Version 
Target VersionFixed in Version 
Summary0000689: [patch] COB: get KILL_UNIT (125)
DescriptionCOB function to kill single units by UnitId.
get KILL_UNIT(UnitId, SelfDestruct=true, Reclaimed=false)

Uses constant 125.
TagsNo tags attached.
Checked infolog.txt for Errors
Attached Files
  • patch file icon 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];
    
    patch file icon COB_KILLUNIT.patch (1,322 bytes) 2007-11-20 04:53 +
  • patch file icon 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];
    
    patch file icon COB_KILLUNIT_typofix.patch (1,321 bytes) 2007-11-21 00:50 +
  • patch file icon 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];
    
    patch file icon COB_KILLUNIT2.patch (1,377 bytes) 2007-11-21 05:59 +

-Relationships
+Relationships

-Notes

~0001455

rattle (reporter)

More readable code now

~0001508

KDR_11k (reporter)

Committed with modifications in r5020.
+Notes

-Issue History
Date Modified Username Field Change
2007-11-20 04:53 rattle New Issue
2007-11-20 04:53 rattle File Added: COB_KILLUNIT.patch
2007-11-21 00:50 rattle File Added: COB_KILLUNIT_typofix.patch
2007-11-21 05:59 rattle Note Added: 0001455
2007-11-21 05:59 rattle File Added: COB_KILLUNIT2.patch
2007-12-16 14:21 KDR_11k Status new => resolved
2007-12-16 14:21 KDR_11k Resolution open => fixed
2007-12-16 14:21 KDR_11k Assigned To => KDR_11k
2007-12-16 14:21 KDR_11k Note Added: 0001508
+Issue History