Database read incorrectly by Lua

Thalassicus

Bytes and Nibblers
Joined
Nov 9, 2005
Messages
11,057
Location
Texas
Some attributes in the database are read incorrectly when the game scans mod data for constructing Lua tables. These are the ones I can confirm from personal experience, but I suspect all boolean attributes are affected by the same bug:

Technologies -> AllowsEmbarking
Technologies -> ResearchAgreementTradingAllowed
Buildings -> Hill
Buildings -> Flat
Buildings -> Mountain
Buildings -> NearbyMountainRequired

Steps to reproduce the bug:

  1. Set ResearchAgreementTradingAllowed to false for TECH_PHILOSOPHY in a mod.
  2. Philosophy will still show on the tech tree that it allows research agreements, but the game will not enable them when the tech is researched. The bug exists in the Lua code, not the c++.

I strongly suspect this is due to the fact "false=nil" in Lua, while "false=0" in c++. My guess would be wherever a mod sets a database cell to "false" Lua doesn't read the data, since to Lua that data is essentially empty / nonexistent.
 
Top Bottom