Skip to content

Commit

Permalink
Remove or use unused variables in Objects, System
Browse files Browse the repository at this point in the history
  • Loading branch information
isilkor committed Jul 24, 2018
1 parent 5ef52f2 commit 4c5dfac
Show file tree
Hide file tree
Showing 18 changed files with 18 additions and 32 deletions.
2 changes: 0 additions & 2 deletions planet/Objects.ocd/Clonk.ocd/Animations.ocd/Script.c
Expand Up @@ -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())
Expand Down
4 changes: 2 additions & 2 deletions planet/Objects.ocd/Environment.ocd/Ambience.ocd/Script.c
Expand Up @@ -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
Expand Down
Expand Up @@ -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;
Expand Down
Expand Up @@ -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; i<GetPlayerCount(C4PT_User); ++i)
{
var plr = GetPlayerByIndex(i, C4PT_User);
Expand All @@ -49,7 +48,6 @@ public func HideWealth()
if (GetType(this) == C4V_Def)
{
GUI_Controller_Wealth_shown = false; // for players joining later
var plr;
for (var i=0; i<GetPlayerCount(C4PT_User); ++i)
{
var plr = GetPlayerByIndex(i, C4PT_User);
Expand Down
1 change: 0 additions & 1 deletion planet/Objects.ocd/HUD.ocd/ControllerLibrary.ocd/Script.c
Expand Up @@ -92,7 +92,6 @@ public func Reset()
{
// Definition call: Reset for all players
RemoveAll(Find_ID(GetGUIControllerID()));
var plr;
for (var i=0; i<GetPlayerCount(C4PT_User); ++i)
{
var plr = GetPlayerByIndex(i, C4PT_User);
Expand Down
6 changes: 3 additions & 3 deletions planet/Objects.ocd/HUD.ocd/ObjectInteractionMenu.ocd/Script.c
Expand Up @@ -408,7 +408,7 @@ func OpenMenuForObject(object obj, int slot, bool forced)
};

// Allow the menu to be closed with a clickable button.
var close_button = GuiAddCloseButton(root_menu, this, "Close");
GuiAddCloseButton(root_menu, this, "Close");

// Special setup for a minimized menu.
if (this.minimized)
Expand Down Expand Up @@ -877,9 +877,9 @@ func OnMenuEntrySelected(proplist menu_info, int entry_index, int player)
var callback_target;
if (!(callback_target = info.menu.callback_target)) return;
if (!info.menu.callback) return; // The menu can actually decide to handle user interaction itself and not provide a callback.
var result = callback_target->Call(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)
Expand Down
6 changes: 4 additions & 2 deletions planet/Objects.ocd/Helpers.ocd/UserAction.ocd/Script.c
Expand Up @@ -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)
Expand All @@ -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;
Expand Down
5 changes: 2 additions & 3 deletions planet/Objects.ocd/Items.ocd/Resources.ocd/Coal.ocd/Script.c
Expand Up @@ -25,8 +25,7 @@ func OnBurnDown()
};

var r = GetR();
var size = GetCon() * 110 / 100;


for(var cnt = 0; cnt < 5; ++cnt)
{
var distance = 3;
Expand Down Expand Up @@ -58,4 +57,4 @@ local BlastIncinerate = 5;
local ContactIncinerate = 1;
local Plane = 460;
// Coal burns for about 7 seconds
local BurnDownTime = 245;
local BurnDownTime = 245;
3 changes: 1 addition & 2 deletions planet/Objects.ocd/Items.ocd/Tools.ocd/Dynamite.ocd/Script.c
Expand Up @@ -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);
Expand Down Expand Up @@ -264,4 +263,4 @@ local Description = "$Description$";
local Collectible = true;
local BlastIncinerate = 1;
local ContactIncinerate = 1;
local Components = {Coal = 1, Firestone = 1};
local Components = {Coal = 1, Firestone = 1};
Expand Up @@ -45,7 +45,6 @@ protected func ControlUse(object clonk, x, y)

func ReadyToBeUsed(proplist data)
{
var clonk = data.clonk;
return !GetEffect("IntReload", this);
}

Expand Down
Expand Up @@ -26,7 +26,6 @@ public func BurstIntoAshes()
};

var r = GetR();
var size = GetCon() * 110 / 100;

for(var cnt = 0; cnt < 5; ++cnt)
{
Expand Down Expand Up @@ -77,4 +76,4 @@ local Name = "$Name$";
local Description = "$Description$";
local BlastIncinerate = 1;
local ContactIncinerate = 1;
local Plane = 390;
local Plane = 390;
1 change: 0 additions & 1 deletion planet/Objects.ocd/Libraries.ocd/RopePhysics.ocd/Script.c
Expand Up @@ -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++;
Expand Down
Expand Up @@ -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();
}
}
3 changes: 1 addition & 2 deletions planet/Objects.ocd/Vegetation.ocd/Cotton.ocd/Script.c
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion planet/Objects.ocd/Vegetation.ocd/Seaweed.ocd/Script.c
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion planet/System.ocg/Creation.c
Expand Up @@ -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;

Expand Down
1 change: 0 additions & 1 deletion planet/System.ocg/Math.c
Expand Up @@ -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];
Expand Down
2 changes: 1 addition & 1 deletion planet/System.ocg/SaveScenario.c
Expand Up @@ -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<<i;
Expand Down

0 comments on commit 4c5dfac

Please sign in to comment.