bool NFCTileModule::RemoveTile(const NFGUID & self, const int nX, const int nY) { NF_SHARE_PTR<TileData> xTileData = mxTileData.GetElement(self); if (!xTileData) { return false; } NF_SHARE_PTR<NFMapEx<int, TileState>> xStateDataMap = xTileData->mxTileState.GetElement(nX); if (!xStateDataMap) { return false; } if (xStateDataMap->ExistElement(nY)) { xStateDataMap->RemoveElement(nY); //save SaveTileData(self); return true; } return false; }
bool NFCScheduleModule::ExistSchedule(const NFGUID self, const std::string& strScheduleName) { NF_SHARE_PTR< NFMapEx <std::string, NFCScheduleElement >> xObjectScheduleMap = mObjectScheduleMap.GetElement(self); if (NULL == xObjectScheduleMap) { return false; } return xObjectScheduleMap->ExistElement(strScheduleName); }
bool NFCCreateRoleModule::ConvertPBToPropertyManager(const NFMsg::ObjectPropertyList& pPropertyData, NF_SHARE_PTR<NFIPropertyManager> pProps) { if (pProps) { for (int i = 0; i < pPropertyData.property_int_list_size(); ++i) { const NFMsg::PropertyInt& xData = pPropertyData.property_int_list(i); if (pProps->ExistElement(xData.property_name())) { pProps->AddProperty(pProps->Self(), xData.property_name(), NFDATA_TYPE::TDATA_INT); } pProps->SetPropertyInt(xData.property_name(), xData.data()); } for (int i = 0; i < pPropertyData.property_float_list_size(); ++i) { const NFMsg::PropertyFloat& xData = pPropertyData.property_float_list(i); if (pProps->ExistElement(xData.property_name())) { pProps->AddProperty(pProps->Self(), xData.property_name(), NFDATA_TYPE::TDATA_FLOAT); } pProps->SetPropertyFloat(xData.property_name(), xData.data()); } for (int i = 0; i < pPropertyData.property_string_list_size(); ++i) { const NFMsg::PropertyString& xData = pPropertyData.property_string_list(i); if (pProps->ExistElement(xData.property_name())) { pProps->AddProperty(pProps->Self(), xData.property_name(), NFDATA_TYPE::TDATA_STRING); } pProps->SetPropertyString(xData.property_name(), xData.data()); } for (int i = 0; i < pPropertyData.property_object_list_size(); ++i) { const NFMsg::PropertyObject& xData = pPropertyData.property_object_list(i); if (pProps->ExistElement(xData.property_name())) { pProps->AddProperty(pProps->Self(), xData.property_name(), NFDATA_TYPE::TDATA_OBJECT); } pProps->SetPropertyObject(xData.property_name(), NFGUID(xData.data().svrid(), xData.data().index())); } for (int i = 0; i < pPropertyData.property_vector2_list_size(); ++i) { const NFMsg::PropertyVector2& xData = pPropertyData.property_vector2_list(i); if (pProps->ExistElement(xData.property_name())) { pProps->AddProperty(pProps->Self(), xData.property_name(), NFDATA_TYPE::TDATA_VECTOR2); } pProps->SetPropertyVector2(xData.property_name(), NFVector2(xData.data().x(), xData.data().y())); } for (int i = 0; i < pPropertyData.property_vector3_list_size(); ++i) { const NFMsg::PropertyVector3& xData = pPropertyData.property_vector3_list(i); if (pProps->ExistElement(xData.property_name())) { pProps->AddProperty(pProps->Self(), xData.property_name(), NFDATA_TYPE::TDATA_VECTOR3); } pProps->SetPropertyVector3(xData.property_name(), NFVector3(xData.data().x(), xData.data().y(), xData.data().z())); } } return true; }