disable manual scrolling during enemy ai turn

Discussion of all aspects of the game engine, including development of new and existing features.

Moderator: Forum Moderators

Post Reply
markip
Posts: 1
Joined: March 10th, 2016, 2:49 pm

disable manual scrolling during enemy ai turn

Post by markip »

Hi,
I am trying to find a way to disable scrolling during ai turn, when "show unit action" is selected in preferences. When trying to scroll the map during enemy turn, it will automatically scroll back to where enemy units are moving/attacking, making it impossible to scroll as desired. So I thought, why not just disable manual scrolling?
The downside is, if the enemy is not in sight, you wouldn't be able to scroll around the map until it has finished its turn, despite the fact that no "auto-scrolling" took place...But I don't think it is important, since the AI plays its turn pretty quickly anyway.
Another annoying thing I noticed is that if you leave the mouse at the border of the screen before ending your turn, the map will keep scrolling back and forth (trying to go to the action location, and then trying to scroll in the direction indicated by the mouse), until you move the mouse...Not a huge problem, but it looks messy.


I'm a beginner coder, and so far all I have been able to do is disable scrolling with the arrow keys, by overriding have_keyboard_focus() in playsingle_controller class.

Code: Select all

bool playsingle_controller::have_keyboard_focus()
{

	return (!menu_handler_.get_textbox().active() && !current_team().is_ai());

}
But I haven't found a way to disable ALL map scrolling (arrow keys, mouse, mousewheel and minimap) during AI turn, except auto-scrolling. Any idea where I should look?

Thanks for any suggestion

EDIT : display::set_view_locked(true) will not work, because it will also disable auto-scrolling, which is not what we want...

PS : same thing applies to the "upkeep" phase at the beginning of player turn, when the game automatically scrolls to units being healed or suffering from poison : map scrolling should be disabled during that phase.
Post Reply