From cabe09e4508082b09e3548a9a0ec6f3ad0196e85 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Tue, 25 Jun 2013 23:57:23 +0200 Subject: [PATCH] Fix Ryzom Client scripts for lua 5.2 --- .../data/gamedev/interfaces_v3/bg_downloader.lua | 2 +- .../data/gamedev/interfaces_v3/game_r2_loading.lua | 2 +- .../client/data/gamedev/interfaces_v3/interaction.lua | 2 +- .../data/gamedev/interfaces_v3/out_v2_appear.lua | 2 +- .../client/data/gamedev/interfaces_v3/outpost.lua | 10 +++++----- .../ryzom/client/data/gamedev/interfaces_v3/player.lua | 4 ++-- .../data/gamedev/interfaces_v3/ring_access_point.lua | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/bg_downloader.lua b/code/ryzom/client/data/gamedev/interfaces_v3/bg_downloader.lua index 686e21b6c..c2569b301 100644 --- a/code/ryzom/client/data/gamedev/interfaces_v3/bg_downloader.lua +++ b/code/ryzom/client/data/gamedev/interfaces_v3/bg_downloader.lua @@ -84,7 +84,7 @@ function bgdownloader:setPatchProgress(progress) self:getPrioCB().active = true local progressPercentText = string.format("%d%%", 100 * progress) - local progressPostfix = math.mod(os.time(), 3) + local progressPostfix = math.fmod(os.time(), 3) local progressDate = nltime.getLocalTime() / 500 local colValue = math.floor(230 + 24 * math.sin(progressDate)) local color = string.format("%d %d %d %d", colValue, colValue, colValue, 255) diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/game_r2_loading.lua b/code/ryzom/client/data/gamedev/interfaces_v3/game_r2_loading.lua index dd3af3c88..33a3810d3 100644 --- a/code/ryzom/client/data/gamedev/interfaces_v3/game_r2_loading.lua +++ b/code/ryzom/client/data/gamedev/interfaces_v3/game_r2_loading.lua @@ -521,7 +521,7 @@ function GameR2Loading:validateLoading() local filename = GameR2Loading.CurrentFile - if string.find(filename, '\.r2', -3) == nil then + if string.find(filename, '.r2', -3) == nil then messageBox(i18n.get("uiR2EDLoadScenario_InvalidFileName")) return end diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/interaction.lua b/code/ryzom/client/data/gamedev/interfaces_v3/interaction.lua index 07d081874..d36486e99 100644 --- a/code/ryzom/client/data/gamedev/interfaces_v3/interaction.lua +++ b/code/ryzom/client/data/gamedev/interfaces_v3/interaction.lua @@ -131,7 +131,7 @@ local function levelToForceRegion(level) end local function levelToLevelForce(level) - return math.floor(math.mod(level, 50) * 5 / 50) + 1 + return math.floor(math.fmod(level, 50) * 5 / 50) + 1 end diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/out_v2_appear.lua b/code/ryzom/client/data/gamedev/interfaces_v3/out_v2_appear.lua index c082f9c00..3754b6b76 100644 --- a/code/ryzom/client/data/gamedev/interfaces_v3/out_v2_appear.lua +++ b/code/ryzom/client/data/gamedev/interfaces_v3/out_v2_appear.lua @@ -135,7 +135,7 @@ end --function outgame:setPatchProgress(progress) -- --debugInfo("*** 3 ***") -- local progressPercentText = string.format("%d%%", 100 * progress) --- local progressPostfix = math.mod(os.time(), 3) +-- local progressPostfix = math.fmod(os.time(), 3) -- --debugInfo("Patch in progress : " .. tostring(progress)) -- local progressDate = nltime.getLocalTime() / 500 -- local colValue = math.floor(230 + 24 * math.sin(progressDate)) diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/outpost.lua b/code/ryzom/client/data/gamedev/interfaces_v3/outpost.lua index e015cdf7e..1036148a0 100644 --- a/code/ryzom/client/data/gamedev/interfaces_v3/outpost.lua +++ b/code/ryzom/client/data/gamedev/interfaces_v3/outpost.lua @@ -56,7 +56,7 @@ function game:outpostAdjustHour(uiLocal, prop) local h = runExpr(prop); -- add time zone and clamp hour - h = math.mod(h + tz + 24, 24); + h = math.fmod(h + tz + 24, 24); uiGroup[uiLocal].uc_hardtext = string.format('%02d:00', h); end @@ -288,8 +288,8 @@ function game:outpostActiveDefenderHourButton() local timeRangeDef= getDbProp(path .. ':TIME_RANGE_DEF'); local timeRangeDefWanted= getDbProp(path .. ':TIME_RANGE_DEF_WANTED'); timeRangeDef= secondsSince1970ToHour( timeRangeDef ); - timeRangeDef= math.mod(timeRangeDef+24, 24); - timeRangeDefWanted= math.mod(timeRangeDefWanted+24, 24); + timeRangeDef= math.fmod(timeRangeDef+24, 24); + timeRangeDefWanted= math.fmod(timeRangeDefWanted+24, 24); -- if time required is the one obtained, or if we are in peace if( timeRangeDef == timeRangeDefWanted or status<=game.OutpostEnums.Peace ) then @@ -323,8 +323,8 @@ function game:outpostActiveAttackerHourButton() local timeRangeAtt= getDbProp('UI:TEMP:OUTPOST:DECLARE_WAR_ACK_TIME_RANGE_ATT'); local timeRangeAttWanted= getDbProp('UI:TEMP:OUTPOST:DECLARE_WAR_ATTACK_PERIOD'); timeRangeAtt= secondsSince1970ToHour( timeRangeAtt ); - timeRangeAtt= math.mod(timeRangeAtt+24, 24); - timeRangeAttWanted= math.mod(timeRangeAttWanted+24, 24); + timeRangeAtt= math.fmod(timeRangeAtt+24, 24); + timeRangeAttWanted= math.fmod(timeRangeAttWanted+24, 24); -- if time required is the one obtained if( timeRangeAtt == timeRangeAttWanted ) then diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/player.lua b/code/ryzom/client/data/gamedev/interfaces_v3/player.lua index c1abe7b22..062f09690 100644 --- a/code/ryzom/client/data/gamedev/interfaces_v3/player.lua +++ b/code/ryzom/client/data/gamedev/interfaces_v3/player.lua @@ -803,8 +803,8 @@ end function game:timeInSecondsToReadableTime(regenTime) - local seconds = math.mod(regenTime, 60) - local minutes = math.mod(math.floor(regenTime / 60), 60) + local seconds = math.fmod(regenTime, 60) + local minutes = math.fmod(math.floor(regenTime / 60), 60) local hours = math.floor(regenTime / 3600) local result = "" if seconds > 0 then result = concatUCString(tostring(seconds), i18n.get("uittSecondsShort")) end diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/ring_access_point.lua b/code/ryzom/client/data/gamedev/interfaces_v3/ring_access_point.lua index d07f5abee..ca04561f1 100644 --- a/code/ryzom/client/data/gamedev/interfaces_v3/ring_access_point.lua +++ b/code/ryzom/client/data/gamedev/interfaces_v3/ring_access_point.lua @@ -904,7 +904,7 @@ function RingAccessPoint:onDraw() self.LastRefreshTime = nltime.getLocalTime() / 1000 --self:getWindow():find("refreshText").active = false else - local waitText = i18n.get("uiRAP_WaitMsg" .. math.mod(os.time(), 3)) + local waitText = i18n.get("uiRAP_WaitMsg" .. math.fmod(os.time(), 3)) self:setInfoMessage(waitText) --local refreshText = self:getWindow():find("refreshText") --if not self.ListReceived then