[Orxonox-commit 4272] r8943 - in code/branches/formation: data/defaultConfig src/orxonox/controllers
willis at orxonox.net
willis at orxonox.net
Wed Nov 23 14:13:52 CET 2011
Author: willis
Date: 2011-11-23 14:13:52 +0100 (Wed, 23 Nov 2011)
New Revision: 8943
Modified:
code/branches/formation/data/defaultConfig/keybindings.ini
code/branches/formation/src/orxonox/controllers/HumanController.cc
code/branches/formation/src/orxonox/controllers/Masterable.cc
Log:
Added Keybinding for toggleFormationFlight
Modified: code/branches/formation/data/defaultConfig/keybindings.ini
===================================================================
--- code/branches/formation/data/defaultConfig/keybindings.ini 2011-11-18 17:52:21 UTC (rev 8942)
+++ code/branches/formation/data/defaultConfig/keybindings.ini 2011-11-23 13:13:52 UTC (rev 8943)
@@ -70,7 +70,7 @@
KeyNoConvert=
KeyNumLock=
KeyNumRow0=
-KeyNumRow1=
+KeyNumRow1="toggleFormationFlight"
KeyNumRow2=
KeyNumRow3=
KeyNumRow4=
Modified: code/branches/formation/src/orxonox/controllers/HumanController.cc
===================================================================
--- code/branches/formation/src/orxonox/controllers/HumanController.cc 2011-11-18 17:52:21 UTC (rev 8942)
+++ code/branches/formation/src/orxonox/controllers/HumanController.cc 2011-11-23 13:13:52 UTC (rev 8943)
@@ -49,7 +49,7 @@
SetConsoleCommand("HumanController", "rotateYaw", &HumanController::rotateYaw ).addShortcut().setAsInputCommand();
SetConsoleCommand("HumanController", "rotatePitch", &HumanController::rotatePitch ).addShortcut().setAsInputCommand();
SetConsoleCommand("HumanController", "rotateRoll", &HumanController::rotateRoll ).addShortcut().setAsInputCommand();
- SetConsoleCommand("HumanController", "toggleFormationFlight", &HumanController::toggleFormationFlight).addShortcut().setAsInputCommand();
+ SetConsoleCommand("HumanController", "toggleFormationFlight", &HumanController::toggleFormationFlight).addShortcut().keybindMode(KeybindMode::OnPress);
SetConsoleCommand("HumanController", __CC_fire_name, &HumanController::fire ).addShortcut().keybindMode(KeybindMode::OnHold);
SetConsoleCommand("HumanController", "reload", &HumanController::reload ).addShortcut();
SetConsoleCommand("HumanController", __CC_boost_name, &HumanController::keepBoost ).addShortcut().keybindMode(KeybindMode::OnHold);
@@ -87,7 +87,7 @@
{
HumanController::localController_s = 0;
if (this->state_==MASTER)
- freeSlaves();
+ removeFromFormation();
}
void HumanController::tick(float dt)
@@ -282,7 +282,6 @@
} else //SLAVE or FREE
{
HumanController::localController_s->takeLeadOfFormation();
- //HumanController::localController_s->state_=MASTER;
}
}
Modified: code/branches/formation/src/orxonox/controllers/Masterable.cc
===================================================================
--- code/branches/formation/src/orxonox/controllers/Masterable.cc 2011-11-18 17:52:21 UTC (rev 8942)
+++ code/branches/formation/src/orxonox/controllers/Masterable.cc 2011-11-23 13:13:52 UTC (rev 8943)
@@ -580,6 +580,9 @@
*/
void Masterable::takeLeadOfFormation()
{
+ if (!this->getControllableEntity())
+ return;
+
if (this->state_==MASTER) return;
//search new Master, then take lead
if (this->state_==FREE)
@@ -663,11 +666,11 @@
}
//debug
if (this->state_==SLAVE)
- {orxout(debug_output) << this << " is slave "<< endl;}
- else if (this->state_==MASTER)
- {orxout(debug_output) << this << " is now a master of "<<this->slaves_.size()<<" slaves."<< endl;}
- if (this->state_==FREE)
- {orxout(debug_output) << this << " is free "<< endl;}
+ {orxout(debug_output) << this << " is slave "<< endl;}
+ else if (this->state_==MASTER)
+ {orxout(debug_output) << this << " is now a master of "<<this->slaves_.size()<<" slaves."<< endl;}
+ if (this->state_==FREE)
+ {orxout(debug_output) << this << " is free "<< endl;}
}
More information about the Orxonox-commit
mailing list