bvschaik / julius

An open source re-implementation of Caesar III
GNU Affero General Public License v3.0
2.82k stars 315 forks source link

Copy buildings that aren't available #684

Closed 7Soul closed 1 year ago

7Soul commented 1 year ago

It is currently possible to use the copy hotkey to pick a building that isn't available on the map. I've come across this bug in a map I'm making, where I placed down a building and then used save hex editing to not allow players to build more of that building

I know this bug doesn't affect anyone else other than me but I'd like to know if it would be possible to fix it

bvschaik commented 1 year ago

How exactly are you disabling the buildings? Can you upload an example savefile?

There's already a check in the code for whether the scenario has that building enabled (source), so I'm wondering what else we would need to do.

7Soul commented 1 year ago

Here: Pilgrims-Bastion-By-7Soul.zip

I'm writing byte 0 to 0x126342 (fort) and 0x12634A (temple) in the save file

bvschaik commented 1 year ago

Thanks! I see the problem now.

The code we're using to check whether a building is allowed was originally meant for enabling/disabling the build menus using the allowed buildings from the editor; we started using it for the clone hotkey later. The buildings you're trying to disable are behind a "menu group" type such as "temples", "farms", "forts". The code currently only handles the groups, so the menu group is disabled, but the individual buildings below it are still technically enabled (see for example here for temples), which allows copying them.

This can certainly be fixed (and will be in a minute), but please note that people using an older version of Julius/Augustus will still be able to clone the building.