Пример #1
0
static int ReadColors(CurPos &cp, const char *ObjName) {
    unsigned char obj;
    unsigned short len;

    while ((obj = GetObj(cp, len)) != 0xFF) {
        switch (obj) {
        case CF_STRING:
            {
                char cl[30];
                const char *sname = GetCharStr(cp, len);
                const char *svalue;
                if (sname == 0) return -1;
                if ((obj = GetObj(cp, len)) != CF_STRING) return -1;
                if ((svalue = GetCharStr(cp, len)) == 0) return -1;
                strcpy(cl, ObjName);
                strcat(cl, ".");
                strcat(cl, sname);
                if (SetColor(cl, svalue) == 0) return -1;
            }
            break;
        case CF_END:
            return 0;
        default:
            return -1;
        }
    }
    return -1;
}
Пример #2
0
void CSpaceObjectList::Subtract (const CSpaceObjectList &List)

//	Subtract
//
//	Removes all objects in List from the current list

	{
	int i;

	//	Mark all current objects

	int iCount = GetCount();
	for (i = 0; i < iCount; i++)
		GetObj(i)->SetMarked(true);

	//	Clear marks on all objects to remove

	for (i = 0; i < List.GetCount(); i++)
		List.GetObj(i)->SetMarked(false);

	//	Create a new list with the remaining objects

	TArray<CSpaceObject *> NewList;
	for (i = 0; i < iCount; i++)
		if (GetObj(i)->IsMarked())
			NewList.Insert(GetObj(i));

	m_List.TakeHandoff(NewList);
	}
Пример #3
0
static int ReadHilitColors(CurPos &cp, EColorize *Colorize, const char * /*ObjName*/) {
    unsigned char obj;
    unsigned short len;

    while ((obj = GetObj(cp, len)) != 0xFF) {
        switch (obj) {
        case CF_INT:
            {
                long cidx;
                const char *svalue;

                if (GetNum(cp, cidx) == 0) return -1;
                if ((obj = GetObj(cp, len)) != CF_STRING)
                    return -1;
                if ((svalue = GetCharStr(cp, len)) == 0)
                    return -1;
                if (Colorize->SetColor(cidx, svalue) == 0)
                    return -1;
            }
            break;
        case CF_END:
            return 0;
        default:
            return -1;
        }
    }
    return -1;
}
Пример #4
0
void CGameManager::start()
{
	__super::start();

	fileMng_.Load();

	if (!GetObj(typeid(CStageMng)))
	{
		auto sm = std::shared_ptr<CStageMng>(new CStageMng());
		AddObject2(sm);
		TempCharacter t(sm);
		sm->load();
#ifdef DEF_GM_PTR
		//SetStageMngPtr(sm);
#endif
	}

	if (!GetObj(typeid(CScoreMng)))
	{
		auto sm = std::shared_ptr<CScoreMng>(new CScoreMng());
		AddObject2(sm);
#ifdef DEF_GM_PTR
		SetScoreMngPtr(sm);
#endif
	}

	if (!GetObj(typeid(CCollision)))
		AddObject2(ObjPtr(new CCollision()));

}
Пример #5
0
void CGenerator::fill(int from , int to , int id = 1 )
{
	for(int z = from ; z < to ; z++)
		for(int i = 0 ; i < X ; i++)
			for(int j = 0 ; j < Y ; j++)
				if(GetObj(glm::ivec3(i,j,z)) != 1)
					GetObj(glm::ivec3(i,j,z)) = id;
}
Пример #6
0
static int ReadMenu(CurPos &cp, const char *MenuName) {
    unsigned char obj;
    unsigned short len;

    int menu = -1, item = -1;

    menu = NewMenu(MenuName);

    while ((obj = GetObj(cp, len)) != 0xFF) {
        switch (obj) {
        case CF_ITEM:
            {
                if (len == 0) {
                    item = NewItem(menu, 0);
                } else {
                    const char *s = GetCharStr(cp, len);
                    int Cmd;
                    if (s == 0) return -1;
                    item = NewItem(menu, s);
                    if ((obj = GetObj(cp, len)) != CF_MENUSUB) return -1;
                    if ((Cmd = ReadCommands(cp, 0)) == -1) return -1;
                    Menus[menu].Items[item].Cmd = Cmd + 65536;
                }
            }
            break;
        case CF_SUBMENU:
            {
                const char *s = GetCharStr(cp, len);
                const char *w;

                if ((obj = GetObj(cp, len)) != CF_STRING) return -1;
                if ((w = GetCharStr(cp, len)) == 0) return -1;
                item = NewSubMenu(menu, s, GetMenuId(w), SUBMENU_NORMAL);
            }
            break;

        case CF_SUBMENUCOND:
            {
                const char *s = GetCharStr(cp, len);
                const char *w;

                if ((obj = GetObj(cp, len)) != CF_STRING) return -1;
                if ((w = GetCharStr(cp, len)) == 0) return -1;
                item = NewSubMenu(menu, s, GetMenuId(w), SUBMENU_CONDITIONAL);
            }
            break;

        case CF_END:
            return 0;
        default:
            return -1;
        }
    }
    return -1;
}
Пример #7
0
void ledLightingDevice::OnChange()
{
	cout << "New Value: " << m_cur_value << endl;

	/* Update the D-Bus LightingObject */
	GetObj()->m_cur_status = m_cur_value.c_str();

	/* Notify status change */
	lighting_object_emitSignal(GetObj(), E_LIGHTING_OBJECT_SIGNAL_CHANGED_STATUS, "DeviceName=lighting1&Command=get_status");

	//DEV_AGENT->EmitSignalDeviceUpdate("DeviceName=lighting1&Command=get_status");
}
void TemperatureDevice::OnChange()
{
	cout << "New Value: " << m_cur_value << endl;

	/* Update the D-Bus TemperatureObject */
	GetObj()->m_cur_status = m_cur_value.c_str();

	/* Notify status change */
	temperature_object_emitSignal(GetObj(), E_TEMPERATURE_OBJECT_SIGNAL_CHANGED_STATUS, "DeviceName=temperature1&Command=get_status");

	//DEV_AGENT->EmitSignalDeviceUpdate("DeviceName=temperature1&Command=get_status");
}
Пример #9
0
//****************************
void CObjInfo::OnCloseObj()
{
	if(GetTree())
	{
		GetTree()->RemoveFromList(GetObj(),GetObjName());
		SetTree(0);
	}
	else
	{
		if(bDeleteObj&&GetObj())
		{
			delete 	GetObj();
			SetObj(0);
		}
	}
};
Пример #10
0
SharedTrackablePtr
ObjRsrc::AllocObj(Trackable::ObjType type, string lookupName)
{
    if (lookupName.length() == 0) {
        LOG_DBG("Parameter lookupName has no value");
        return Trackable::NullTrackablePtr;
    }

    SharedTrackablePtr newObj = AllocWorker(type);
    if (newObj == Trackable::NullTrackablePtr) {
        LOG_DBG("System unable to create object from heap");
        return Trackable::NullTrackablePtr;
    }

    // Store this allocated object in a more permanent container
    pair<TrackableMap::iterator, bool> result;
    result = mObjGrpLife.insert(TrackablePair(lookupName, newObj));
    if (result.second == false) {
        LOG_DBG("Created object with collisions in lookupName: %s",
            lookupName.c_str());
        return Trackable::NullTrackablePtr;
    }

    return GetObj(lookupName);
}
Пример #11
0
	bool CDuiTimer::SetDuiTimer()
	{
		if((GetObj() && GetFun()) || GetHwnd())
			return InnerSetTimer();

		return false;
	}
Пример #12
0
void CDlgView::WriteCoinfig(const string& strFilePath)
{
    Json::Value root;
    Json::Value arraycomm;
    Json::Value arraygame;
    Json::Value arraylager;
    Json::Value item;
    map<string ,ADD_APP_DATA>::const_iterator it = m_commapp_list.begin();
    for (; it!= m_commapp_list.end(); it++)
    {
        GetObj(it->second,item);
        root["commapp"].append(item);
    }

    it = m_gameapp_list.begin();
    for (; it!= m_gameapp_list.end(); it++)
    {
        GetObj(it->second,item);
        root["lagerapp"].append(item);
    }

    it = m_Largeapp_list.begin();
    for (; it!= m_Largeapp_list.end(); it++)
    {
        GetObj(it->second,item);
        root["lagerapp"].append(item);
    }

    ofstream outfile(strFilePath);
    if (!outfile.is_open())
    {
        return;
    }
    string strfile = root.toStyledString();
    outfile<<strfile;
    outfile.close();
    //CStdioFile  File;
    //if (File.Open((LPCTSTR)(LPSTR)strFilePath.c_str(),CFile::modeWrite | CFile::modeCreate))
    //{
    //	string strfile = root.toStyledString();
    //	File.WriteString(strfile.c_str());
    //	File.Close();
    //}
    //

}
Пример #13
0
void XFileTransferProxy::Reset(void)
{
    XFileTransfer *pFileTransfer;

    pFileTransfer = (XFileTransfer *) GetObj();

    if ( pFileTransfer )
        pFileTransfer->Reset();
}
Пример #14
0
void XFileTransferProxy::StopRX(void)
{
    XFileTransfer *pFileTransfer;

    pFileTransfer = (XFileTransfer *) GetObj();

    if ( pFileTransfer )
        pFileTransfer->StopRX();
}
Пример #15
0
void XFileTransferProxy::RunTX(void)
{
    XFileTransfer *pFileTransfer;

    pFileTransfer = (XFileTransfer *) GetObj();

    if ( pFileTransfer )
        pFileTransfer->RunTX();
}
Пример #16
0
void XFileTransferProxy::SetSndSeq( ULONG _seq )
{
    XFileTransfer *pFileTransfer;

    pFileTransfer = (XFileTransfer *) GetObj();

    if ( pFileTransfer )
        pFileTransfer->SetSndSeq( _seq );
}
Пример #17
0
void XFileTransferProxy::NotifyEOF( void )
{
    XFileTransfer *pFileTransfer;

    pFileTransfer = (XFileTransfer *) GetObj();

    if ( pFileTransfer )
        pFileTransfer->NotifyEOF();
}
Пример #18
0
void XFileTransferProxy::PktRequest( ULONG _seqi, ULONG _seqf )
{
    XFileTransfer *pFileTransfer;

    pFileTransfer = (XFileTransfer *) GetObj();

    if ( pFileTransfer )
        pFileTransfer->PktRequest( _seqi, _seqf );
}
Пример #19
0
void CGenerator::carve(glm::ivec3 vec , int r , int id)
{
	for(int x = vec.x-r-1 ; x < vec.x+r+1 ; x++)
		for(int y = vec.y-r-1 ; y < vec.y+r+1 ; y++)
			for(int z = vec.z-r-1 ; z < vec.z+r+1 ; z++)
			{
				if(pow(x-vec.x,2)+pow(y-vec.y,2)+pow(z-vec.z,2) <= pow(r,2))
					GetObj(glm::ivec3(x,y,z)) = id;
			}
}
Пример #20
0
bool CGenerator::surrounded(glm::ivec3 vec)
{
	if(vec.z == -1)
		return true;
	bool is = true;
		for(int k = -1 ; k < 2 ; k++)
			for(int l = -1 ; l < 2 ; l++)
				if( GetObj(glm::ivec3(vec.x+k,vec.y+l,vec.z)) != 1 )
					is = false;
	return is;
}
Пример #21
0
BOOL CMyHelpDoc::SaveModified() 
{
//	return CRichEditDoc::SaveModified();
	if(GetTree())//это режим в составе конфигурации
	{
		if(!GetObj()->bCanSave)
			return TRUE;

		CRichEditDoc::SetModifiedFlag(0);
		CString Str;
		((CMyHelpView*)GetView())->GetText(Str);
		GetObj()->csFile=Str;
		return TRUE;
	}
	else//это самостоятельный документ
	{
		return CRichEditDoc::SaveModified();
	}
	return TRUE;
}
Пример #22
0
bool CUserMgr::_HandlePacket_UserHeart(Packet* pack)
{
    if (!pack)
	return false;

    /*Message::UserHeartRequest msg;
      PROTOBUF_CMD_PARSER( pack, msg );*/

    SendHeartResponse(GetObj(pack->GetNetID()));

    return true;
}
Пример #23
0
void XFileTransferProxy::Destroy( void )
{
    XFileTransfer *pFileTransfer;

    pFileTransfer = (XFileTransfer *) GetObj();

    if ( pFileTransfer )
    {
        delete pFileTransfer;
        ResetObj();
    }
}
//界面设置解除分派时,将该维护参数设置下的所有订单全解除分派
void YKBizMapCreateMTOrderParam::GetAllOrders(YKOrderSet& orderSet,YKOrderSet& rOrderSet)
{
	YKCreateMTOrderParamVec mtoVec = GetValue()->GetObjContainer();
	for (YK_ID id : mtoVec)
	{
		YKCreateMTOrderParamExtern ptr = GetObj(id);
		if(ptr.ValidObj())
		{
			ptr.GetAllOrders(orderSet,rOrderSet);		
		}
	}
}
Пример #25
0
void CGenerator::print()
{
	fstream swiat("swiat.txt",ios::out);
	for(int i = 0 ; i < X ; i++)
	{
		for(int j = 0 ; j < Y ; j++)
		{
			if(GetObj(glm::ivec3(i,j,0)) == 1)
			{
				int hight = 0;
				for(int k = 0 ; k < Z ; k++)
					if(GetObj(glm::ivec3(i,j,k)) == 1)
						hight++;
				swiat << hight%10;
			}
			else
				swiat << ".";
		}
		swiat << endl;
	}
}
Пример #26
0
static int ReadMode(CurPos &cp, EMode *Mode, const char * /*ModeName*/) {
    unsigned char obj;
    unsigned short len;

    while ((obj = GetObj(cp, len)) != 0xFF) {
        switch (obj) {
        case CF_SETVAR:
            {
                long what;

                if (GetNum(cp, what) == 0) return -1;
                switch (GetObj(cp, len)) {
                case CF_STRING:
                    {
                        const char *val = GetCharStr(cp, len);
                        if (len == 0) return -1;
                        if (SetModeString(Mode, what, val) != 0) return -1;
                    }
                    break;
                case CF_INT:
                    {
                        long num;

                        if (GetNum(cp, num) == 0) return -1;
                        if (SetModeNumber(Mode, what, num) != 0) return -1;
                    }
                    break;
                default:
                    return -1;
                }
            }
            break;
        case CF_END:
            return 0;
        default:
            return -1;
        }
    }
    return -1;
}
void groveTemperatureSensorDevice::OnChange()
{
	cout << "grove Temperature Sensor value changed to " << m_cur_value << endl;

	/* Update the D-Bus TemperatureObject */
	GetObj()->m_cur_status = m_cur_value.c_str();

	/* Notify status change */
	// TODO: Temperature Sensor is a Time-driven device so no need for signal handler support
	//temperature_object_emitSignal(GetObj(), E_TEMPERATURE_OBJECT_SIGNAL_CHANGED_STATUS, "DeviceName=temperature1&Command=get_status");

	//DEV_AGENT->EmitSignalDeviceUpdate("DeviceName=temperature1&Command=get_status");
}
Пример #28
0
USHORT XFileTransferProxy::GetSndDataLen( void )
{
    USHORT ret;
    XFileTransfer *pFileTransfer;

    ret = 0;

    pFileTransfer = (XFileTransfer *) GetObj();

    if ( pFileTransfer )
        ret = pFileTransfer->GetSndDataLen();

    return ret;
}
Пример #29
0
bool XFileTransferProxy::BeginReceive(UINT32 _nId, NCT_IRM_NET_TYPE _type, LPCSTR _szHost, UINT16 _nPort, LPCSTR _szUser, LPCSTR _szChannel, LPCSTR _szFilePath, UINT _uFileSize, USHORT _uPktDataLen, BOOL _flPtP, BOOL _flListen )
{
    bool ret;
    XFileTransfer *pFileTransfer;

    ret = false;

    pFileTransfer = (XFileTransfer *) GetObj();

    if ( pFileTransfer && pFileTransfer->BeginReceive(_nId, _type, _szHost, _nPort, _szUser, _szChannel, _szFilePath, _uFileSize, _uPktDataLen, _flPtP, _flListen) )
        ret = true;

    return ret;
}
Пример #30
0
bool CUserMgr::_HandlePacket_UserLogout(Packet* pack)
{
	if( !pack )
		return false;

	Message::UserLogout msg;
	PROTOBUF_CMD_PARSER( pack, msg );

	CUser* user = GetObj( pack->GetNetID() );
	if( user )
		Exit( user );

	return true;
}