From 4c5dfac952ece858c8e8ff0769069216c541dd57 Mon Sep 17 00:00:00 2001 From: Nicolas Hake Date: Tue, 24 Jul 2018 14:19:26 +0200 Subject: [PATCH] Remove or use unused variables in Objects, System --- planet/Objects.ocd/Clonk.ocd/Animations.ocd/Script.c | 2 -- planet/Objects.ocd/Environment.ocd/Ambience.ocd/Script.c | 4 ++-- planet/Objects.ocd/Environment.ocd/PlayerStart.ocd/Script.c | 2 +- .../HUD.ocd/Controller.ocd/ControllerWealth.ocd/Script.c | 2 -- planet/Objects.ocd/HUD.ocd/ControllerLibrary.ocd/Script.c | 1 - .../Objects.ocd/HUD.ocd/ObjectInteractionMenu.ocd/Script.c | 6 +++--- planet/Objects.ocd/Helpers.ocd/UserAction.ocd/Script.c | 6 ++++-- .../Objects.ocd/Items.ocd/Resources.ocd/Coal.ocd/Script.c | 5 ++--- .../Objects.ocd/Items.ocd/Tools.ocd/Dynamite.ocd/Script.c | 3 +-- planet/Objects.ocd/Items.ocd/Tools.ocd/WindBag.ocd/Script.c | 1 - .../Libraries.ocd/Flammable.ocd/BurnedObject.ocd/Script.c | 3 +-- planet/Objects.ocd/Libraries.ocd/RopePhysics.ocd/Script.c | 1 - .../Libraries.ocd/Structures.ocd/Producer.ocd/Script.c | 4 ---- planet/Objects.ocd/Vegetation.ocd/Cotton.ocd/Script.c | 3 +-- planet/Objects.ocd/Vegetation.ocd/Seaweed.ocd/Script.c | 2 +- planet/System.ocg/Creation.c | 2 +- planet/System.ocg/Math.c | 1 - planet/System.ocg/SaveScenario.c | 2 +- 18 files changed, 18 insertions(+), 32 deletions(-) diff --git a/planet/Objects.ocd/Clonk.ocd/Animations.ocd/Script.c b/planet/Objects.ocd/Clonk.ocd/Animations.ocd/Script.c index 4d943e6ae..db9d00743 100644 --- a/planet/Objects.ocd/Clonk.ocd/Animations.ocd/Script.c +++ b/planet/Objects.ocd/Clonk.ocd/Animations.ocd/Script.c @@ -672,8 +672,6 @@ func FxIntScaleTimer(target, number, time) } this.dist = dist; SetAnimationPosition(number.animation_id, Anim_Const(GetAnimationLength("ScaleTop")*dist/800)); - // The animation's graphics has to be shifet a bit to adjust to the clonk movement - var pos = GetAnimationPosition(number.animation_id); SetScaleRotation(0, 0, 0, 0, 0, true); // Check if corner scale help is needed if (CheckScaleTopHelper()) diff --git a/planet/Objects.ocd/Environment.ocd/Ambience.ocd/Script.c b/planet/Objects.ocd/Environment.ocd/Ambience.ocd/Script.c index b5548006a..63f2ecec8 100644 --- a/planet/Objects.ocd/Environment.ocd/Ambience.ocd/Script.c +++ b/planet/Objects.ocd/Environment.ocd/Ambience.ocd/Script.c @@ -81,12 +81,12 @@ func InitializeEnvironments() AddEnvironment(underwater, 1400); // City: Clonk is surrounded by buildings - var city = this.env_city = new Environment + this.env_city = new Environment { Name = "City", CheckPlayer = this.EnvCheck_City, }; - //AddEnvironment(city, 1200); - no music/sound for now + //AddEnvironment(this.env_city, 1200); - no music/sound for now // Lava: Lava material is nearby var lava = this.env_lava = new Environment diff --git a/planet/Objects.ocd/Environment.ocd/PlayerStart.ocd/Script.c b/planet/Objects.ocd/Environment.ocd/PlayerStart.ocd/Script.c index 433a889f2..63ea0c088 100644 --- a/planet/Objects.ocd/Environment.ocd/PlayerStart.ocd/Script.c +++ b/planet/Objects.ocd/Environment.ocd/PlayerStart.ocd/Script.c @@ -356,7 +356,7 @@ private func InitializeMaterial(int plr) // So e.g. each clonk can get one shovel for (var idlist_entry in starting_material) { - var best_target = nil, target_score, clonk; + var best_target = nil, target_score; var obj = EditorBase->CreateItemPlusParameter(idlist_entry, GetX(), GetY() + GetDefHeight() / 2, plr); if (!obj || !obj.Collectible) continue; var id = idlist_entry.id; diff --git a/planet/Objects.ocd/HUD.ocd/Controller.ocd/ControllerWealth.ocd/Script.c b/planet/Objects.ocd/HUD.ocd/Controller.ocd/ControllerWealth.ocd/Script.c index fb36bdadc..9314b5cf2 100644 --- a/planet/Objects.ocd/HUD.ocd/Controller.ocd/ControllerWealth.ocd/Script.c +++ b/planet/Objects.ocd/HUD.ocd/Controller.ocd/ControllerWealth.ocd/Script.c @@ -28,7 +28,6 @@ public func ShowWealth() if (GetType(this) == C4V_Def) { GUI_Controller_Wealth_shown = true; // for players joining later - var plr; for (var i=0; iCall(info.menu.callback, info.entry.symbol, info.entry.extra_data, cursor); + callback_target->Call(info.menu.callback, info.entry.symbol, info.entry.extra_data, cursor); - // todo: trigger refresh for special value of result? + // todo: trigger refresh for special value of callback result? } private func OnContentsSelection(symbol, extra_data) diff --git a/planet/Objects.ocd/Helpers.ocd/UserAction.ocd/Script.c b/planet/Objects.ocd/Helpers.ocd/UserAction.ocd/Script.c index 372a16542..73bb83cc4 100644 --- a/planet/Objects.ocd/Helpers.ocd/UserAction.ocd/Script.c +++ b/planet/Objects.ocd/Helpers.ocd/UserAction.ocd/Script.c @@ -1057,7 +1057,10 @@ private func EvalAct_CastObjects(proplist props, proplist context) var mean_angle = EvaluateValue("Integer", props.MeanAngle, context); var angle_deviation = EvaluateValue("Integer", props.AngleDeviation, context); var position = EvaluatePosition(props.Position, context); - context.last_casted_objects = CastObjects(create_id, amount, speed, position[0], position[1], mean_angle, angle_deviation); + var objects = CastObjects(create_id, amount, speed, position[0], position[1], mean_angle, angle_deviation); + for (var obj in objects) + obj->SetOwner(owner); + context.last_casted_objects = objects; } private func EvalAct_CastParticles(proplist props, proplist context) @@ -1071,7 +1074,6 @@ private func EvalAct_CastParticles(proplist props, proplist context) if (lifetime <= 0) return; var position = EvaluatePosition(props.Position, context); var color = (EvaluateValue("Color", props.Color, context) ?? 0xffffff) | 0xff000000; - var blit_mode = props.BlitMode; var fadeout = props.FadeOut; var gravity = EvaluateValue("Integer", props.Gravity, context); var collision_func = props.CollisionFunc; diff --git a/planet/Objects.ocd/Items.ocd/Resources.ocd/Coal.ocd/Script.c b/planet/Objects.ocd/Items.ocd/Resources.ocd/Coal.ocd/Script.c index 8d0a3c119..11d7f70d2 100644 --- a/planet/Objects.ocd/Items.ocd/Resources.ocd/Coal.ocd/Script.c +++ b/planet/Objects.ocd/Items.ocd/Resources.ocd/Coal.ocd/Script.c @@ -25,8 +25,7 @@ func OnBurnDown() }; var r = GetR(); - var size = GetCon() * 110 / 100; - + for(var cnt = 0; cnt < 5; ++cnt) { var distance = 3; @@ -58,4 +57,4 @@ local BlastIncinerate = 5; local ContactIncinerate = 1; local Plane = 460; // Coal burns for about 7 seconds -local BurnDownTime = 245; \ No newline at end of file +local BurnDownTime = 245; diff --git a/planet/Objects.ocd/Items.ocd/Tools.ocd/Dynamite.ocd/Script.c b/planet/Objects.ocd/Items.ocd/Tools.ocd/Dynamite.ocd/Script.c index 001b40767..60f62c0b4 100644 --- a/planet/Objects.ocd/Items.ocd/Tools.ocd/Dynamite.ocd/Script.c +++ b/planet/Objects.ocd/Items.ocd/Tools.ocd/Dynamite.ocd/Script.c @@ -179,7 +179,6 @@ func Place(object clonk, int x, int y, bool box) // and puts the offset to the wall into "xo, yo" - looking from the clonk func GetWall(int angle) { - var dist = 12; for (var dist = 12; dist < 18; dist++) { var x = Sin(angle, dist); @@ -264,4 +263,4 @@ local Description = "$Description$"; local Collectible = true; local BlastIncinerate = 1; local ContactIncinerate = 1; -local Components = {Coal = 1, Firestone = 1}; \ No newline at end of file +local Components = {Coal = 1, Firestone = 1}; diff --git a/planet/Objects.ocd/Items.ocd/Tools.ocd/WindBag.ocd/Script.c b/planet/Objects.ocd/Items.ocd/Tools.ocd/WindBag.ocd/Script.c index a3e7598fe..65e28a612 100644 --- a/planet/Objects.ocd/Items.ocd/Tools.ocd/WindBag.ocd/Script.c +++ b/planet/Objects.ocd/Items.ocd/Tools.ocd/WindBag.ocd/Script.c @@ -45,7 +45,6 @@ protected func ControlUse(object clonk, x, y) func ReadyToBeUsed(proplist data) { - var clonk = data.clonk; return !GetEffect("IntReload", this); } diff --git a/planet/Objects.ocd/Libraries.ocd/Flammable.ocd/BurnedObject.ocd/Script.c b/planet/Objects.ocd/Libraries.ocd/Flammable.ocd/BurnedObject.ocd/Script.c index 439280534..8a6401660 100644 --- a/planet/Objects.ocd/Libraries.ocd/Flammable.ocd/BurnedObject.ocd/Script.c +++ b/planet/Objects.ocd/Libraries.ocd/Flammable.ocd/BurnedObject.ocd/Script.c @@ -26,7 +26,6 @@ public func BurstIntoAshes() }; var r = GetR(); - var size = GetCon() * 110 / 100; for(var cnt = 0; cnt < 5; ++cnt) { @@ -77,4 +76,4 @@ local Name = "$Name$"; local Description = "$Description$"; local BlastIncinerate = 1; local ContactIncinerate = 1; -local Plane = 390; \ No newline at end of file +local Plane = 390; diff --git a/planet/Objects.ocd/Libraries.ocd/RopePhysics.ocd/Script.c b/planet/Objects.ocd/Libraries.ocd/RopePhysics.ocd/Script.c index f6382d2cb..c04fb9ae3 100644 --- a/planet/Objects.ocd/Libraries.ocd/RopePhysics.ocd/Script.c +++ b/planet/Objects.ocd/Libraries.ocd/RopePhysics.ocd/Script.c @@ -276,7 +276,6 @@ public func DoLength(int dolength) last_length = GetLastLength(); } - var i = 0; while (last_length > LIB_ROPE_SegmentLength * LIB_ROPE_Precision * 3 / 2) { lib_rope_particle_count++; diff --git a/planet/Objects.ocd/Libraries.ocd/Structures.ocd/Producer.ocd/Script.c b/planet/Objects.ocd/Libraries.ocd/Structures.ocd/Producer.ocd/Script.c index 7a9ddbf0f..10427390a 100644 --- a/planet/Objects.ocd/Libraries.ocd/Structures.ocd/Producer.ocd/Script.c +++ b/planet/Objects.ocd/Libraries.ocd/Structures.ocd/Producer.ocd/Script.c @@ -968,10 +968,6 @@ private func ConvertToLiquid(object obj) if (liquid) { liquid->Enter(this); - for (var item in FindObjects(Find_Container(this))) - { - //Log("* %v %s", item, item->GetName()); - } obj->RemoveObject(); } } diff --git a/planet/Objects.ocd/Vegetation.ocd/Cotton.ocd/Script.c b/planet/Objects.ocd/Vegetation.ocd/Cotton.ocd/Script.c index e15937bdc..2f84e007d 100644 --- a/planet/Objects.ocd/Vegetation.ocd/Cotton.ocd/Script.c +++ b/planet/Objects.ocd/Vegetation.ocd/Cotton.ocd/Script.c @@ -218,8 +218,7 @@ public func FruitFills(int branch, int time, bool fullgrown) if (fullgrown) SetAnimationPosition(branches[branch].grow_animation, Anim_Const(GetAnimationLength("grow", branches[branch].attach_slot)), branches[branch].attach_slot); else - SetAnimationPosition(branches[branch].grow_animation, Anim_Linear(GetAnimationPosition(branches[branch].grow_animation, - branches[branch].attach_slot), + SetAnimationPosition(branches[branch].grow_animation, Anim_Linear(pos, 0, GetAnimationLength("grow", branches[branch].attach_slot), time, diff --git a/planet/Objects.ocd/Vegetation.ocd/Seaweed.ocd/Script.c b/planet/Objects.ocd/Vegetation.ocd/Seaweed.ocd/Script.c index 08e48bb57..09c9ced89 100644 --- a/planet/Objects.ocd/Vegetation.ocd/Seaweed.ocd/Script.c +++ b/planet/Objects.ocd/Vegetation.ocd/Seaweed.ocd/Script.c @@ -14,7 +14,7 @@ func Place(int amount, proplist area, proplist settings) var spot = FindLocation(Loc_Material("Water"), Loc_Wall(CNAT_Bottom), loc_area); if (!spot) continue; - var f = CreateObjectAbove(this, spot.x, spot.y, NO_OWNER); + CreateObjectAbove(this, spot.x, spot.y, NO_OWNER); --amount; } return true; diff --git a/planet/System.ocg/Creation.c b/planet/System.ocg/Creation.c index 9fb7689ba..174d14730 100644 --- a/planet/System.ocg/Creation.c +++ b/planet/System.ocg/Creation.c @@ -167,7 +167,7 @@ global func DrawParticleLine(string particle, int x0, int y0, int x1, int y1, in // Create particles. while (i >= 0) { - var i1, i2, b; + var i1, i2; i2 = i * 256 / prtnum; i1 = 256 - i2; diff --git a/planet/System.ocg/Math.c b/planet/System.ocg/Math.c index 6021b44d9..548c84dff 100644 --- a/planet/System.ocg/Math.c +++ b/planet/System.ocg/Math.c @@ -156,7 +156,6 @@ global func GetSurfaceVector(int x, int y) { var normal = [0, 0]; - var fac = 1; for(var fac = 1; fac <= 4; fac *= 2) { if(GBackSolid(x + fac, y)) --normal[0]; diff --git a/planet/System.ocg/SaveScenario.c b/planet/System.ocg/SaveScenario.c index 8c4da3283..373d1b6dc 100644 --- a/planet/System.ocg/SaveScenario.c +++ b/planet/System.ocg/SaveScenario.c @@ -569,7 +569,7 @@ global func GetBitmaskNameByValue(v, prefix) { // Compose bitmask of names of individual bits // e.g. GetBitmaskNameByValue(3, "C4D_") == "C4D_StaticBack|C4D_Structure" - var s, n=0; + var s; for (var i=0; i<31 && v; ++i) { var v2 = 1<