colobot/colobot — pull request #196 by xiendev (2013-04-28 14:12:20+00:00)
Title: Added functions "canbuild(category)" and "buildinfo(category)"

Also fixed issue with undefined behavior of build(category) function.

canbuild(category)

returns true if a player can build this category for in this mission. If category is Nuclear Plant or Tower, also checks, if they were researched, and if not, then returns false

buildinfo(category)

the same as above, but you can determine if this category is not researched, or you can't build it in this mission:
returns 0(ERR_OK) if this building can be built
returns 132 (ERR_BUILD_DISABLED) if can not build in a current mission
returns 133 (ERR_BUILD_RESEARCH) if this building needs to be researched

Also this pull request should fix issue with undefined behavior of "build(instruction)"