Add callback EditCursorMoved.

issue1247
Sven Eberhardt 2015-01-17 20:53:45 +01:00
parent c00d8c7a4d
commit cf9aca70fe
3 changed files with 13 additions and 2 deletions

View File

@ -343,6 +343,12 @@
<col>object next_selection</col>
<col>When object is deselected in editor. Use this callback to hide any information previously shown in EditCursorSelection. If deselection happens due to another object being selected, that object is passed in next_selection.</col>
</row>
<row id="EditCursorMoved">
<literal_col>EditCursorMoved</literal_col>
<col>int old_x, int old_y</col>
<col>When object is moved in editor. Callback is also done when moved in non-network pause mode. old_x, old_y contains object position before movement.</col>
</row>
<row id="SaveScenarioObject">
<literal_col>SaveScenarioObject</literal_col>
<col>proplist props</col>

View File

@ -1215,11 +1215,15 @@ void C4ControlEMMoveObject::Execute() const
// move all given objects
C4Object *pObj;
for (int i=0; i<iObjectNum; ++i)
if ((pObj = ::Objects.SafeObjectPointer(pObjects[i]))) if (pObj->Status)
if ((pObj = ::Objects.SafeObjectPointer(pObjects[i])))
if (pObj->Status)
{
int32_t old_x = pObj->GetX(), old_y = pObj->GetY();
pObj->ForcePosition(pObj->fix_x+tx,pObj->fix_y+ty);
pObj->xdir=pObj->ydir=0;
pObj->Mobile = false;
C4AulParSet pars(C4VInt(old_x), C4VInt(old_y));
pObj->Call(PSF_EditCursorMoved, &pars);
}
}
break;

View File

@ -109,7 +109,8 @@ bool C4ValueToMatrix(const C4ValueArray& array, StdMeshMatrix* matrix);
#define PSF_OnRemoveCrew "~DeRecruitment" // int Player
#define PSF_OnInIncendiaryMaterial "OnInIncendiaryMaterial"
#define PSF_EditCursorSelection "~EditCursorSelection"
#define PSF_EditCursorDeselection "~EditCursorDeselection"
#define PSF_EditCursorDeselection "~EditCursorDeselection" // new_selection
#define PSF_EditCursorMoved "~EditCursorMoved" // int old_x, int old_y
#define PSF_DigOutObject "~DigOutObject" // C4Object *obj
#define PSF_OnDugOut "~DugOut" //C4Object *by_obj
#define PSF_SaveScenarioObjects "~SaveScenarioObjects" // int file_handle