forked from Mirrors/openclonk
Changed GetDefBottom to use bottom vertex to determine object bottom.
Since this is the method also used by CreateObject, GetDefBottom can be used to recreate objects at their proper position.stable-5.4
parent
5094cc5c1b
commit
a385102c36
|
@ -9,7 +9,7 @@
|
|||
<subcat>Status</subcat>
|
||||
<version>5.1 OC</version>
|
||||
<syntax><rtype>int</rtype></syntax>
|
||||
<desc>Determines the lower limit of an object. This corresponds to y position + DefCore OffsetY + DefCore Height. Object rotation is not taken into consideration.</desc>
|
||||
<desc>Determines the lower limit of an object. This corresponds to the bottom vertex on objects that have vertices and y position + DefCore OffsetY + DefCore Height for objects without vertices.</desc>
|
||||
<examples>
|
||||
<example>
|
||||
<code><funclink>Contents</funclink>()-><funclink>Exit</funclink>(0, GetDefBottom()-<funclink>GetY</funclink>());</code>
|
||||
|
|
|
@ -1504,8 +1504,16 @@ static long FnGetDefBottom(C4PropList * _this)
|
|||
if (!_this || !_this->GetDef())
|
||||
throw new NeedNonGlobalContext("GetDefBottom");
|
||||
|
||||
assert(!Object(_this) || Object(_this)->Def == _this->GetDef());
|
||||
return _this->GetDef()->Shape.y+_this->GetDef()->Shape.Hgt + (Object(_this) ? Object(_this)->GetY() : 0);
|
||||
C4Object *obj = Object(_this);
|
||||
C4Def *def = _this->GetDef();
|
||||
assert(!obj || obj->Def == def);
|
||||
|
||||
if (obj)
|
||||
return obj->GetY() + obj->Shape.GetBottom();
|
||||
else if (def)
|
||||
return def->Shape.GetBottom();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool FnSetMenuSize(C4Object *Obj, long iCols, long iRows)
|
||||
|
|
Loading…
Reference in New Issue