forked from Mirrors/openclonk
fixed clonk contextmenu (still used SetCommand(this...))
parent
3bafed6225
commit
3dcf5002ee
|
@ -51,9 +51,9 @@ protected func Recruitment(int iPlr) {
|
|||
/* Kontext */
|
||||
|
||||
public func HasConstructMenu() { return HasKnowledge() && GetPhysical("CanConstruct"); }
|
||||
public func HasKnowledge() { return GetPlrKnowledge(GetOwner(),0,0,C4D_Structure); }
|
||||
public func HasKnowledge() { return GetPlrKnowledge(GetOwner(),nil,0,C4D_Structure); }
|
||||
public func HasBase() { return FindBase(GetOwner()) && Contained()->GetBase() != GetOwner(); }
|
||||
public func ReleaseAllowed() { return ObjectCount(REAC); }
|
||||
public func ReleaseAllowed() { return ObjectCount(Find_ID(REAC)); }
|
||||
public func AtConstructionSite() { return !Contained() && FindConstructionSite() && ObjectCount(CNMT); }
|
||||
public func AtEnergySite() { return !Contained() && FindEnergySite(); }
|
||||
public func AtTreeToChop() { return !Contained() && FindTree() && GetPhysical("CanChop"); }
|
||||
|
@ -608,7 +608,7 @@ public func ContextEnergy(pCaller)
|
|||
[$TxtEnergysupply$|Image=CXEC|Condition=AtEnergySite]
|
||||
var pSite;
|
||||
if (pSite = FindEnergySite())
|
||||
SetCommand(this, "Energy", pSite);
|
||||
SetCommand("Energy", pSite);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -626,14 +626,14 @@ public func ContextChop(pCaller)
|
|||
[$CtxChop$|Image=CXCP|Condition=AtTreeToChop]
|
||||
var pTree;
|
||||
if (pTree = FindTree())
|
||||
SetCommand(this, "Chop", pTree);
|
||||
SetCommand("Chop", pTree);
|
||||
return 1;
|
||||
}
|
||||
|
||||
public func ContextConstruction(pCaller)
|
||||
{
|
||||
[$CtxConstructionDesc$|Image=CXCN|Condition=HasConstructMenu]
|
||||
SetCommand(this, "Construct");
|
||||
SetCommand("Construct");
|
||||
ExecuteCommand();
|
||||
return 1;
|
||||
}
|
||||
|
@ -641,7 +641,7 @@ public func ContextConstruction(pCaller)
|
|||
public func ContextHome(pCaller)
|
||||
{
|
||||
[$CtxHomeDesc$|Image=CXHM|Condition=HasBase]
|
||||
SetCommand(this, "Home");
|
||||
SetCommand("Home");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -650,7 +650,7 @@ public func ContextHome(pCaller)
|
|||
public func ContainedCall(string strFunction, object pTarget)
|
||||
{
|
||||
// Erst das betreffende Geb<65>ude betreten, dann die Zielfunktion aufrufen
|
||||
SetCommand(this, "Call", pTarget, this, 0, 0, strFunction);
|
||||
SetCommand("Call", pTarget, this, 0, nil, strFunction);
|
||||
AddCommand(this, "Enter", pTarget);
|
||||
}
|
||||
|
||||
|
@ -663,23 +663,23 @@ protected func ControlSpecial2()
|
|||
if (Contained())
|
||||
if ((Contained()->GetCategory() & C4D_Structure) || (Contained()->GetCategory() & C4D_Vehicle))
|
||||
{
|
||||
SetCommand(this,"Context",0,0,0,Contained());
|
||||
SetCommand("Context",nil,0,0,Contained());
|
||||
return ExecuteCommand();
|
||||
}
|
||||
// Fasst ein Objekt an: Kontextmen<65> des angefassten Objekts <20>ffnen
|
||||
if (GetAction() == "Push")
|
||||
{
|
||||
SetCommand(this,"Context",0,0,0,GetActionTarget());
|
||||
SetCommand("Context",nil,0,0,GetActionTarget());
|
||||
return ExecuteCommand();
|
||||
}
|
||||
// Tr<54>gt ein Objekt: Kontextmen<65> des ersten getragenen Objekts <20>ffnen
|
||||
if (Contents(0))
|
||||
{
|
||||
SetCommand(this,"Context",0,0,0,Contents(0));
|
||||
SetCommand("Context",nil,0,0,Contents(0));
|
||||
return ExecuteCommand();
|
||||
}
|
||||
// Ansonsten das Kontextmen<65> des Clonks <20>ffnen
|
||||
SetCommand(this,"Context",0,0,0,this);
|
||||
SetCommand("Context",nil,0,0,this);
|
||||
return ExecuteCommand();
|
||||
}
|
||||
|
||||
|
|
|
@ -1966,7 +1966,7 @@ bool C4Object::ActivateMenu(int32_t iMenu, int32_t iMenuSelect,
|
|||
// Picture
|
||||
fctSymbol.Set(pDef->Graphics.GetBitmap(),pDef->PictureRect.x,pDef->PictureRect.y,pDef->PictureRect.Wdt,pDef->PictureRect.Hgt);
|
||||
// Command
|
||||
sprintf(szCommand,"SetCommand(this,\"Construct\",0,0,0,0,%s)",C4IdText(pDef->id));
|
||||
sprintf(szCommand,"SetCommand(\"Construct\",nil,0,0,nil,%s)",C4IdText(pDef->id));
|
||||
// Add menu item
|
||||
Menu->AddRefSym(szCaption,fctSymbol,szCommand,C4MN_Item_NoCount,NULL,pDef->GetDesc(),pDef->id);
|
||||
}
|
||||
|
|
|
@ -175,8 +175,8 @@ bool C4ObjectMenu::DoRefillInternal(bool &rfRefilled)
|
|||
fctSymbol.Set(fctSymbol.Surface, 0,0,C4SymbolSize,C4SymbolSize);
|
||||
pObj->Picture2Facet(fctSymbol);
|
||||
// Commands
|
||||
sprintf(szCommand,"SetCommand(this,\"Activate\",Object(%d))&&ExecuteCommand()",pObj->Number);
|
||||
sprintf(szCommand2,"SetCommand(this,\"Activate\",0,%d,0,Object(%d),%s)&&ExecuteCommand()",pTarget->Contents.ObjectCount(pDef->id),pTarget->Number,C4IdText(pDef->id));
|
||||
sprintf(szCommand,"SetCommand(\"Activate\",Object(%d))&&ExecuteCommand()",pObj->Number);
|
||||
sprintf(szCommand2,"SetCommand(\"Activate\",nil,%d,0,Object(%d),%s)&&ExecuteCommand()",pTarget->Contents.ObjectCount(pDef->id),pTarget->Number,C4IdText(pDef->id));
|
||||
// Add menu item
|
||||
Add(szCaption,fctSymbol,szCommand,iCount,pObj,pDef->GetDesc(),pDef->id,szCommand2,true,pObj->GetValue(pTarget, NO_OWNER));
|
||||
// facet taken over (arrg!)
|
||||
|
@ -292,11 +292,11 @@ bool C4ObjectMenu::DoRefillInternal(bool &rfRefilled)
|
|||
fctSymbol.Set(fctSymbol.Surface, 0, 0, C4SymbolSize, C4SymbolSize);
|
||||
pObj->Picture2Facet(fctSymbol);
|
||||
// Primary command: get/activate single object
|
||||
sprintf(szCommand, "SetCommand(this, \"%s\", Object(%d)) && ExecuteCommand()", fGet ? "Get" : "Activate", pObj->Number);
|
||||
sprintf(szCommand, "SetCommand(\"%s\", Object(%d)) && ExecuteCommand()", fGet ? "Get" : "Activate", pObj->Number);
|
||||
// Secondary command: get/activate all objects of the chosen type
|
||||
szCommand2[0] = 0; int32_t iAllCount;
|
||||
if ((iAllCount = pTarget->Contents.ObjectCount(pDef->id)) > 1)
|
||||
sprintf(szCommand2, "SetCommand(this, \"%s\", 0, %d,0, Object(%d), %s) && ExecuteCommand()", fGet ? "Get" : "Activate", iAllCount, pTarget->Number, C4IdText(pDef->id));
|
||||
sprintf(szCommand2, "SetCommand(\"%s\", nil, %d,0, Object(%d), %s) && ExecuteCommand()", fGet ? "Get" : "Activate", iAllCount, pTarget->Number, C4IdText(pDef->id));
|
||||
// Add menu item (with object)
|
||||
Add(szCaption, fctSymbol, szCommand, iCount, pObj, pDef->GetDesc(), pDef->id, szCommand2);
|
||||
fctSymbol.Default();
|
||||
|
@ -347,7 +347,7 @@ bool C4ObjectMenu::DoRefillInternal(bool &rfRefilled)
|
|||
// ...or if the container is owned by us or a friendly player - this is for remote mouse-button-clicks
|
||||
|| (ValidPlr(pTarget->Owner) && !Hostile(pTarget->Owner,Object->Owner)))
|
||||
{
|
||||
sprintf(szCommand,"SetCommand(this,\"Get\",Object(%d),0,0,0,2)&&ExecuteCommand()",pTarget->Number);
|
||||
sprintf(szCommand,"SetCommand(\"Get\",Object(%d),0,0,nil,2)&&ExecuteCommand()",pTarget->Number);
|
||||
fctSymbol.Create(C4SymbolSize,C4SymbolSize); pTarget->DrawPicture(fctSymbol);
|
||||
Add(LoadResStr("IDS_CON_CONTENTS"),fctSymbol,szCommand);
|
||||
fctSymbol.Default();
|
||||
|
@ -360,7 +360,7 @@ bool C4ObjectMenu::DoRefillInternal(bool &rfRefilled)
|
|||
// Buy
|
||||
if (Game.C4S.Game.Realism.BaseFunctionality & BASEFUNC_Buy)
|
||||
{
|
||||
sprintf(szCommand,"SetCommand(this,\"Buy\",Object(%d))&&ExecuteCommand()",pTarget->Number);
|
||||
sprintf(szCommand,"SetCommand(\"Buy\",Object(%d))&&ExecuteCommand()",pTarget->Number);
|
||||
fctSymbol.Create(C4SymbolSize,C4SymbolSize); DrawMenuSymbol(C4MN_Buy,fctSymbol,pTarget->Base,pTarget);
|
||||
Add(LoadResStr("IDS_CON_BUY"),fctSymbol,szCommand);
|
||||
fctSymbol.Default();
|
||||
|
@ -368,7 +368,7 @@ bool C4ObjectMenu::DoRefillInternal(bool &rfRefilled)
|
|||
// Sell
|
||||
if (Game.C4S.Game.Realism.BaseFunctionality & BASEFUNC_Sell)
|
||||
{
|
||||
sprintf(szCommand,"SetCommand(this,\"Sell\",Object(%d))&&ExecuteCommand()",pTarget->Number);
|
||||
sprintf(szCommand,"SetCommand(\"Sell\",Object(%d))&&ExecuteCommand()",pTarget->Number);
|
||||
fctSymbol.Create(C4SymbolSize,C4SymbolSize); DrawMenuSymbol(C4MN_Sell,fctSymbol,pTarget->Base,pTarget);
|
||||
Add(LoadResStr("IDS_CON_SELL"),fctSymbol,szCommand);
|
||||
fctSymbol.Default();
|
||||
|
@ -652,7 +652,7 @@ int32_t C4ObjectMenu::AddContextFunctions(C4Object *pTarget, bool fCountOnly)
|
|||
else
|
||||
if (!fCountOnly)
|
||||
{
|
||||
sprintf(szCommand, "SetCommand(this,\"Context\",0,0,0,this)&&ExecuteCommand()");
|
||||
sprintf(szCommand, "SetCommand(\"Context\",nil,0,0,this)&&ExecuteCommand()");
|
||||
fctSymbol.Create(16,16); Object->Def->Draw(fctSymbol, false, Object->Color);
|
||||
Add(Object->Def->GetName(), fctSymbol, szCommand, C4MN_Item_NoCount, NULL, LoadResStr("IDS_MENU_CONTEXTSUBCLONKDESC"));
|
||||
fctSymbol.Default();
|
||||
|
|
Loading…
Reference in New Issue