bool IBActionDef_UnblockProp::Init(IBAction* pAction) { BLObject* pObj = reinterpret_cast<BLObject*>(pAction->FindVariables("Obj")); ASSERT(pObj != NULL); IBVector2* pObjPos = reinterpret_cast<IBVector2*>(pAction->FindVariables("ObjPos")); ASSERT(pObjPos == NULL || pObjPos == &pObj->GetPos()); IBInt* pDist = reinterpret_cast<IBInt*>(pAction->FindVariables("Dist")); ASSERT(pDist == NULL); if (pObjPos == NULL) { pObjPos = (IBVector2*)&pObj->GetPos(); pObjPos->SetName(pObj->GetName() + "Pos"); pAction->SetVariable("ObjPos", pObjPos); } pDist = new IBInt("Dist = 1", 1); pAction->SetVariable("Dist", pDist); return true; }
void BLWorld::DrawDebugObj(const BLObject& oObj) const { if (!m_pBot->HasObject(dynamic_cast<BLProp*>((BLObject*)&oObj))) { int x1 = oObj.GetPos().x * GetGridSize(); int y1 = oObj.GetPos().y * GetGridSize(); m_oCanva.DrawRect(x1, y1, GetGridSize()-1, GetGridSize()-1, 0, 255, 255); m_oCanva.Print(x1+2, y1+1, m_oCanva.GetPrintFont(), 10, LeftTop, 0, 255, 255, "%s", oObj.GetName().c_str()); } }