[TOT] [TOTPP] v0.15 Bug Fix

Prof. Garfield

Deity
Supporter
Joined
Mar 6, 2004
Messages
4,387
Location
Ontario
Former Title: [TOTPP] IMPORTANT BUG FIX

EDIT: 4 August 2021: Version 0.16 of TOTPP comes with a civlua.lua file that incorporates all these changes. It is no longer necessary to make this change.

Action Required: The file civlua.lua in Test of Time\lua should be updated to the attached file. This is important to get correct, since most scenarios rely on the civlua.lua module in Test of Time\lua

Bug: Creating sea units on the ocean sometimes fails (and possibly sometimes land units can be created on the ocean when the code should prevent it, but that was not tested).

Reason: there is a comparison tile.terrainType == terrain.ocean in 2 places (one is actually a ~= comparison

Correction: The code should be (tile.terrainType % 16) == terrain.ocean

Also: a global variable city is created, this is switched to a local in this updated file. Pretty unlikely to cause a bug, but city is a reasonable variable name, and someone might make it global for some reason, and it could cause problems.

EDIT 4 November 2020: civ.getCosmic() replaced by civ.cosmic in updated file.

EDIT 26 February 2021: Fixed civlua.iterateTiles, which wasn't actually returning tiles.
 

Attachments

Last edited:
Updated to reflect another bug that was found. I think this only applies to the sample scenario conversion that The Nameless One provided, since calling the function in question would automatically trigger an error (it didn't look like a specific input was the problem). The function in question converts a unit name to the unit type. I know in OTR we don't use that kind of conversion, and if a scenario does, the creator might have written their own function to do it anyway.
 
Top Bottom