SFTtech / openage

Free (as in freedom) open source clone of the Age of Empires II engine 🚀
http://openage.dev
Other
12.63k stars 1.11k forks source link

Villager carry resource types 'switch' #364

Closed zesterer closed 8 years ago

zesterer commented 9 years ago

I had a villager who was carry a lot of berries. When I told him to go collect gold instead, his berries miraculously turned into gold (it wasn't just an animation either - when he went back to the Town Centre, it registered it as gold resource). Either this is a bug, or you've added an alchemy feature.

TheJJ commented 9 years ago

Didn't you say in #363 that they don't carry back to the town centre? edit: ah, for gold it works.

zesterer commented 9 years ago

My villager had a lot of berries. Then, I told him to go mine gold (I never let him reach the gold mine). But his animation turned to him carrying gold, and when I finally got him to hand his resources over to the town centre, it registered what he was carrying as gold.

mirelon commented 8 years ago

I think the cause is here: https://github.com/SFTtech/openage/blob/master/libopenage/unit/action.cpp#L793 Am I right? Can I make a pull request with added condition that if the resource type is different, then the amount of harvested resource will be set to zero? (As my first contribution)

mirelon commented 8 years ago

It is fixed only for a moving villager. When a villager becomes idle, the amount magically reappears. Is the amount stored also somewhere else?

mirelon commented 8 years ago

No, the amount is correct. It is because of the wrong graphic used. When moving, there is a conditional graphic: https://github.com/SFTtech/openage/blob/master/libopenage/unit/action.cpp#L464. But when initializing IdleAction, there is no such condition: https://github.com/SFTtech/openage/blob/master/libopenage/unit/action.cpp#L368