Skip to content

Commit

Permalink
Remove tdfID weapon def (#1467)
Browse files Browse the repository at this point in the history
Replaced with regular ID in COB, removed elsewhere.
  • Loading branch information
sprunk authored Nov 3, 2024
1 parent d03b023 commit 8ad8a12
Show file tree
Hide file tree
Showing 9 changed files with 2 additions and 20 deletions.
2 changes: 0 additions & 2 deletions AI/Wrappers/LegacyCpp/AIAICallback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1259,8 +1259,6 @@ const springLegacyAI::WeaponDef* springLegacyAI::CAIAICallback::GetWeaponDefById

// weaponDef->id = sAICallback->WeaponDef_getId(skirmishAIId, weaponDefId);
weaponDef->id = weaponDefId;
// weaponDef->tdfId = sAICallback->WeaponDef_getTdfId(skirmishAIId, weaponDefId);
weaponDef->tdfId = -1;

weaponDef->turret = sAICallback->WeaponDef_isTurret(skirmishAIId, weaponDefId);
weaponDef->onlyForward = sAICallback->WeaponDef_isOnlyForward(skirmishAIId, weaponDefId);
Expand Down
3 changes: 0 additions & 3 deletions AI/Wrappers/LegacyCpp/WeaponDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ struct WeaponDef
, energycost(0.0f)
, projectilespershot(0)
, id(0)
, tdfId(0)
, turret(false)
, onlyForward(false)
, fixedLauncher(false)
Expand Down Expand Up @@ -172,7 +171,6 @@ struct WeaponDef
, energycost(0.0f)
, projectilespershot(0)
, id(0)
, tdfId(0)
, turret(false)
, onlyForward(false)
, fixedLauncher(false)
Expand Down Expand Up @@ -305,7 +303,6 @@ struct WeaponDef
int projectilespershot;

int id;
int tdfId; ///< the id= tag in the tdf

bool turret;
bool onlyForward;
Expand Down
5 changes: 0 additions & 5 deletions doc/site/_data/weapondefs.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@
"defaultValue": Cannon,
"type": "std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >"
},
"id": {
"internalName": "tdfId",
"defaultValue": 0,
"type": "int"
},
"customParams": {
"type": "table"
},
Expand Down
4 changes: 0 additions & 4 deletions rts/ExternalAI/SSkirmishAICallbackImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4492,10 +4492,6 @@ EXPORT(int) skirmishAiCallback_WeaponDef_getProjectilesPerShot(int skirmishAIId,
return getWeaponDefById(skirmishAIId, weaponDefId)->projectilespershot;
}

//EXPORT(int) skirmishAiCallback_WeaponDef_getTdfId(int skirmishAIId, int weaponDefId) {
// return getWeaponDefById(skirmishAIId, weaponDefId)->tdfId;
//}

EXPORT(bool) skirmishAiCallback_WeaponDef_isTurret(int skirmishAIId, int weaponDefId) {
return getWeaponDefById(skirmishAIId, weaponDefId)->turret;
}
Expand Down
2 changes: 0 additions & 2 deletions rts/Lua/LuaWeaponDefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -460,8 +460,6 @@ static bool InitParamMap()

ADD_INT("id", wd.id);

ADD_INT("tdfId", wd.tdfId);

ADD_STRING("name", wd.name);
ADD_STRING("description", wd.description);

Expand Down
2 changes: 1 addition & 1 deletion rts/Sim/Units/Scripts/CobInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ void CCobInstance::HitByWeapon(const float3& hitDir, int weaponDefId, float& ino
const WeaponDef* wd = weaponDefHandler->GetWeaponDefByID(weaponDefId);

callinArgs[0] = 4;
callinArgs[3] = ((wd != nullptr)? wd->tdfId : -1);
callinArgs[3] = ((wd != nullptr)? wd->id : -1);
callinArgs[4] = int(100 * inoutDamage);
// weaponHitMod, not an actual arg
callinArgs[MAX_COB_ARGS] = 1;
Expand Down
2 changes: 1 addition & 1 deletion rts/Sim/Units/Scripts/CobScriptNames.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ enum {
COBFN_MoveRate2, // -
COBFN_MoveRate3, // FIXME: unused (see CHoverAirMoveType::UpdateMoveRate)
COBFN_SetSFXOccupy, // in: curTerrainType
COBFN_HitByWeaponId, // in: 500 * hitDir.z, in: 500 * hitDir.x, in: weaponDefs[weaponId].tdfId, in: 100 * damage, return value: 100 * weaponHitMod
COBFN_HitByWeaponId, // in: 500 * hitDir.z, in: 500 * hitDir.x, in: weaponDefs[weaponId].id, in: 100 * damage, return value: 100 * weaponHitMod
COBFN_QueryLandingPadCount, // out: landingPadCount (default 16)
COBFN_QueryLandingPad, // landingPadCount times (out: piecenum)
COBFN_Falling, // -
Expand Down
1 change: 0 additions & 1 deletion rts/Sim/Weapons/WeaponDef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ WEAPONTAG(std::string, type).externalName("weaponType").defaultValue("Cannon")
"EmgCannon - deprecated, a version of Laser or Flame with crappy visuals\n"
"Rifle - deprecated, more or less equivalent to invisible Lightning\n"
);
WEAPONTAG(int, tdfId).externalName("id").defaultValue(0);
WEAPONDUMMYTAG(table, customParams).description("A table of arbitrary string key-value pairs, for use by Lua gadgets (no engine meaning)");

// Collision & Avoidance
Expand Down
1 change: 0 additions & 1 deletion rts/Sim/Weapons/WeaponDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ struct WeaponDef
int projectilespershot;

int id;
int tdfId; ///< the id= tag in the tdf

bool isNulled;
bool turret;
Expand Down

0 comments on commit 8ad8a12

Please sign in to comment.