the farm lvl plays a role too.
higher farm lvl and the more fertile the land = more food production and more turns to hold out on a siege.

and i agree with aplaca that this is hardcoded