@@ -552,8 +552,6 @@ NameKeyType listboxGameSetupChatID = NAMEKEY_INVALID;
552552
553553static void handleColorSelection (int index)
554554{
555- // TODO_NGMP
556- return ;
557555 GameWindow *combo = comboBoxColor[index];
558556 Int color, selIndex;
559557 GadgetComboBoxGetSelectedPos (combo, &selIndex);
@@ -582,35 +580,19 @@ static void handleColorSelection(int index)
582580 }
583581 }
584582 }
583+
584+ // TODO_NGMP: Enforce this on the service too
585585 if (!colorAvailable)
586586 return ;
587587 }
588588
589- slot->setColor (color);
589+ // NGMP: Dont set it locally / directly anymore, rely on the lobby service instead
590+ // slot->setColor(color);
590591
591- if (TheGameSpyInfo->amIHost ())
592- {
593- // send around a new slotlist
594- TheGameSpyInfo->setGameOptions ();
595- WOLDisplaySlotList ();
596- }
597- else
592+ // NGMP: Update lobby (if local, for remote players we'll get it from the service)
593+ if (index == myGame->getLocalSlotNum ())
598594 {
599- // request the color from the host
600- if (!slot->isPlayer (TheGameSpyInfo->getLocalName ()))
601- return ;
602-
603- AsciiString options;
604- options.format (" Color=%d" , color);
605- AsciiString hostName;
606- hostName.translate (myGame->getSlot (0 )->getName ());
607- PeerRequest req;
608- req.peerRequestType = PeerRequest::PEERREQUEST_UTMPLAYER;
609- req.UTM .isStagingRoom = TRUE ;
610- req.id = " REQ/" ;
611- req.nick = hostName.str ();
612- req.options = options.str ();
613- TheGameSpyPeerMessageQueue->addRequest (req);
595+ NGMP_OnlineServicesManager::GetInstance ()->GetLobbyInterface ()->UpdateCurrentLobby_MyColor (color);
614596 }
615597 }
616598}
@@ -632,22 +614,33 @@ static void handlePlayerTemplateSelection(int index)
632614 Int oldTemplate = slot->getPlayerTemplate ();
633615 slot->setPlayerTemplate (playerTemplate);
634616
617+ int updatedStartPos = slot->getStartPos ();
618+
635619 if (oldTemplate == PLAYERTEMPLATE_OBSERVER)
636620 {
637621 // was observer, so populate color & team with all, and enable
638622 GadgetComboBoxSetSelectedPos (comboBoxColor[index], 0 );
639623 GadgetComboBoxSetSelectedPos (comboBoxTeam[index], 0 );
640624 slot->setStartPos (-1 );
625+ updatedStartPos = -1 ;
641626 }
642627 else if (playerTemplate == PLAYERTEMPLATE_OBSERVER)
643628 {
644629 // is becoming observer, so populate color & team with random only, and disable
645630 GadgetComboBoxSetSelectedPos (comboBoxColor[index], 0 );
646631 GadgetComboBoxSetSelectedPos (comboBoxTeam[index], 0 );
647632 slot->setStartPos (-1 );
633+ updatedStartPos = -1 ;
648634 }
649635
636+ // NGMP: Update lobby (if local, for remote players we'll get it from the service)
637+ if (index == myGame->getLocalSlotNum ())
638+ {
639+ NGMP_OnlineServicesManager::GetInstance ()->GetLobbyInterface ()->UpdateCurrentLobby_MySide (playerTemplate, updatedStartPos);
640+ }
650641
642+ // NGMP: Dont set it locally / directly anymore, rely on the lobby service instead
643+ /*
651644 if (NGMP_OnlineServicesManager::GetInstance()->GetLobbyInterface()->IsHost())
652645 {
653646 // send around a new slotlist
@@ -675,16 +668,15 @@ static void handlePlayerTemplateSelection(int index)
675668 req.options = options.str();
676669 TheGameSpyPeerMessageQueue->addRequest(req);
677670 */
671+ /*
678672 }
673+ */
679674 }
680675}
681676
682677
683678static void handleStartPositionSelection (Int player, int startPos)
684679{
685- // TODO_NGMP
686- return ;
687-
688680 NGMPGame* myGame = NGMP_OnlineServicesManager::GetInstance ()->GetLobbyInterface ()->GetCurrentGame ();
689681
690682 if (myGame)
@@ -715,34 +707,14 @@ static void handleStartPositionSelection(Int player, int startPos)
715707 if ( !isAvailable )
716708 return ;
717709 }
718- slot->setStartPos (startPos);
719710
720- if (myGame->amIHost ())
721- {
722- // send around a new slotlist
723- myGame->resetAccepted ();
724- TheGameSpyInfo->setGameOptions ();
725- WOLDisplaySlotList ();
726- }
727- else
728- {
729- // request the color from the host
730- if (AreSlotListUpdatesEnabled ())
731- {
732- // request the playerTemplate from the host
733- AsciiString options;
734- options.format (" StartPos=%d" , slot->getStartPos ());
735- AsciiString hostName;
736- hostName.translate (myGame->getSlot (0 )->getName ());
737- PeerRequest req;
738- req.peerRequestType = PeerRequest::PEERREQUEST_UTMPLAYER;
739- req.UTM .isStagingRoom = TRUE ;
740- req.id = " REQ/" ;
741- req.nick = hostName.str ();
742- req.options = options.str ();
743- TheGameSpyPeerMessageQueue->addRequest (req);
711+ // NGMP: Dont set it locally / directly anymore, rely on the lobby service instead
712+ // slot->setStartPos(startPos);
744713
745- }
714+ // NGMP: Update lobby (if local, for remote players we'll get it from the service)
715+ if (player == myGame->getLocalSlotNum ())
716+ {
717+ NGMP_OnlineServicesManager::GetInstance ()->GetLobbyInterface ()->UpdateCurrentLobby_MyStartPos (startPos);
746718 }
747719 }
748720}
@@ -751,9 +723,6 @@ static void handleStartPositionSelection(Int player, int startPos)
751723
752724static void handleTeamSelection (int index)
753725{
754- // TODO_NGMP
755- return ;
756-
757726 GameWindow *combo = comboBoxTeam[index];
758727 Int team, selIndex;
759728 GadgetComboBoxGetSelectedPos (combo, &selIndex);
@@ -767,29 +736,13 @@ static void handleTeamSelection(int index)
767736 if (team == slot->getTeamNumber ())
768737 return ;
769738
770- slot->setTeamNumber (team);
739+ // NGMP: Dont set it locally / directly anymore, rely on the lobby service instead
740+ // slot->setTeamNumber(team);
771741
772- if (TheGameSpyInfo->amIHost ())
742+ // NGMP: Update lobby (if local, for remote players we'll get it from the service)
743+ if (index == myGame->getLocalSlotNum ())
773744 {
774- // send around a new slotlist
775- myGame->resetAccepted ();
776- TheGameSpyInfo->setGameOptions ();
777- WOLDisplaySlotList ();
778- }
779- else
780- {
781- // request the team from the host
782- AsciiString options;
783- options.format (" Team=%d" , team);
784- AsciiString hostName;
785- hostName.translate (myGame->getSlot (0 )->getName ());
786- PeerRequest req;
787- req.peerRequestType = PeerRequest::PEERREQUEST_UTMPLAYER;
788- req.UTM .isStagingRoom = TRUE ;
789- req.id = " REQ/" ;
790- req.nick = hostName.str ();
791- req.options = options.str ();
792- TheGameSpyPeerMessageQueue->addRequest (req);
745+ NGMP_OnlineServicesManager::GetInstance ()->GetLobbyInterface ()->UpdateCurrentLobby_MyTeam (team);
793746 }
794747 }
795748}
0 commit comments