コード例 #1
0
ファイル: clayerproperties.cpp プロジェクト: dogtwelve/eepp
void cLayerProperties::AddCellClick( const cUIEvent * Event ) {
	mGenGrid->Add( CreateCell() );

	Uint32 Index = mGenGrid->GetItemSelectedIndex();

	if ( eeINDEX_NOT_FOUND == Index ) {
		mGenGrid->GetCell( 0 )->Select();
	}
}
コード例 #2
0
ファイル: DrawInfo.cpp プロジェクト: hefen1/XCaimi
void CDrawInfo::CreateSelf()
{
	// 第一行第一列为股票名称 第二行第二列为股票代码
	int nCellCount = m_ayInfoIndex.GetCount() + 2;
	int nRowCount = nCellCount / INFO_COL_COUNT + ((nCellCount%INFO_COL_COUNT)==0?0:1); // 向上取整
	SetColCount(INFO_COL_COUNT);
	SetRowCount(nRowCount);
	SetRowHeight(INFO_ROW_HEIGHT);
	nCellCount = INFO_COL_COUNT * nRowCount;
	SetCellCount(nCellCount);

	int nCellIndex(0);
	int nAyIndex(0);
	CString str;
	InfoIndex* pInfoIndex = NULL;
	//////////////////////////////////////////////////////////////////////////
	// 第一列
	str = m_stkInfo.m_cStockName;   // 股票名称
	CreateCell(str, TEXT_COLOR_STOCKCODE, TEXT_FONT_FIXED, ITEM_TEXT_CENTER, CELL_BORDER_RIGHT | CELL_BORDER_BOTTOM, 0, nCellIndex++);
	
	str = m_stkInfo.m_ciStockCode.GetCode(); // 代码名称
	CreateCell(str, TEXT_COLOR_STOCKNAME, TEXT_FONT_FIXED, ITEM_TEXT_CENTER, CELL_BORDER_RIGHT | CELL_BORDER_BOTTOM, 0, nCellIndex++);
	
	//////////////////////////////////////////////////////////////////////////
	// 添加返回的数据
	for (int y = 0; y < GetRowCount(); y++)
	{
		for (int x = 1; x < GetColCount() - 1; x++)
		{
			nCellIndex = PointToIndex(CPoint(x,y));
			str = "";
			if (nAyIndex < m_ayInfoIndex.GetCount())
			{
				pInfoIndex = m_ayInfoIndex.GetAt(nAyIndex++);
				str = pInfoIndex->m_cTitle;
			}
			CreateCell(str, TEXT_COLOR_FIXEDNAME, TEXT_FONT_FIXED, ITEM_TEXT_CENTER, CELL_BORDER_RIGHT | CELL_BORDER_BOTTOM, 0, nCellIndex);
		}
		// 每一行最后一列单元格是按钮
		nCellIndex = PointToIndex(CPoint(GetColCount()-1, y));
		CreateCell("", TEXT_COLOR_FIXEDNAME, TEXT_FONT_FIXED, ITEM_TEXT_CENTER, CELL_BORDER_RIGHT | CELL_BORDER_BOTTOM, 0, nCellIndex);
	}
}
コード例 #3
0
typename CollapsedAKQReducedCubSComplexSupplier<Traits>::CellDescriptor*
CollapsedAKQReducedCubSComplexSupplier<Traits>::AddCell(CubCellSetPtr cubCellSet,
                                                        BitCoordIterator& it,
                                                        size_t dim)
{
    CellDescriptor* cell = _cellsMapByDim[dim][it];
    if (cell != 0)
    {
        return cell;
    }
    return CreateCell(cubCellSet, it, dim);
}
コード例 #4
0
ファイル: clayerproperties.cpp プロジェクト: dogtwelve/eepp
void cLayerProperties::LoadProperties() {
	cLayer::PropertiesMap& Proper = mLayer->GetProperties();

	for ( cLayer::PropertiesMap::iterator it = Proper.begin(); it != Proper.end(); it++ ) {
		cUIGridCell * Cell = CreateCell();

		cUITextInput * Input = reinterpret_cast<cUITextInput*>( Cell->Cell( 1 ) );
		cUITextInput * Input2 = reinterpret_cast<cUITextInput*>( Cell->Cell( 3 ) );

		Input->Text( it->first );
		Input2->Text( it->second );

		mGenGrid->Add( Cell );
	}
}
コード例 #5
0
ファイル: WorldMapLayer.cpp プロジェクト: RuWhyNot/thewe
void WorldMapLayer::OnTownSelect(Town::WeakPtr town)
{
	bool avaliable = World::Instance().IsTownAvaliableToPlaceCell(town);

	if (!avaliable)
	{
		return;
	}

	Town::Ptr townptr = town.lock();

	if (!townptr->IsCellPresented())
	{
		if (World::Instance().IsFirstLaunch())
		{
			Cell::Info info;
			info.parent = Cell::WeakPtr();
			info.town = town;
			info.location = town.lock()->GetLocation();
			info.cash = GameInfo::Instance().GetInt("CELL_STARTUP_MONEY");
			info.morale = GameInfo::Instance().GetFloat("CELL_STARTUP_MORALE");
			info.devotion = GameInfo::Instance().GetFloat("CELL_STARTUP_DEVOTION");
			info.membersCount = GameInfo::Instance().GetInt("CELL_STARTUP_MEMBERS");
			info.ratsCount = GameInfo::Instance().GetInt("CELL_STARTUP_RATS_COUNT");
			info.techUnitsCount = GameInfo::Instance().GetInt("CELL_STARTUP_TECH_UNITS_COUNT");
			info.experience = 0;
			info.fame = 0.0f;
			info.stateBegin = 0;
			info.stateDuration = 0;
			info.specialization = Cell::Specialization::NORMAL;
			info.townHeartPounding = GameInfo::Instance().GetFloat("CELL_STARTUP_TOWN_HEART_POUNDING");
			info.townInfluence = GameInfo::Instance().GetFloat("CELL_STARTUP_TOWN_INFLUENCE");
			info.townWelfare = GameInfo::Instance().GetFloat("CELL_STARTUP_TOWN_WELFARE");
			Cell::Ptr cell = CreateCell(info, Cell::State::READY);

			World::Instance().SetFirstLaunch(false);
			World::Instance().GetCellsNetwork().SetRootCell(cell);

			if (World::Instance().GetTutorialManager().IsTutorialStateAvailable("FirstCell"))
			{
				World::Instance().GetTutorialManager().RemoveCurrentTutorial();
				World::Instance().GetTutorialManager().RunTutorialFunction("AfterCreatingFirstCell");
			}

			MessageManager::Instance().PutMessage(Message("SaveGame"));
		}
	}
}
コード例 #6
0
ファイル: DrawRStockTitle.cpp プロジェクト: hefen1/XCaimi
CDrawRStockTitle::CDrawRStockTitle(IHsUserDataCfg* pUserDefCfg, IHsColor* pColor, IHsFont* pFont)
{
	ASSERT(pUserDefCfg && pColor && pFont);
	m_iUserDefCfg = pUserDefCfg;
	m_pColor = pColor;
	m_pFont = pFont;

	SetStyle(TABLE_STYLE_SCREEN | TABLE_WIDTH_CHANGABLE | TABLE_HEIGHT_CHANGABLE);
	SetRowCount(1);
	SetColCount(1);

	CreateCell("", 0, 0, 0, CELL_TIP);

	ReadFile();
	m_pImageList = NULL;

}
コード例 #7
0
ファイル: VEFObject.cpp プロジェクト: MarcelHB/gemrb
bool VEFObject::Draw(const Region &screen, Point &position, const Color &p_tint, Map *area, int dither, int orientation, int height)
{
	bool ret = true;

	if (!area) return true; //end immediately
	ieDword GameTime = core->GetGame()->GameTime;

	std::list<ScheduleEntry>::iterator iter;

	for(iter=entries.begin();iter!=entries.end();iter++) {
		//don't render the animation if it is outside of the cycle
		if ( (*iter).start>GameTime) continue;
		if ( (*iter).length<GameTime) continue;

		Point pos = ((*iter).offset);
		pos.x+=position.x;
		pos.y+=position.y;

		bool tmp;

		if (!(*iter).ptr) {
			switch((*iter).type) {
				case VEF_2DA: //original gemrb implementation of composite video effects
					(*iter).ptr = CreateObject( (*iter).resourceName, IE_2DA_CLASS_ID);
					if ( (*iter).ptr ) {
						break;
					}
					// fall back to VEF, intentional fallthrough
				case VEF_VEF: //vanilla engine implementation of composite video effects
					(*iter).ptr = CreateObject( (*iter).resourceName, IE_VEF_CLASS_ID);
					if ( (*iter).ptr ) {
						break;
					}
					//fall back to BAM or VVC, intentional fallthrough
				case VEF_BAM: //just a BAM
				case VEF_VVC: //videocell (can contain a BAM)
					(*iter).ptr = CreateCell( (*iter).resourceName, (*iter).length, (*iter).start);
					break;
				default:;
			}
		}

		void *ptr = (*iter).ptr;
		if (!ptr) (*iter).type = VEF_INVALID;

		switch((*iter).type) {
		case VEF_BAM:
		case VEF_VVC:
			tmp = ((ScriptedAnimation *) (*iter).ptr)->Draw(screen, pos, p_tint, area, dither, orientation, height);
			break;
		case VEF_2DA:
		case VEF_VEF:
			tmp = ((VEFObject *) (*iter).ptr)->Draw(screen, pos, p_tint, area, dither, orientation, height);
			break;
		default:
			tmp = true; //unknown/invalid type
		}
		if (tmp) {
			(*iter).length = 0; //stop playing this if reached end
		}
		ret &= tmp;
	}
	return ret;
}
コード例 #8
0
void CollapsedAKQReducedCubSComplexSupplier<Traits>::CreateKappaMapFromQuotient(
                                                         CubCellSetPtr cubCellSet,
                                                         Dims& dims,
                                                         KappaMap& kappaMap)
{
    _allCells.clear();
    _cellsMapByDim.clear();

    _nullSetCell = new CellDescriptor(0, 0);
    _allCells.push_back(_nullSetCell);
    _cellsCountByDim[0] = 1;

    size_t maxDim = static_cast<size_t>(cubCellSet().embDim());
    PointCoordIterator it = PointCoordIterator(cubCellSet().begin());
    BitCoordIterator itEnd = cubCellSet().end();
    for ( ; it < itEnd; ++it)
    {
        if (it.ownDim() == maxDim)
        {
            CreateCell(cubCellSet, it, maxDim);
        }
    }

    std::map<size_t, size_t> cellsIndicesOffsets;
    size_t totalCellsCount = 0;
    for (size_t i = 0; i <= maxDim; i++)
    {
        if (i > 0)
        {
            cellsIndicesOffsets[i] = cellsIndicesOffsets[i - 1] + _cellsCountByDim[i - 1];
        }
        totalCellsCount += _cellsCountByDim[i];
        _logger.Log(FGLogger::Debug)<<_cellsCountByDim[i]<<" cells in dim "<<i;
        _logger.Log(FGLogger::Debug)<<" with offset "<<cellsIndicesOffsets[i]<<std::endl;
    }
    _logger.Log(FGLogger::Debug)<<"total cells generated: "<<totalCellsCount<<std::endl;

    dims.resize(totalCellsCount);
    kappaMap.clear();

    typename CellsDescriptors::iterator jt = _allCells.begin();
    typename CellsDescriptors::iterator jtEnd = _allCells.end();
    for ( ; jt != jtEnd; ++jt)
    {
        CellDescriptor* cell = *jt;
        size_t index = cell->_index + cellsIndicesOffsets[cell->_dim];
        size_t faceIndexOffset = cellsIndicesOffsets[cell->_dim - 1];
        dims[index] = cell->_dim;
        std::vector<int>::iterator cIt = cell->_coefficients.begin();
        for (typename CellsDescriptors::iterator fIt = cell->_faces.begin();
                                                 fIt != cell->_faces.end();
                                                 ++fIt)
        {
            CellDescriptor* face = *fIt;
            kappaMap.push_back(KappaMapEntry(static_cast<Id>(index),
                                             static_cast<Id>(face->_index + faceIndexOffset),
                                             *cIt));
            cIt++;
        }
    }

    jt = _allCells.begin();
    for ( ; jt != jtEnd; ++jt)
    {
        delete *jt;
    }
}
コード例 #9
0
INT main(VOID)
{
	HAB hab;
	HMQ hmq;
	QMSG qmsg;
    HWND hwndFrame;
    HWND hwndTb;
    SWP swp;

    hab = WinInitialize(0);

    if(!hab)
    {
        return -1;
    }

    hmq = WinCreateMsgQueue(hab, 0);

    if(!hmq)
    {
        WinTerminate(hab);
        return -2;
    }

    ToolkitInit(hab);

    WinQueryWindowPos(HWND_DESKTOP, &swp);

    hwndFrame = CreateCell(&mainClient, HWND_DESKTOP, 0);
    if(hwndFrame)
    {
        HWND hwndSubframe = CellWindowFromID(hwndFrame, ID_LPANE);

        WinSetWindowPos(hwndFrame, NULLHANDLE,
        	            swp.x + swp.cx / 8,
            	        swp.y + swp.cy / 8,
                	    (swp.cx / 4) * 3,
                    	(swp.cy / 4) * 3,
	                    SWP_ACTIVATE | SWP_MOVE | SWP_SIZE | SWP_SHOW);


        CreateToolbar(hwndFrame, &mainTb);
        CreateToolbar(hwndFrame, &mainTb1);
        CreateToolbar(hwndFrame, &mainTb2);
        CreateToolbar(hwndFrame, &mainTb3);
        CreateToolbar(hwndFrame, &mainTb4);

        if(hwndSubframe)
            CreateToolbar(hwndSubframe, &mainTb5);

        while (WinGetMsg(hab, &qmsg, 0, 0, 0))
        	WinDispatchMsg(hab, &qmsg);

        WinDestroyWindow(hwndFrame);
    }

	WinDestroyMsgQueue(hmq);
	WinTerminate(hab);

    return 0;
}
コード例 #10
0
ファイル: mccbt.c プロジェクト: Johnson13/xLearn
/* ============================================= */
void main()
/* ============================================= */
{
  char r[80];
  int32_t A, B;
  int32_t C[4];
  int32_t *I;

  InitCbt(arbre, nbleaf);
  do
  {
    printf("commande (qUIT, cREATECELL, SETfATHER, SETdATA, INvERSE\n");
    printf("           pRINTCBT, aNC, DiFFANC, lOWCOMANC, tRICROISSANT) > ");
    scanf("%s", r);
    switch (r[0])
    {
      case 'a': printf("cell ? ");
                scanf("%d", &A);
                printf("data ? ");
                scanf("%d", &B);
                A = Anc(arbre, A, B);
                printf("resultat: %d \n", A);
                break;
      case 'i': printf("cells ? ");
                for (B = 0; B < 4; B++)
                {
                  scanf("%d", &A);
                  if (A<0) break;
                  C[B] = A;
                }
                printf("data ? ");
                scanf("%d", &A);
                B = DiffAnc(arbre, B, C, A);
                printf("resultat : ");
                for (A = 0; A < B; A++)
                  printf(" %d ", C[A]);
                printf("\n");
                break;
      case 't': printf("cells ? ");
                for (B = 0; B < 4; B++)
                {
                  scanf("%d", &A);
                  if (A<0) break;
                  C[B] = A;
                }
                TriCroissant(arbre, C, B);
                printf("resultat : ");
                for (A = 0; A < B; A++)
                  printf(" %d ", C[A]);
                printf("\n");
                break;
      case 'l': printf("cells ? ");
                for (B = 0; B < 4; B++)
                {
                  scanf("%d", &A);
                  if (A<0) break;
                  C[B] = A;
                }
                B = LowComAnc(arbre, B, C);
                printf("resultat : %d\n", B);
                break;
      case 'v': I = InverseCBT(arbre, nbleaf, nbcell);
                for (B = 0; B < nbcell; B++)
                {
                  printf("%d : %d\n", B, I[B]);
                }
                break;
      case 'c': A = CreateCell(arbre, &nbcell, MAXNBCELL);
                printf("cell created : %d\n", A);
                break;
      case 'f': scanf("%d", &A);
                scanf("%d", &B);
                SetFather(arbre, A, B);
                break;
      case 'd': scanf("%d", &A);
                scanf("%d", &B);
                SetData(arbre, A, B);
                break;
      case 'p': PrintCbt(arbre, nbcell);
                break;
      case 'q': break;
    }
  } while (r[0] != 'q');
}
コード例 #11
0
ファイル: DrawRFinance.cpp プロジェクト: hefen1/XCaimi
BOOL CDrawRFinance::CreateSelf()
{
	m_ayTitleInt.RemoveAll();
	m_ayTitleStr.RemoveAll();
	m_ayTitleInt.Add(COLUMN_FINANCE_REPORT_DATE);         //38 报告期
	m_ayTitleStr.Add("报告期");
	m_ayTitleInt.Add(COLUMN_CAPITALIZATION_TOTAL);        //1 总股本(万股)
	m_ayTitleStr.Add("总股本");
	m_ayTitleInt.Add(COLUMN_CAPITALIZATION_PASS_A);	      //7 流通A股 
	m_ayTitleStr.Add("流通A股");
	m_ayTitleInt.Add(COLUMN_FINANCE_ASSETS_YIELD); 	      //37 净资收益率
	m_ayTitleStr.Add("净资收益率");
	m_ayTitleInt.Add(COLUMN_FINANCE_MAIN_INCOME);  	      //20 主营收入
	m_ayTitleStr.Add("主营收入");

	m_ayTitleInt.Add(COLUMN_FINANCE_TOTAL_PROFIT);	      //28 利润总额
	m_ayTitleStr.Add("利润总额");
	m_ayTitleInt.Add(COLUMN_FINANCE_PER_UNPAID);   	      //32 每股未分配
	m_ayTitleStr.Add("每股未分配");
	m_ayTitleInt.Add(COLUMN_CAPITALIZATION_NATIONAL);	  //2 国家股
	m_ayTitleStr.Add("国家股");
	m_ayTitleInt.Add(COLUMN_CAPITALIZATION_INITIATOR);	  //3 发起人法人股
	m_ayTitleStr.Add("发起人法人股");
	m_ayTitleInt.Add(COLUMN_CAPITALIZATION_CORPORATION);  //4 法人股 
	m_ayTitleStr.Add("法人股");

	m_ayTitleInt.Add(COLUMN_CAPITALIZATION_B);            //5 B股
	m_ayTitleStr.Add("B股");
	m_ayTitleInt.Add(COLUMN_CAPITALIZATION_H);			  //6 H股
	m_ayTitleStr.Add("H股");
	m_ayTitleInt.Add(COLUMN_CAPITALIZATION_EMPLOYEE);     //8 职工股
	m_ayTitleStr.Add("职工股");
	m_ayTitleInt.Add(COLUMN_FINANCE_TOTAL_ASSETS);   	  //10 总资产
	m_ayTitleStr.Add("总资产");
	m_ayTitleInt.Add(COLUMN_FINANCE_CURRENT_ASSETS);	  //11 流动资产  
	m_ayTitleStr.Add("流动资产");

	m_ayTitleInt.Add(COLUMN_FINANCE_CAPITAL_ASSETS);	  //12 固定资产  
	m_ayTitleStr.Add("固定资产");
	m_ayTitleInt.Add(COLUMN_FINANCE_UNBODIED_ASSETS);	  //13 无形资产  
	m_ayTitleStr.Add("无形资产");
	m_ayTitleInt.Add(COLUMN_FINANCE_CURRENT_LIABILITIES); //15 流动负债 
	m_ayTitleStr.Add("流动负债");
	m_ayTitleInt.Add(COLUMN_FINANCE_LONG_LIABILITIES);	  //16 长期负债 
	m_ayTitleStr.Add("长期负债");
	m_ayTitleInt.Add(COLUMN_FINANCE_CAPITAL_ACCFUND);	  //17 资本公积金
	m_ayTitleStr.Add("资本公积金");

	m_ayTitleInt.Add(COLUMN_FINANCE_PERSTOCK_ACCFUND);	  //18 每股公积金
	m_ayTitleStr.Add("每股公积金");
	m_ayTitleInt.Add(COLUMN_FINANCE_PARTNER_RIGHT);	      //19 股东权益  
	m_ayTitleStr.Add("股东权益");
	m_ayTitleInt.Add(COLUMN_FINANCE_TAKING_PROFIT);	      //23 营业利润  
	m_ayTitleStr.Add("营业利润");
	m_ayTitleInt.Add(COLUMN_FINANCE_YIELD);   	          //24 投资收益  
	m_ayTitleStr.Add("投资收益");
	m_ayTitleInt.Add(COLUMN_FINANCE_OTHER_INCOME);	      //26 营业外收支
	m_ayTitleStr.Add("营业外收支");

	m_ayTitleInt.Add(COLUMN_FINANCE_SCOT_PROFIT);	       //29 税后利润
	m_ayTitleStr.Add("税后利润");
	m_ayTitleInt.Add(COLUMN_FINANCE_RETAINED_PROFITS);	   //30 净利润
	m_ayTitleStr.Add("净利润");
	m_ayTitleInt.Add(COLUMN_FINANCE_PER_INCOME);	       //33 每股收益
	m_ayTitleStr.Add("每股收益");
	m_ayTitleInt.Add(COLUMN_FINANCE_PER_ASSETS);		   //34 每股净资产
	m_ayTitleStr.Add("每股净资产");
	m_ayTitleInt.Add(COLUMN_FINANCE_PARTNER_RIGHT_RATIO);  //36 股东权益比
	m_ayTitleStr.Add("股东权益比");

	DWORD lItemStyle(-1);
	DWORD lCellStyle(-1);
	////////////////////////////  第一列  //////////////////////////////////////
	lItemStyle = ITEM_TEXT_LEFT;
	for (int i = 0; i < m_ayTitleInt.GetCount(); i++)
	{
		CreateCell(m_ayTitleStr.GetAt(i),  TEXT_COLOR_FIXEDNAME, TEXT_FONT_FINANCE, lItemStyle);
	}

	////////////////////////////  第二列  //////////////////////////////////////
	lItemStyle = ITEM_TEXT_RIGHT;
	for (int i = 0; i < m_ayTitleInt.GetCount(); i++)
	{
		CreateCell("", TEXT_COLOR_FIXEDNAME, TEXT_FONT_FINANCE, lItemStyle);
	}

	SetRowCount(m_ayTitleInt.GetCount());
	SetColCount(RFinance_COL);
	SetFixColCount(0);
	SetFixRowCount(0);
	SetRowHeight(RFinance_ROW_HEIGHT);
	
	return TRUE;
}
コード例 #12
0
ファイル: WorldMapLayer.cpp プロジェクト: RuWhyNot/thewe
void WorldMapLayer::AcceptMessage(const Message &msg)
{
	if (msg.is("AddInvestigatorWidget"))
	{
		Investigator::Ptr investigator = World::Instance().GetInvestigatorByUid(msg.variables.GetInt("UID"));
		if (investigator)
		{
			InvestigatorMapWidget *widget = CreateInvestigatorWidget(investigator);
			addChild(widget, Z_INVESTIGATOR);
			_investigatorWidgets.push_back(widget);

			if (World::Instance().GetTutorialManager().IsTutorialStateAvailable("WaitForFirstInvestigator"))
			{
				dynamic_cast<GameScene*>(getParent())->MoveViewToPoint(
					investigator->GetInvestigationRoot().lock()->GetInfo().town.lock()->GetLocation());
				UpdateMapElements();
			}
		}
	}
	else if (msg.is("DeleteInvestigatorWidget"))
	{
		for (InvestigatorWidgetsIter it = _investigatorWidgets.begin(); it != _investigatorWidgets.end(); ++it)
		{
			InvestigatorMapWidget *widget = (*it);
			if (widget->GetInvestigatorUid() == msg.variables.GetInt("UID"))
			{
				removeChild(widget);
				it = _investigatorWidgets.erase(it);
				break;
			}
		}
	}
	else if (msg.is("DeleteCellWidget"))
	{
		for (CellWidgetsIter it = _cellWidgets.begin(); it != _cellWidgets.end(); ++it)
		{
			CellMapWidget *widget = (*it);
			if (widget->GetCellUid() == msg.variables.GetInt("UID"))
			{
				removeChild(widget);
				_mapProjector->RemoveMapPart(widget->GetProjectorUid());
				_mapProjector->Update();
				UpdateMapElements();
				it = _cellWidgets.erase(it);
				delete widget;
				break;
			}
		}
	}
	else if (msg.is("SpinoffWithDragEnded") || msg.is("RelinkWithDragEnded"))
	{
		_isMapMovementsEnabled = true;
		SetTownsVisibility(msg.variables.GetBool("SHOW_TOWNS"));
	}
	else if (msg.is("SpinoffWithDragBegan") || msg.is("RelinkWithDragBegan"))
	{
		_isMapMovementsEnabled = false;
		SetTownsVisibility(msg.variables.GetBool("SHOW_TOWNS"));
	}
	else if (msg.is("EnableMapScrolling")) {
		_isMapMovementsEnabled = true;
	} else if (msg.is("DisableMapScrolling")) {
		_isMapMovementsEnabled = false;
	}
	else if (msg.is("RelinkCell"))
	{
		Cell::Ptr relink_cell = World::Instance().GetCellsNetwork().GetCellByUid(msg.variables.GetInt("RELINK_CELL_UID"));
		Cell::Ptr parent_cell = World::Instance().GetCellsNetwork().GetCellByUid(msg.variables.GetInt("PARENT_CELL_UID"));

		if (relink_cell->IsState(Cell::State::AUTONOMY) && parent_cell->IsState(Cell::State::READY))
		{
			relink_cell->GetInfo().state = Cell::State::READY;
			relink_cell->GetInfo().stateBegin = 0;
			relink_cell->GetInfo().stateDuration = 0;

			World::Instance().GetCellsNetwork().RelinkCells(parent_cell, relink_cell);

			UpdateMapElements();
		}
	}
	else if (msg.is("CreateCell"))
	{
		Town::WeakPtr town = World::Instance().GetTownByName(msg.variables.GetString("TOWN_NAME"));
		Cell::WeakPtr parent = World::Instance().GetCellsNetwork().GetCellByUid(msg.variables.GetInt("PARENT_UID"));

		if (parent.lock()->GetInfo().cash >= GameInfo::Instance().GetInt("CELL_SPINOFF_CASH_PRICE") &&
			parent.lock()->GetInfo().membersCount >= GameInfo::Instance().GetInt("CELL_SPINOFF_MEMBERS_PRICE"))
		{
			Cell::Info info;

			info.parent = parent;
			info.town = town;
			info.location = town.lock()->GetLocation();
			info.cash = GameInfo::Instance().GetInt("CELL_STARTUP_MONEY");
			info.morale = GameInfo::Instance().GetFloat("CELL_STARTUP_MORALE");
			info.devotion = GameInfo::Instance().GetFloat("CELL_STARTUP_DEVOTION");
			info.membersCount = GameInfo::Instance().GetInt("CELL_STARTUP_MEMBERS");
			info.ratsCount = GameInfo::Instance().GetInt("CELL_STARTUP_RATS_COUNT");
			info.techUnitsCount = GameInfo::Instance().GetInt("CELL_STARTUP_TECH_UNITS_COUNT");
			info.experience = 0;
			info.fame = 0.0f;
			info.specialization = Cell::Specialization::NORMAL;
			info.townHeartPounding = GameInfo::Instance().GetFloat("CELL_STARTUP_TOWN_HEART_POUNDING");
			info.townInfluence = GameInfo::Instance().GetFloat("CELL_STARTUP_TOWN_INFLUENCE");
			info.townWelfare = GameInfo::Instance().GetFloat("CELL_STARTUP_TOWN_WELFARE");

			parent.lock()->GetInfo().cash -= GameInfo::Instance().GetInt("CELL_SPINOFF_CASH_PRICE");
			parent.lock()->GetInfo().membersCount -= GameInfo::Instance().GetInt("CELL_SPINOFF_MEMBERS_PRICE");

			info.stateBegin = Utils::GetGameTime();
			info.stateDuration = GameInfo::Instance().GetTime("CELL_CONSTRUCTION_TIME");

			CreateCell(info, Cell::State::CONSTRUCTION);

			const std::set<std::string>& test = World::Instance().GetTutorialManager().GetTutorialStatements();
			if (World::Instance().GetTutorialManager().IsTutorialStateAvailable("ReadyToCreateSpinoff"))
			{
				World::Instance().GetTutorialManager().RemoveCurrentTutorial();
				World::Instance().GetTutorialManager().RunTutorialFunction("OnCreateFirstSpinoff");
			}

			MessageManager::Instance().PutMessage(Message("SaveGame"));
		}
	}
}