SpecificCityInfoDirty: Difference between revisions

From Civilization Modding Wiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 3: Line 3:
Example (from SmoothCityBanner v.2 mod):
Example (from SmoothCityBanner v.2 mod):


function OnSpecificCityInfoDirty(iPlayerID, iCityID, eUpdateType)
  function OnSpecificCityInfoDirty(iPlayerID, iCityID, eUpdateType)
    if (eUpdateType == [[Lua Game Objects/CityUpdateTypes|CityUpdateTypes]].CITY_UPDATE_TYPE_BANNER) then
      if (eUpdateType == [[Lua Game Objects/CityUpdateTypes|CityUpdateTypes]].CITY_UPDATE_TYPE_BANNER) then
        local playerTable = Instances[ iPlayerID ];
          local playerTable = Instances[ iPlayerID ];
        if playerTable == nil then
          if playerTable == nil then
            return;
              return;
        end
          end
        local instance = playerTable[ iCityID ];
          local instance = playerTable[ iCityID ];
        if instance == nil then
          if instance == nil then
            return;
              return;
        end
          end
    RefreshCityBanner(instance);
      RefreshCityBanner(instance);
    end
      end
end
  end
Events.SpecificCityInfoDirty.Add(OnSpecificCityInfoDirty);
  Events.SpecificCityInfoDirty.Add(OnSpecificCityInfoDirty);

Revision as of 06:53, 14 February 2012

Fired when something in a particular city was changed.

Example (from SmoothCityBanner v.2 mod):

 function OnSpecificCityInfoDirty(iPlayerID, iCityID, eUpdateType)
     if (eUpdateType == CityUpdateTypes.CITY_UPDATE_TYPE_BANNER) then
         local playerTable = Instances[ iPlayerID ];
         if playerTable == nil then
             return;
         end
         local instance = playerTable[ iCityID ];
         if instance == nil then
             return;
         end
     RefreshCityBanner(instance);
     end
 end
 Events.SpecificCityInfoDirty.Add(OnSpecificCityInfoDirty);