Remove EditCursorSelection and EditCursorDeselection callbacks

They never worked properly in network mode because all users would see the changes.

EditorProps, EditorActions and shape delegates now provide the functionality to have custom object editing widgets.

This also fixes a bug with the selection callback causing the object list to act up.
directional-lights
Sven Eberhardt 2016-10-15 09:16:06 -04:00
parent 59b5525a41
commit 4b3f8c0fef
4 changed files with 1 additions and 52 deletions

View File

@ -347,16 +347,6 @@
<literal_col>OnCompletionChange</literal_col>
<col>int old_con, int new_con</col>
<col>Callback in when the completion of the object has changed (see <funclink>GetCon</funclink>, <funclink>DoCon</funclink> and <funclink>SetCon</funclink>).</col>
</row>
<row id="EditCursorSelection">
<literal_col>EditCursorSelection</literal_col>
<col></col>
<col>When object is selected in editor. Use this callback to display extra information for scenario designers.</col>
</row>
<row id="EditCursorDeselection">
<literal_col>EditCursorDeselection</literal_col>
<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>

View File

@ -1336,25 +1336,6 @@ void C4ControlEMMoveObject::Execute() const
pObj->Exit(pObj->GetX(), pObj->GetY(), pObj->GetR());
}
break;
case EMMO_Select:
{
// callback to script
C4Object *target = ::Objects.SafeObjectPointer(iTargetObj);
if (!target) return;
target->Call(PSF_EditCursorSelection);
}
break;
case EMMO_Deselect:
{
// callback to script
C4Object *target = ::Objects.SafeObjectPointer(iTargetObj), *next_selection = NULL;
if (!target) return;
// next selection may be passed to EditCursorSelection
if (iObjectNum) next_selection = ::Objects.SafeObjectPointer(pObjects[0]);
C4AulParSet pars(C4VObj(next_selection));
target->Call(PSF_EditCursorDeselection, &pars);
}
break;
case EMMO_Create:
{
// Check max object count

View File

@ -453,8 +453,6 @@ enum C4ControlEMObjectAction
EMMO_Script, // execute Script
EMMO_Remove, // remove objects
EMMO_Exit, // exit objects
EMMO_Select, // select object
EMMO_Deselect, // deselect object
EMMO_Create, // create a new object (used by C4Game::DropDef)
EMMO_Transform // adjust rotation / con of selected object
};

View File

@ -330,7 +330,6 @@ void C4EditCursor::AddToSelection(C4PropList *add_proplist)
if (selection.IsContained(add_proplist)) return;
// add object to selection and do script callback
selection.push_back(C4VPropList(add_proplist));
if (add_obj) ::Control.DoInput(CID_EMMoveObj, new C4ControlEMMoveObject(EMMO_Select, Fix0, Fix0, add_obj), CDT_Decide);
}
bool C4EditCursor::RemoveFromSelection(C4PropList *remove_proplist)
@ -341,31 +340,12 @@ bool C4EditCursor::RemoveFromSelection(C4PropList *remove_proplist)
// remove object from selection and do script callback
if (!selection.IsContained(remove_proplist)) return false;
selection.remove(C4VPropList(remove_proplist));
if (remove_obj) ::Control.DoInput(CID_EMMoveObj, new C4ControlEMMoveObject(EMMO_Deselect, Fix0, Fix0, remove_obj), CDT_Decide);
return true;
}
void C4EditCursor::ClearSelection(C4PropList *next_selection)
{
// remove all objects from selection and do script callbacks
// iterate safely because callback might delete selected objects!
C4Object *obj;
while ((obj = selection.GetObject(0)))
{
selection.remove(C4VObj(obj));
if (obj->Status)
{
int32_t next_selection_count = 0, *next_selection_nums = NULL;
if (next_selection && next_selection->GetObject() && next_selection->GetObject()->Status)
{
// Pass next selection. Always create new array becase the pointer is freed by C4ControlEMMoveObject dtor
++next_selection_count;
next_selection_nums = new int32_t[1];
*next_selection_nums = next_selection->GetObject()->Number;
}
::Control.DoInput(CID_EMMoveObj, new C4ControlEMMoveObject(EMMO_Deselect, Fix0, Fix0, obj, next_selection_count, next_selection_nums), CDT_Decide);
}
}
// remove everything from selection
selection.clear();
}