Tile CMapTile::GetTile(CVector Pos, CMap* pMap)
{
	PtrList<CEntity*> EntityList = pMap->GetTileEntityList(Pos);
	if(!EntityList.empty()) {
		if(ContainsPlayer(EntityList))
			return pMap->GetPlayer()->GetTile(pMap);
		else if(ContainsMobs(EntityList)) {
			PtrList<CEntity*> MobList = FilterMobEntities(EntityList);
			return MobList[0]->GetTile(pMap);
		} else
			return EntityList[0]->GetTile(pMap);
	}
	else return FloorTile;
}
void CMapTile::OnExamine(CVector Pos, CMap* pMap, CEntity* pActor)
{
	PtrList<CEntity*> EntityList = pMap->GetTileEntityList(Pos);
	if(!EntityList.empty()) {
		ExamineEntitieList(EntityList);
		return;
	}

	if(this == EmptyTile) {
		gMessages.AddMessage("Du schaust in die Weiten des Weltraums WTF!");
		return;
	}
	if(!Flags.Is_Set(MTF_PASSABLE))
		gMessages.AddMessage("Du schaust auf ein Stueck feste Wand");
	else gMessages.AddMessage("Du kannst dich hier hinbewegen");
}
Example #3
0
static void writeMsgTxt(CStdioFile &file, QID *qid)
{
	CString tmp, nick, str;
	tmp.LoadString(IDS_MSG_OBJ);

	if (qid) {
		IcqContact *c = icqLink->findContact(*qid);
		if (c)
			nick = c->nick.c_str();
		else
			nick = qid->toString();

		str.Format("%s:%s(%s)\n", (LPCTSTR) tmp, qid->toString(), (LPCTSTR) nick);
	} else {
		str.LoadString(IDS_SYSMSG);
		str = tmp + ":" + str + '\n';
	}

	file.WriteString("--------------------------------------------------\n");
	file.WriteString(str);
	file.WriteString("--------------------------------------------------\n");

	PtrList msgList;
	IcqDB::loadMsg(qid, msgList);
	while (!msgList.empty()) {
		IcqMsg *msg = (IcqMsg *) msgList.front();
		msgList.pop_front();

		if (!qid)
			nick = msg->qid.toString();
		exportMsgTxt(file, msg, nick);
		delete msg;
	}

	file.WriteString("\n");
}
Foam::searchableSurfaceControl::searchableSurfaceControl
(
    const Time& runTime,
    const word& name,
    const dictionary& controlFunctionDict,
    const conformationSurfaces& geometryToConformTo,
    const scalar& defaultCellSize
)
:
    cellSizeAndAlignmentControl
    (
        runTime,
        name,
        controlFunctionDict,
        geometryToConformTo,
        defaultCellSize
    ),
    surfaceName_(controlFunctionDict.lookupOrDefault<word>("surface", name)),
    searchableSurface_(geometryToConformTo.geometry()[surfaceName_]),
    geometryToConformTo_(geometryToConformTo),
    cellSizeFunctions_(1),
    regionToCellSizeFunctions_(searchableSurface_.regions().size(), -1),
    maxPriority_(-1)
{
    Info<< indent << "Master settings:" << endl;
    Info<< incrIndent;

    cellSizeFunctions_.set
    (
        0,
        cellSizeFunction::New
        (
            controlFunctionDict,
            searchableSurface_,
            defaultCellSize_,
            labelList()
        )
    );

    Info<< decrIndent;

    PtrList<cellSizeFunction> regionCellSizeFunctions;

    DynamicList<label> defaultCellSizeRegions;

    label nRegionCellSizeFunctions = 0;

    // Loop over regions - if any entry is not specified they should
    // inherit values from the parent surface.
    if (controlFunctionDict.found("regions"))
    {
        const dictionary& regionsDict = controlFunctionDict.subDict("regions");
        const wordList& regionNames = searchableSurface_.regions();

        label nRegions = regionsDict.size();

        regionCellSizeFunctions.setSize(nRegions);
        defaultCellSizeRegions.setCapacity(nRegions);

        forAll(regionNames, regionI)
        {
            const word& regionName = regionNames[regionI];

            label regionID = geometryToConformTo_.geometry().findSurfaceRegionID
            (
                this->name(),
                regionName
            );

            if (regionsDict.found(regionName))
            {
                // Get the dictionary for region
                const dictionary& regionDict = regionsDict.subDict(regionName);

                Info<< indent << "Region " << regionName
                    << " (ID = " << regionID << ")" << " settings:"
                    << endl;
                Info<< incrIndent;

                regionCellSizeFunctions.set
                (
                    nRegionCellSizeFunctions,
                    cellSizeFunction::New
                    (
                        regionDict,
                        searchableSurface_,
                        defaultCellSize_,
                        labelList(1, regionID)
                    )
                );
                Info<< decrIndent;

                regionToCellSizeFunctions_[regionID] = nRegionCellSizeFunctions;

                nRegionCellSizeFunctions++;
            }
            else
            {
                // Add to default list
                defaultCellSizeRegions.append(regionID);
            }
        }
    }

    if (defaultCellSizeRegions.empty() && !regionCellSizeFunctions.empty())
    {
        cellSizeFunctions_.transfer(regionCellSizeFunctions);
    }
    else if (nRegionCellSizeFunctions > 0)
    {
        regionCellSizeFunctions.setSize(nRegionCellSizeFunctions + 1);

        regionCellSizeFunctions.set
        (
            nRegionCellSizeFunctions,
            cellSizeFunction::New
            (
                controlFunctionDict,
                searchableSurface_,
                defaultCellSize_,
                labelList()
            )
        );

        const wordList& regionNames = searchableSurface_.regions();

        forAll(regionNames, regionI)
        {
            if (regionToCellSizeFunctions_[regionI] == -1)
            {
                regionToCellSizeFunctions_[regionI] = nRegionCellSizeFunctions;
            }
        }

        cellSizeFunctions_.transfer(regionCellSizeFunctions);
    }