> I think you have changed the behaviour here.
>
> Only the current player can normally press space to make the fall of
> bonus box fastest. It have to be discussed I guess.
No, you could drop a box with space even as non turn master. That's why
this patch was necessary.
>
> Florian Köberle a écrit :
>> ---
>> lib/wormux/include/WORMUX_action.h | 1 +
>> src/game/game.cpp | 16 ++++++++++++++++
>> src/game/game.h | 1 +
>> src/include/action_handler.cpp | 7 +++++++
>> src/interface/man_machine_interface.cpp | 6 +-----
>> 5 files changed, 26 insertions(+), 5 deletions(-)
>>
>> diff --git a/lib/wormux/include/WORMUX_action.h
>> b/lib/wormux/include/WORMUX_action.h
>> index cc612b9..489154a 100644
>> --- a/lib/wormux/include/WORMUX_action.h
>> +++ b/lib/wormux/include/WORMUX_action.h
>> @@ -116,6 +116,7 @@ public:
>>
>> // Bonus Box
>> ACTION_DROP_BONUS_BOX,
>> + ACTION_REQUEST_BONUS_BOX_DROP,
>>
>> // ########################################################
>> ACTION_NETWORK_PING,
>> diff --git a/src/game/game.cpp b/src/game/game.cpp
>> index c4b6fcd..0f0eee8 100644
>> --- a/src/game/game.cpp
>> +++ b/src/game/game.cpp
>> @@ -632,6 +632,22 @@ bool Game::NewBox()
>> return true;
>> }
>>
>> +void Game::RequestBonusBoxDrop()
>> +{
>> + ObjBox* current_box = Game::GetInstance()->GetCurrentBox();
>> + if (current_box != NULL) {
>> + if (Network::GetInstance()->IsTurnMaster()) {
>> + Action a(Action::ACTION_DROP_BONUS_BOX);
>> + Network::GetInstance()->SendActionToAll(a);
>> +
>> + current_box->DropBox();
>> + } else {
>> + Action a(Action::ACTION_REQUEST_BONUS_BOX_DROP);
>> + Network::GetInstance()->SendActionToAll(a);
>> + }
>> + }
>> +}
>> +
>> void Game::SetState(game_loop_state_t new_state, bool begin_game)
>> {
>> if (begin_game &&
>> diff --git a/src/game/game.h b/src/game/game.h
>> index 69b7a0c..94dc429 100644
>> --- a/src/game/game.h
>> +++ b/src/game/game.h
>> @@ -153,5 +153,6 @@ public:
>> bool NewBox();
>> void SetCurrentBox(ObjBox * current_box) { current_ObjBox =
>> current_box; };
>> ObjBox * GetCurrentBox() { return current_ObjBox; };
>> + void RequestBonusBoxDrop();
>> };
>> #endif // GAME_H
>> diff --git a/src/include/action_handler.cpp
>> b/src/include/action_handler.cpp
>> index 968f116..26037c7 100644
>> --- a/src/include/action_handler.cpp
>> +++ b/src/include/action_handler.cpp
>> @@ -325,6 +325,12 @@ static void Action_DropBonusBox (Action */*a*/)
>> }
>> }
>>
>> +static void Action_RequestBonusBoxDrop (Action */*a*/)
>> +{
>> + if (Network::GetInstance()->IsTurnMaster())
>> + Game::GetInstance()->RequestBonusBoxDrop();
>> +}
>> +
>> // ########################################################
>>
>> static void Action_Rules_SetGameMode (Action *a)
>> @@ -999,6 +1005,7 @@ void Action_Handler_Init()
>>
>> // Bonus box
>> ActionHandler::GetInstance()->Register
>> (Action::ACTION_DROP_BONUS_BOX, "BONUSBOX_drop_box",
>> &Action_DropBonusBox);
>> + ActionHandler::GetInstance()->Register
>> (Action::ACTION_REQUEST_BONUS_BOX_DROP, "BONUSBOX_request_box_drop",
>> &Action_RequestBonusBoxDrop);
>> // ########################################################
>> ActionHandler::GetInstance()->Register (Action::ACTION_NETWORK_PING,
>> "NETWORK_ping", &Action_Network_Ping);
>> ActionHandler::GetInstance()->Register
>> (Action::ACTION_NETWORK_RANDOM_INIT, "NETWORK_random_init",
>> &Action_Network_RandomInit);
>> diff --git a/src/interface/man_machine_interface.cpp
>> b/src/interface/man_machine_interface.cpp
>> index bc480fa..ea9ee87 100644
>> --- a/src/interface/man_machine_interface.cpp
>> +++ b/src/interface/man_machine_interface.cpp
>> @@ -266,11 +266,7 @@ void ManMachineInterface::HandleKeyReleased(const
>> Key_t &key)
>> if (key == KEY_SHOOT) {
>>
>> if (Game::GetInstance()->ReadState() == Game::END_TURN) {
>> - ObjBox* current_box = Game::GetInstance()->GetCurrentBox();
>> - if (current_box != NULL) {
>> - Action * a = new Action(Action::ACTION_DROP_BONUS_BOX);
>> - ActionHandler::GetInstance()->NewAction(a);
>> - }
>> + Game::GetInstance()->RequestBonusBoxDrop();
>> } else if (Game::GetInstance()->ReadState() == Game::PLAYING &&
>> ActiveTeam().IsLocal() &&
>> !ActiveCharacter().IsDead()) {
>>
>
>
> _______________________________________________
> Wormux-dev mailing list
> [email protected]
> https://mail.gna.org/listinfo/wormux-dev
>
>
_______________________________________________
Wormux-dev mailing list
[email protected]
https://mail.gna.org/listinfo/wormux-dev