bool GUnitProductionEventHandler::HandleSplitUnits(SDK::GGameEventSPtr in_pEvent) { // Get Event SP2::Event::GSplitUnits* l_pSplitUnitsEvent= (SP2::Event::GSplitUnits*)in_pEvent.get(); gassert(l_pSplitUnitsEvent,"Invalid null pointer in the event"); // Get player to get country ID SDK::GPlayer* l_pPlayer = g_Joshua.ActivePlayer(in_pEvent->m_iSource); if(!l_pPlayer) return false; // Get special production group SP2::GUnitGroupEx* l_pGroup = g_ServerDCL.UnitMover().ProductionQueueUnitGroups()[l_pPlayer->ModID()-1]; gassert(l_pGroup,"There should be a unit production queue group where the units are to be placed when built"); // Find units in the production group vector<SDK::Combat::GUnit*>::const_iterator l_UnitIterator = l_pGroup->Units().begin(); while( (*l_UnitIterator)->Id() != l_pSplitUnitsEvent->m_iUnitID && l_UnitIterator != l_pGroup->Units().end()) { l_UnitIterator++; } gassert(l_UnitIterator != l_pGroup->Units().end(),"Didn't find the unit to split, invalid unit Id"); SP2::GUnit* l_pUnitToSplit = (SP2::GUnit* )( *l_UnitIterator); g_ServerDCL.SplitUnit(l_pUnitToSplit, l_pSplitUnitsEvent->m_iQty, l_pGroup); return true; }
void GStartSinglePlayerWindow::RemoveGameObjective(EObjectiveType::Enum in_eObjectiveType) { for(UINT32 i = 0 ; i < g_ClientDCL.m_vGameObjectives.size() ; i++) { if(g_ClientDCL.m_vGameObjectives[i].m_eObjectiveType == in_eObjectiveType) { g_ClientDCL.m_vGameObjectives.erase(g_ClientDCL.m_vGameObjectives.begin()+i); return; } } gassert(0,"GStartSinglePlayerWindow::RemoveGameObjective incoherence, asked to remove a non present Objectivetype"); }
bool GUnitProductionEventHandler::HandleDeployUnits(SDK::GGameEventSPtr in_pEvent) { // Get Event SP2::Event::GDeployUnits* l_pDeployUnitsEvent= (SP2::Event::GDeployUnits*)in_pEvent.get(); gassert(l_pDeployUnitsEvent,"Invalid null pointer in the event"); // Get player SDK::GPlayer* l_pPlayer = g_Joshua.ActivePlayer(in_pEvent->m_iSource); if(!l_pPlayer) return false; // Deploye players units. g_ServerDCL.DeployUnits(l_pPlayer->ModID(),l_pDeployUnitsEvent->m_UnitListToDeploy,l_pDeployUnitsEvent->m_DeployementCoordinate ); return true; }
bool GUnitProductionEventHandler::HandleCancelDeployement(SDK::GGameEventSPtr in_pEvent) { // Get Event SP2::Event::GCancelDeployement* l_pCancelDeployementEvent= (SP2::Event::GCancelDeployement*)in_pEvent.get(); gassert(l_pCancelDeployementEvent != NULL,"Invalid null pointer in the event"); // Cancel the deployement all those groups. list<UINT32>::iterator l_GroupIdIterator = l_pCancelDeployementEvent->m_GroupIdListToCancel.begin(); while(l_GroupIdIterator != l_pCancelDeployementEvent->m_GroupIdListToCancel.end()) { g_ServerDCL.UnitMover().CancelDeployement((SP2::GUnitGroup*)g_Joshua.UnitManager().UnitGroup(*l_GroupIdIterator)); l_GroupIdIterator++; } // I guest we are all done. return true; }
bool GUnitProductionEventHandler::HandleGRegisterAsBuildingCountry(SDK::GGameEventSPtr in_pEvent) { // Get Event SP2::Event::GRegisterAsBuildingCountry* l_pRegisteringEvent = (SP2::Event::GRegisterAsBuildingCountry*)in_pEvent.get(); gassert(l_pRegisteringEvent != NULL,"Invalid null pointer in the event"); // Find country ID SDK::GPlayer* l_pPlayer = g_Joshua.ActivePlayer(in_pEvent->m_iSource); if(!l_pPlayer) return false; UINT32 l_iCountryId = l_pPlayer->ModID(); g_ServerDAL.CountryData(l_iCountryId)->AcceptForeignOrder(l_pRegisteringEvent->m_bAcceptForeignCountryOrder); return true; }
void GUnitProductionEventHandler::HandleGroupSplit(SDK::GGameEventSPtr in_pEvent) { SP2::Event::GEventGroupSplit* l_pUpdateEvent = (SP2::Event::GEventGroupSplit*) (in_pEvent.get() ); // dont botter splitting a group with no units to split if(l_pUpdateEvent->m_UnitsToSplit.size() == 0) return; SP2::GUnitGroup* l_pOldGroup = (SP2::GUnitGroup*)g_Joshua.UnitManager().UnitGroup( l_pUpdateEvent->m_iGroupToSplit ); gassert(l_pOldGroup, "Getting a group that do not exist"); if(!l_pOldGroup) return; SP2::GUnitGroup* l_pNewGroup = (SP2::GUnitGroup*)g_Joshua.UnitManager().CreateUnitGroup(); EMilitaryStatus::Enum l_eOldGroupStatus = l_pOldGroup->Status(); GVector2D<REAL32> l_OldGroupPosition = l_pOldGroup->Position(); l_pNewGroup->Id( g_Joshua.UnitManager().NewUnitGroupID() ); // Add the new group to the unit manager g_Joshua.UnitManager().AddUnitGroup(l_pNewGroup); l_pNewGroup->OwnerId( l_pOldGroup->OwnerId() ); for(hash_map<INT32, INT32>::iterator l_It = l_pUpdateEvent->m_UnitsToSplit.begin(); l_It != l_pUpdateEvent->m_UnitsToSplit.end(); l_It++) { SP2::GUnit* l_pUnit = (SP2::GUnit*)l_pOldGroup->Unit( l_It->first ); g_ServerDCL.SplitUnit( l_pUnit, l_It->second, l_pNewGroup); } if( !l_pNewGroup->Units().size() ) g_Joshua.UnitManager().DeleteUnitGroup( l_pNewGroup ); else { l_pNewGroup->ChangeStatus( l_eOldGroupStatus ); g_Joshua.UnitManager().SetGroupPosition( l_pNewGroup, l_OldGroupPosition ); } // Add the new group to the unit mover g_ServerDCL.UnitMover().AddGroup(l_pNewGroup); }
void GGenericQuestionWindow::KillMe(void) { // Detach, notification was sent Detach(m_Question.m_pOberserToNotify,c_OnGenericQuestionWindowAnswerCancel); Detach(m_Question.m_pOberserToNotify,c_OnGenericQuestionWindowAnswerOk); // Remove from modal list if(m_Question.m_pParentWindow) { vector<GUI::GBaseObject*>::iterator l_It = find(m_Question.m_pParentWindow->RegisteredModalWindow.begin(), m_Question.m_pParentWindow->RegisteredModalWindow.end(), (SDK::GUI::GBaseObject*)this); gassert(l_It != RegisteredModalWindow.end(),"We attached ourselve in the show...it has to be there"); m_Question.m_pParentWindow->RegisteredModalWindow.erase(l_It); } // Kill it g_Joshua.GUIManager()->ReleaseObjectAsync(this); m_bEventSent = true; }
bool GUnitProductionEventHandler::HandleDisbandUnitRequest(SDK::GGameEventSPtr in_pEvent) { // Get Event SP2::Event::GDisbandUnitRequest* l_pDisbandRequest = (SP2::Event::GDisbandUnitRequest*)in_pEvent.get(); gassert(l_pDisbandRequest != NULL,"Invalid null pointer in the event"); SDK::GPlayer* l_pPlayer = g_Joshua.ActivePlayer(in_pEvent->m_iSource); if(!l_pPlayer) return false; list<UINT32>::iterator l_It = l_pDisbandRequest->m_UnitIdListToDisband.begin(); while( l_It != l_pDisbandRequest->m_UnitIdListToDisband.end() ) { //Disband those units SDK::Combat::GUnit* l_pUnit = g_Joshua.UnitManager().Unit(*l_It); if(l_pUnit) g_ServerDCL.DisbandUnits( l_pPlayer->ModID(), l_pUnit ); l_It++; } return true; }
bool GUnitProductionEventHandler::HandleTrainUnitRequest(SDK::GGameEventSPtr in_pEvent) { // Get Event SP2::Event::GTrainUnitRequest* l_pTrainingRequest = (SP2::Event::GTrainUnitRequest*)in_pEvent.get(); gassert(l_pTrainingRequest != NULL,"Invalid null pointer in the event"); SDK::GPlayer* l_pPlayer = g_Joshua.ActivePlayer(in_pEvent->m_iSource); if(!l_pPlayer) return false; UINT32 l_iCountryId = l_pPlayer->ModID(); if( l_pTrainingRequest->m_UnitIdListToTrain.size() ) { bool l_bAllYourUnits = true; for(list<UINT32>::iterator l_It = l_pTrainingRequest->m_UnitIdListToTrain.begin(); l_It != l_pTrainingRequest->m_UnitIdListToTrain.end(); l_It++) { SP2::GUnit* l_pUnit = (SP2::GUnit*)g_Joshua.UnitManager().Unit( *l_It ); if(!l_pUnit) return false; if( l_iCountryId != ((SP2::GUnitGroup*)l_pUnit->Group())->OwnerId() ) { l_bAllYourUnits = false; break; } } if(!l_bAllYourUnits) return false; // Start training those units g_ServerDCL.UnitMover().TrainUnits(l_pTrainingRequest->m_UnitIdListToTrain); } return true; }
/*! * Update the game objective in the list of the game objectives with the data from the interface **/ void GStartSinglePlayerWindow::UpdateObjective(EObjectiveType::Enum in_eType) { //Get the time limit UINT32 l_iTimeLimit = 0; { GString l_sSelectedTime; switch(in_eType) { case EObjectiveType::RaiseGDPPerCapita: { l_sSelectedTime = m_pObjRaiseGDPCbo->Selected_Content(); break; } case EObjectiveType::ConquerTheWorld: { l_sSelectedTime = m_pObjConquerWorldCbo->Selected_Content(); break; } case EObjectiveType::AchieveWorldPeace: { l_sSelectedTime = m_pObjWorldPeaceCbo->Selected_Content(); break; } case EObjectiveType::MeetResourcesNeeds: { l_sSelectedTime = m_pObjBalanceResCbo->Selected_Content(); break; } case EObjectiveType::DevelopNation: { l_sSelectedTime = m_pObjDevelopNationCbo->Selected_Content(); break; } } if(l_sSelectedTime == g_ClientDAL.GetString(EStrId::NoLimit)) { l_iTimeLimit = 0; } else if(l_sSelectedTime == g_ClientDAL.GetString(EStrId::Goal1Year)) { l_iTimeLimit = 1; } else if(l_sSelectedTime == g_ClientDAL.GetString(EStrId::Goal5Years)) { l_iTimeLimit = 5; } else if(l_sSelectedTime == g_ClientDAL.GetString(EStrId::Goal10Years)) { l_iTimeLimit = 10; } } //Update the objective with the new time limit for(UINT32 i = 0 ; i < g_ClientDCL.m_vGameObjectives.size() ; i++) { if(g_ClientDCL.m_vGameObjectives[i].m_eObjectiveType == in_eType) { if(l_iTimeLimit) g_ClientDCL.m_vGameObjectives[i].m_fTimeOutTime = g_Joshua.GameTime() + (l_iTimeLimit * 365.25f); else g_ClientDCL.m_vGameObjectives[i].m_fTimeOutTime = 0.f; return; } } gassert(0,"GStartSinglePlayerWindow::UpdateObjective incoherence, asked to update a non present Objectivetype"); return; }
stringRange &operator()(string::const_iterator ibegin, string::const_iterator iend) { gassert(ibegin <= iend, "invalid range pointers positions"); begin = ibegin; end = iend; return *this; }
GUI::EEventStatus::Enum GCovertActionsNewMissionWindow::OnMouseClick(const GEventData & in_EventData, GUI::GBaseObject *in_pCaller) { __super::OnMouseClick(in_EventData, in_pCaller); if(in_pCaller) { if(in_EventData.Mouse.Actor.Bits.Left || in_EventData.Mouse.Down.Bits.Left) { if(in_pCaller == m_pObjCancel) Hide(); else if(in_pCaller == m_pObjConfirm) { for(UINT32 i = 0; i < m_viCellsID.size(); i++) { SDK::GGameEventSPtr l_Event = CREATE_GAME_EVENT(SP2::Event::GEventCellNewMission); SP2::Event::GEventCellNewMission* l_pUpdate = (SP2::Event::GEventCellNewMission*)l_Event.get(); l_pUpdate->m_iSource = g_SP2Client->Id(); l_pUpdate->m_iTarget = SDK::Event::ESpecialTargets::Server; l_pUpdate->m_iCellID = m_viCellsID[i]; l_pUpdate->m_eComplexity = g_ClientDAL.ConvertMissionComplexityToEnum( m_pObjComplexityCbo->Selected_Content() ); l_pUpdate->m_eSector = g_ClientDAL.ConvertTargetSectorToEnum( m_pObjSectorCbo->Selected_Content() ); if( m_pObjFramedCbo->Selected_Content() == g_ClientDAL.GetString(EStrId::None) ) l_pUpdate->m_iFramedCountry = 0; else l_pUpdate->m_iFramedCountry = g_ClientDAL.Country( m_pObjFramedCbo->Selected_Content() ).Id(); l_pUpdate->m_eType = g_ClientDAL.ConvertMissionTypeToEnum( m_pObjTypeCbo->Selected_Content() ); if(m_pObjSectorCbo->Selected_Content() == g_ClientDAL.ConvertTargetSectorToString(SP2::ECovertActionsTargetSector::Military) ) { l_pUpdate->m_eUnitCategory = g_ClientDAL.ConvertUnitCategoryToEnum( m_pObjResourceCbo->Selected_Content() ); } else if(m_pObjSectorCbo->Selected_Content() == g_ClientDAL.ConvertTargetSectorToString(SP2::ECovertActionsTargetSector::Civilian)) { l_pUpdate->m_eResourceType = g_ClientDAL.ConvertResourcesToEnum( m_pObjResourceCbo->Selected_Content() ); } g_Joshua.RaiseEvent(l_Event); //Locally modify the cell GCovertActionCell* l_pCell = &g_ClientDAL.m_PlayerCountryData.CovertActionCell(m_viCellsID[i]); gassert(l_pCell,"Cell should exist"); if(l_pCell) { l_pCell->TargetSector( l_pUpdate->m_eSector ); l_pCell->MissionComplexity( l_pUpdate->m_eComplexity ); l_pCell->CountryToFrame( l_pUpdate->m_iFramedCountry ); l_pCell->MissionType( l_pUpdate->m_eType ); if( l_pUpdate->m_eSector == SP2::ECovertActionsTargetSector::Civilian ) l_pCell->ResourceType(l_pUpdate->m_eResourceType); else if( l_pUpdate->m_eSector == SP2::ECovertActionsTargetSector::Military ) l_pCell->UnitCategory(l_pUpdate->m_eUnitCategory); if(l_pCell->ActualState() == ECovertActionsCellState::Dormant) { l_pCell->ChangeState(ECovertActionsCellState::GettingReady); l_pCell->SubsequentStateAdd(ECovertActionsCellState::PreparingMission); } else if(l_pCell->ActualState() == ECovertActionsCellState::Active) { l_pCell->ChangeState(ECovertActionsCellState::PreparingMission); } } } g_ClientDDL.CovertActionsWindow()->Update(); Hide(); } } } return GUI::EEventStatus::Handled; }
void GCovertActionsNewMissionWindow::UpdateCountryToFrameCbo() { vector<GCovertActionCell> l_vCells = g_ClientDAL.m_PlayerCountryData.CovertActionCells(); vector<SP2::GCountry> l_Country = g_ClientDAL.Countries(); UINT32 j = 0; if(m_pRowCoupDetat) { m_pRowCoupDetat->m_bHidden = false; m_pObjTypeCbo->DropSize( 72 ); for(UINT32 i = 0; i < m_viCellsID.size(); i++) { for(j = 0; j < l_vCells.size(); j++) { if(l_vCells[j].ID() == m_viCellsID[i]) { if( l_vCells[j].AssignedCountry() == (UINT32)g_ClientDAL.ControlledCountryID() ) { // Cant do a coup detat on yourself, else you could lose the game =/ m_pRowCoupDetat->m_bHidden = true; m_pObjTypeCbo->DropSize( 58 ); } } } } gassert(j < l_vCells.size(),"Cell should be in the list"); m_pObjTypeCbo->Update(); } if(m_viCellsID.size() > 1) { m_pObjTargetLbl->Text(L"-"); m_pObjFramedCbo->Enabled(false); } else { m_pObjFramedCbo->Enabled(true); for(j = 0; j < l_vCells.size(); j++) { if(l_vCells[j].ID() == m_viCellsID[0]) { m_pObjTargetLbl->Text( g_ClientDAL.Country( l_vCells[j].AssignedCountry() ).Name() ); break; } } if(j == l_vCells.size()) return; bool l_bCanBreak = false; for(UINT32 k = 0; k < l_Country.size(); k++) { if(l_Country[j].Id() == (INT16)l_vCells[j].AssignedCountry()) { l_Country.erase(l_Country.begin() + k); if(l_bCanBreak) break; else l_bCanBreak = true; } } } m_pObjFramedCbo->Clear(); m_pObjFramedCbo->Add_Item(g_ClientDAL.GetString(EStrId::None)); g_ClientDDL.ComboboxSetCountriesAndFlag(l_Country, m_pObjFramedCbo); m_pObjFramedCbo->Selected_Content( g_ClientDAL.GetString(EStrId::None) ); }
bool GEventLogWindow::Update() { //Clear the already existing lists { m_ShownEvents.clear(); m_pObjEventsLst->Clear(); } bool l_bMustSkipCategory [ESphere::Count]; //If all the buttons toggle state is off, it is as if they were all pressed bool l_bAllToggledOff = true; //Compute which categories must be skipped and which must be processed for(UINT32 i = ESphere::Economic ; i < ESphere::Count ; i++) { //If category is not toggled in or there are no events in it, skip the category if(!m_pObjCategoryToggle[i]->ToggleState()) l_bMustSkipCategory[i] = true; else { l_bMustSkipCategory[i] = false; l_bAllToggledOff = false; } //If all the buttons toggle state is off, it is as if they were all pressed /* if(m_pObjCategoryToggle[i]->ToggleState()) { l_bAllToggledOff = false; } //If category is not toggled in or there are no events in it, skip the category if(!m_pObjCategoryToggle[i]->ToggleState() || !m_Events[i].size()) l_bMustSkipCategory[i] = true; else l_bMustSkipCategory[i] = false; */ } //If all the buttons toggle state is off, it is as if they were all pressed, skip no category if(l_bAllToggledOff) { for(UINT32 i = 0; i < ESphere::Count ; i++) { l_bMustSkipCategory[i] = false; } } //Display the events in historical order (by ID and not by category) { //Count the number of items and set the iterators UINT32 l_iItemCount = 0; map<UINT32, SEventLogData>::iterator l_EventsIt[ESphere::Count]; for(UINT32 i = 0 ; i < ESphere::Count; i++) { if(!l_bMustSkipCategory[i]) { l_iItemCount += m_Events[i].size(); l_EventsIt[i] = m_Events[i].begin(); } } //While there are items to display while(l_iItemCount) { //Find the lowest id among the iterators INT32 l_iLowestIdSphere = -1; INT32 l_iLowestID = -1; for(UINT32 i = 0 ; i < ESphere::Count ; i++) { if(!l_bMustSkipCategory[i]) { //If the iterator is valid if(l_EventsIt[i] != m_Events[i].end()) { //If there are no chosen item yet if(l_iLowestIdSphere == -1) { l_iLowestIdSphere = i; l_iLowestID = l_EventsIt[i]->first; } //If the id is lower else if(l_EventsIt[i]->first < (UINT32)l_iLowestIdSphere) { l_iLowestIdSphere = i; l_iLowestID = l_EventsIt[i]->first; } } } } if(l_iLowestID != -1) { //Item to display is identified by in l_iLowestID and l_iLowestIDSphere AddItem(l_EventsIt[l_iLowestIdSphere]->second); m_ShownEvents.push_back(make_pair( m_pObjEventsLst->Get_Nb_Rows() - 1, l_EventsIt[l_iLowestIdSphere]->first) ); l_EventsIt[l_iLowestIdSphere]++; l_iItemCount--; } else { gassert(l_iItemCount == 0,"Incoherence in event log window::Update"); break; } } } m_pObjEventsLst->Update(); return true; }
void GEventLogWindow::AddItem(SEventLogData in_Data) { GUI::GListBox::GRow* l_pRow = m_pObjEventsLst->Insert_New_Row(); GUI::GPictureBox* l_pPic = (GUI::GPictureBox*)l_pRow->Object()->Child(L"picIcon"); GUI::GLabel* l_pLabel = (GUI::GLabel*)l_pRow->Object()->Child(L"txtEvent"); GUI::GLabel* l_pCode = (GUI::GLabel*)l_pRow->Object()->Child(L"frmCountry")->Child(L"txtCode"); GUI::GPictureBox* l_pFlag = (GUI::GPictureBox*)l_pRow->Object()->Child(L"frmCountry")->Child(L"picFlag"); //GUI::GFrame* l_pSecondFlag = (GUI::GFrame*)g_Joshua.GUIManager()->GetNewGUIObjectInternal(L"frmCountrySmall", L"frmSecondFlag", l_pRow->Object(), false, false); GString l_sSecondString = L""; gassert(in_Data.m_iCountryA,"Should always have a country on side A"); if(in_Data.m_iCountryA) { const GCountry & l_Country = g_ClientDAL.Country(in_Data.m_iCountryA); l_pCode->Text( l_Country.Code() ); l_pFlag->PictureBackground(g_ClientDDL.SmallFlagsTextures()[l_Country.Id()]); l_pRow->Object()->Child(L"frmCountry")->TooltipText( l_Country.Name() ); } if(in_Data.m_iCountryB) { const GCountry & l_Country = g_ClientDAL.Country(in_Data.m_iCountryB); l_sSecondString = L" " + l_Country.Name(); /* ((GUI::GPictureBox*)l_pSecondFlag->Child(L"picFlag"))->PictureNormal(g_ClientDDL.SmallFlagsTextures()[l_Country.Id()]); ((GUI::GLabel*)l_pSecondFlag->Child(L"txtCode"))->Text( l_Country.Code() ); l_pSecondFlag->TooltipText( l_Country.Name() ); */ } switch(in_Data.m_eType) { case ESphere::Demographic: l_pPic->PictureNormal(GString(L"000834")); l_pPic->PictureBackground( l_pPic->PictureNormal() ); l_pLabel->FontColorNormal(GColorRGBInt(115, 116, 190, 255)); break; case ESphere::Economic: l_pPic->PictureNormal(GString(L"000835")); l_pPic->PictureBackground( l_pPic->PictureNormal() ); l_pLabel->FontColorNormal(GColorRGBInt(115, 190, 122, 255)); break; case ESphere::Politic: l_pPic->PictureNormal(GString(L"000837")); l_pPic->PictureBackground( l_pPic->PictureNormal() ); l_pLabel->FontColorNormal(GColorRGBInt(200, 201, 127, 255)); break; case ESphere::Military: l_pPic->PictureNormal(GString(L"000836")); l_pPic->PictureBackground( l_pPic->PictureNormal() ); l_pLabel->FontColorNormal(GColorRGBInt(190, 115, 115, 255)); break; } l_pLabel->Text(in_Data.m_sMail + l_sSecondString); /* l_pSecondFlag->Left(l_pLabel->Left() + l_pLabel->Text2D()->Width() + 7); l_pSecondFlag->Top(l_pFlag->Top() - 2); l_pSecondFlag->Show(); l_pSecondFlag->BringToFront(); */ m_pObjEventsLst->Update(); UINT32 l_iLastRowShown = (UINT32)m_pObjEventsLst->FirstRowShown() + m_pObjEventsLst->NbVisibleObjects(); if( l_iLastRowShown == (UINT32)m_pObjEventsLst->Get_Nb_Rows() ) m_pObjEventsLst->ScrollTo( m_pObjEventsLst->Get_Nb_Rows() - 1 ); }
GUI::EEventStatus::Enum GStartSinglePlayerWindow::OnCustomEvent(UINT32 in_iEventID, const GUI::GEventData& in_EventData, GUI::GBaseObject * in_pCaller) { switch (in_iEventID) { case c_iOnPartySelection: { INT32 l_iPartyID = (INT32)in_EventData.Data; for(UINT32 i=0; i<m_vParties.size(); i++) { if(m_vParties[i].Id() == l_iPartyID) { m_iSelectedPartyID = m_vParties[i].Id(); m_pObjPartyName->Text( g_ClientDAL.GetString( m_vParties[i].NameId() ) ); break; } } } break; case c_iOnCountryProfileWindowSelection: { INT32 l_iCountryID = (INT32)in_EventData.Data; if(l_iCountryID > 0) { m_pObjCountryCbo->Selected_Content( g_ClientDAL.Country(l_iCountryID).Name() ); SDK::GGameEventSPtr l_Event = CREATE_GAME_EVENT(SP2::Event::GGetCountryParties); SP2::Event::GGetCountryParties* l_Evt = (SP2::Event::GGetCountryParties*)l_Event.get(); l_Evt->m_iSource = g_Joshua.Client()->Id(); l_Evt->m_iCountryId = g_ClientDAL.Country( m_pObjCountryCbo->Selected_Content() ).Id(); l_Evt->m_iTarget = SDK::Event::ESpecialTargets::Server; g_Joshua.RaiseEvent(l_Event); m_pObjStartGameBtn->Enabled(true); m_pObjPoliticalPartyBtn->Enabled(true); } } break; //If a combo box was selected case ECustomEvents::OnComboBoxBeforeOpen: { if(in_EventData.Data == m_pObjCountryCbo) g_ClientDDL.ComboboxSetCountriesAndFlag(g_ClientDAL.Countries(), (GUI::GComboBox*)in_EventData.Data, true); return GUI::EEventStatus::Handled; } case ECustomEvents::OnComboBoxSelectionEvent: { //Determine which combo box was selected and update the objective for that box GUI::GComboBox * l_pCombo = (GUI::GComboBox *)in_EventData.Data; gassert(l_pCombo, "GStartSinglePlayerWindow::OnCustomEvent Combo box pointer shouldnt be null on custom event"); if(l_pCombo == m_pObjConquerWorldCbo) { UpdateObjective(EObjectiveType::ConquerTheWorld); } else if(l_pCombo == m_pObjRaiseGDPCbo) { UpdateObjective(EObjectiveType::RaiseGDPPerCapita); } else if(l_pCombo == m_pObjWorldPeaceCbo) { UpdateObjective(EObjectiveType::AchieveWorldPeace); } else if(l_pCombo == m_pObjBalanceResCbo) { UpdateObjective(EObjectiveType::MeetResourcesNeeds); } else if(l_pCombo == m_pObjDevelopNationCbo) { UpdateObjective(EObjectiveType::DevelopNation); } else if(l_pCombo == m_pObjCountryCbo) { if( m_pObjCountryCbo->Selected_Content() != g_ClientDAL.GetString(EStrId::SelectACountry)) { SDK::GGameEventSPtr l_Event = CREATE_GAME_EVENT(SP2::Event::GGetCountryParties); SP2::Event::GGetCountryParties* l_Evt = (SP2::Event::GGetCountryParties*)l_Event.get(); l_Evt->m_iSource = g_Joshua.Client()->Id(); l_Evt->m_iCountryId = g_ClientDAL.Country( m_pObjCountryCbo->Selected_Content() ).Id(); l_Evt->m_iTarget = SDK::Event::ESpecialTargets::Server; g_Joshua.RaiseEvent(l_Event); m_pObjStartGameBtn->Enabled(true); m_pObjPoliticalPartyBtn->Enabled(true); } } break; } default: break; } return EEventStatus::Handled; }
void tokenizer::addRule(int id, bool skip, const string &start, const string &exception, const string &end) { gassert(id >= 0, "rule ids that are lower than 0 are reserved"); _rules.push_back({id, skip, start, exception, end, end.size() > 0}); }
stringRange(string::const_iterator ibegin, string::const_iterator iend) : begin(ibegin), end(iend) { gassert(ibegin <= iend, "invalid range pointers positions"); }