There are a lot of issues with the town bell. For example:
- If an alert raiser is destroyed, there's no way to unring the bell, so units don't respond to new bells.
- #4656: "When a building is captured the alert is not reset. So the new owner still have its building under alert."
- D690: "When an alertRaiser is captured, its units under alert should not be controllable by the enemy."
- If units are garrisoned before ringing the bell, they aren't included in the alert so they have to be tasked back to work manually. (Often when being raided you'll garrison some women in houses at the edge of your base before ringing the bell later when the attack becomes larger. It's very easy to forget about those women for the rest of the game, and it would be nice if they returned to work at the same time as the other garrisoned units.)
- #4185: "Unit does not react to alert when ungarrisoned while alerted". (Often when the danger has passed in one area you'll ungarrison some women to go back to work, but then the next time you hit the town bell they won't respond.)
- If more units come into the area (or units are promoted), to put them under alert you have to unring the bell then ring it again.
- If units are redirected before they garrison, say to build something, when the bell is unrung they'll resume their previous orders rather than continuing to build.
Basically, it's very messy.
causative had a nice idea:
No alert status on units! This would greatly simplify the implementation and prevent bugs. Just two bells, "alert" and "safe," that you can ring at any time. When the "alert" bell is rung, all women in range try to garrison, and remember their previous task. If a woman is working and you select her and tell her to garrison or move (without using the bell), she will also remember her previous task. When the "safe" bell is rung, all women in range that are garrisoned (or garrisoning, walking, or idle) will ungarrison and return to their previous task, like the back to work command.
In this patch I've removed the alert status on units and production buildings. When you ring the bell, units will try to garrison in a building (or move to the cc if they're all full or will be full). When you unring the bell, units will ungarrison and go back to work, or stop and go back to work if they haven't garrisoned yet.
In another patch (D937) I'll do the following:
- Allow garrisoning in allied buildings
- Replace the alert level with matching classes
- Add a bell at the market for trade carts
- Change the GUI to always display two buttons: alert (garrison) and safe (back to work)
- Possibly hotkeys
I've also incorporated Stan's cleanup from D403.