- Set focus to dead hedgehog
authorunc0rr
Mon, 13 Oct 2008 14:44:15 +0000
changeset 1347 1102e19780b9
parent 1346 b4d51b95aa16
child 1348 0eb0b3a955b8
- Set focus to dead hedgehog - Switch from rooms list page to net page when disconnected from server
QTfrontend/hwform.cpp
hedgewars/HHHandlers.inc
--- a/QTfrontend/hwform.cpp	Mon Oct 13 12:58:44 2008 +0000
+++ b/QTfrontend/hwform.cpp	Mon Oct 13 14:44:15 2008 +0000
@@ -282,11 +282,14 @@
 		  curTeamSelWidget->resetPlayingTeams(teamsList);
 		}
 	}
+
+	if (id == ID_PAGE_ROOMSLIST && lastid == ID_PAGE_NETCFG)
+		GoBack();
 }
 
 void HWForm::GoToPage(quint8 id)
 {
-	quint8 lastid=ui.Pages->currentIndex();
+	quint8 lastid = ui.Pages->currentIndex();
 	PagesStack.push(ui.Pages->currentIndex());
 	OnPageShown(id, lastid);
 	ui.Pages->setCurrentIndex(id);
@@ -295,11 +298,12 @@
 void HWForm::GoBack()
 {
 	if (!PagesStack.isEmpty() && PagesStack.top() == ID_PAGE_NET) {
-	  if(hwnet || pnetserver) NetDisconnect();
+		if(hwnet || pnetserver) NetDisconnect();
 	}
 	quint8 id = PagesStack.isEmpty() ? ID_PAGE_MAIN : PagesStack.pop();
-	OnPageShown(id, ui.Pages->currentIndex());
+	quint8 curid = ui.Pages->currentIndex();
 	ui.Pages->setCurrentIndex(id);
+	OnPageShown(id, curid);
 }
 
 void HWForm::btnExitPressed()
--- a/hedgewars/HHHandlers.inc	Mon Oct 13 12:58:44 2008 +0000
+++ b/hedgewars/HHHandlers.inc	Mon Oct 13 14:44:15 2008 +0000
@@ -617,6 +617,7 @@
 		Gear^.Timer:= 0;
 		Gear^.State:= Gear^.State or gstHHDeath;
 		Gear^.doStep:= @doStepHedgehogDead;
+		FollowGear:= Gear;
 		PrvInactive:= false;
 		AllInactive:= false
 		end;