Get rid of LuaBaseImmovable::get_size

Bug #1544864 reported by GunChleoc
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
widelands
Fix Released
Low
Unassigned

Bug Description

Once we have added LuaBaseImmovable::get_fields to all subclasses, it can go.

This needs to be done before Build19, because it will break backwards compatibility.

Tags: lua

Related branches

Revision history for this message
SirVer (sirver) wrote :

Why do you want to get rid of it? duplicating the code in each subclass is not really better.

Also, I do not think it would break backwards compatibility, because no object of BaseImmovable could ever be instantiated (I think), it is a pure base class - or am I wrong about that?

Changed in widelands:
status: Confirmed → Incomplete
Revision history for this message
GunChleoc (gunchleoc) wrote :

This is actually one of the TODOs that you created yourself:

// TODO(SirVer): size should be similar to
// https://wl.widelands.org/docs/wl/autogen_wl_map/#wl.map.BaseImmovable.size.
// In fact, as soon as all descriptions are wrapped (also for other
// immovables besides buildings) we should get rid of BaseImmovable.size.

So, I'm not sure if we want to get rid of the entire object, or just the get_size function?

Revision history for this message
SirVer (sirver) wrote :

My intention here was to move all the static information of an object into the descr class, not necessarily to get rid of the object. get_size will return the same value, no matter which instance of a lumberjack you call it on. So it should probably be in the descr class.

there might be other methods for which this logic applies, but I am not sure.

Revision history for this message
GunChleoc (gunchleoc) wrote :

I have to look at what the second function does - size is now definitely available in the description objects.

Changed in widelands:
assignee: nobody → GunChleoc (gunchleoc)
status: Incomplete → In Progress
Revision history for this message
GunChleoc (gunchleoc) wrote :

I have played with this now - BuildingDescr and ImmovableDescr do not inherit from each other, and MapObject doesn't have size. So, all I can do is move get_size from BaseImmovable to ImmovableDescription.

LuaBaseImmovable::get_fields is a function of the actual immovable, so it will stay as it is.

GunChleoc (gunchleoc)
summary: - Get rid of LuaBaseImmovable
+ Get rid of LuaBaseImmovable::get_size
SirVer (sirver)
Changed in widelands:
importance: High → Low
status: In Progress → Fix Committed
assignee: GunChleoc (gunchleoc) → nobody
GunChleoc (gunchleoc)
Changed in widelands:
status: Fix Committed → Fix Released
Revision history for this message
GunChleoc (gunchleoc) wrote :

Fixed in build19-rc1.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.