henricj / dunelegacy

GNU General Public License v2.0
27 stars 5 forks source link

Allow to stop repair #10

Open tbertels opened 2 years ago

tbertels commented 2 years ago

The original Dune 2 allowed to stop a building repair by just clicking again on the button.

tbertels commented 2 years ago

The repair toggle mechanic seems pretty straightforward: https://github.com/henricj/dunelegacy/blob/2b959e8498bf0c51ca0019153f6d7f75e3781a81/src/structures/StructureBase.cpp#L260

But about the interface button toggle, how can we set bToggleState to false?

https://github.com/henricj/dunelegacy/blob/18c4cd5953ebbbd7f3f357c31fe2f377487ac4d3/include/GUI/ObjectInterfaces/DefaultStructureInterface.h#L39

https://github.com/henricj/dunelegacy/blob/9d75643898ed37ebf9d7c3139ae91aba6a0bfdb0/include/GUI/Button.h#L194

henricj commented 2 years ago

A command to stop the repair would need to be added: https://github.com/henricj/dunelegacy/blob/06acb1ef6061018f8e82fbbfa79dddbc0a15ef5c/include/Command.h#L29-L56 If a new move/attack command doesn't abort a pending CMD_UNIT_SENDTOREPAIR, then that should probably be looked at too.