1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-06-24 06:03:28 +00:00

Fix several global definitions

There were a couple of programs which were defining global variables, or
referencing undefined ones. This fixes all problems in the main rom files.
This commit is contained in:
SquidDev 2017-07-08 11:31:30 +00:00
parent 1ab5094b7f
commit e664eb26a9
8 changed files with 16 additions and 22 deletions

View File

@ -62,7 +62,7 @@ function drawLine( startX, startY, endX, endY, nColour )
return
end
local minX = math.min( startX, endX )
local minX, maxX, minY, maxY = math.min( startX, endX )
if minX == startX then
minY = startY
maxX = endX
@ -122,7 +122,7 @@ function drawBox( startX, startY, endX, endY, nColour )
return
end
local minX = math.min( startX, endX )
local minX, maxX, minY, maxY = math.min( startX, endX )
if minX == startX then
minY = startY
maxX = endX
@ -166,7 +166,7 @@ function drawFilledBox( startX, startY, endX, endY, nColour )
return
end
local minX = math.min( startX, endX )
local minX, maxX, minY, maxY = math.min( startX, endX )
if minX == startX then
minY = startY
maxX = endX

View File

@ -210,7 +210,7 @@ function multishell.getCurrent()
end
function multishell.launch( tProgramEnv, sProgramPath, ... )
if type( tProgramArgs ) ~= "table" then
if type( tProgramEnv ) ~= "table" then
error( "bad argument #1 (expected table, got " .. type( tProgramEnv ) .. ")", 2 )
end
if type( sProgramPath ) ~= "string" then
@ -264,7 +264,7 @@ while #tProcesses > 0 do
-- Switch process
local tabStart = 1
for n=1,#tProcesses do
tabEnd = tabStart + string.len( tProcesses[n].sTitle ) + 1
local tabEnd = tabStart + string.len( tProcesses[n].sTitle ) + 1
if x >= tabStart and x <= tabEnd then
selectProcess( n )
redrawMenu()

View File

@ -197,7 +197,7 @@ local function loadLevel(nNum)
fLevel = fs.open(sLevelD,"r")
fLevel.readLine()
for Line=2,Lines-1 do
sLine = fLevel.readLine()
local sLine = fLevel.readLine()
local chars = string.len(sLine)
for char = 1, chars do
local el = string.sub(sLine,char,char)
@ -313,7 +313,7 @@ local function drawMap()
term.setBackgroundColor(cG)
term.setCursorPos(XOrgin+x,YOrgin+y+1)
sSide = string.sub(st,1,1)
local sSide = string.sub(st,1,1)
if sSide == "a" then
print("^")
elseif sSide == "b" then
@ -348,7 +348,7 @@ local function drawMap()
term.setBackgroundColor(Cr)
term.setTextColor(colors.white)
term.setCursorPos(XOrgin+x,YOrgin+y+1)
sSide = string.sub(rb,1,1)
local sSide = string.sub(rb,1,1)
if sSide == "a" then
print("^")
elseif sSide == "b" then

View File

@ -276,7 +276,6 @@ local tMonsters = {
local tRecipes = {
["some planks"] = { "some wood" },
["some sticks"] = { "some planks" },
["some sticks"] = { "some planks" },
["a crafting table"] = { "some planks" },
["a furnace"] = { "some stone" },
["some torches"] = { "some sticks", "some coal" },
@ -753,7 +752,6 @@ function commands.dig( _sDir, _sTool )
tTool = inventory[ sTool ]
end
local room = getRoom( x, y, z )
local bActuallyDigging = (room.exits[ _sDir ] ~= true)
if bActuallyDigging then
if sTool == nil or tTool.toolType ~= "pick" then

View File

@ -87,11 +87,6 @@ elseif sCommand == "host" then
end
end
end
-- Close the channel
print( "Closing channel" )
modem.close( gps.CHANNEL_GPS )
else
-- "gps somethingelse"
-- Error

View File

@ -1,4 +1,5 @@
local tArgs = { ... }
local sTopic
if #tArgs > 0 then
sTopic = tArgs[1]
else

View File

@ -473,7 +473,7 @@ local function playGame()
if testBlockAt(curBlock,curX,curY+1,curRot) then
pitBlock(curBlock,curX,curY,curRot)
--detect rows that clear
clearRows(rows)
clearRows()
curBlock=next
curX=4

View File

@ -58,7 +58,7 @@ if sCommand == "host" then
local tUsers = {}
local nUsers = 0
function send( sText, nUserID )
local function send( sText, nUserID )
if nUserID then
local tUser = tUsers[ nUserID ]
if tUser then
@ -81,7 +81,7 @@ if sCommand == "host" then
-- Setup ping pong
local tPingPongTimer = {}
function ping( nUserID )
local function ping( nUserID )
local tUser = tUsers[ nUserID ]
rednet.send( tUser.nID, {
sType = "ping to client",
@ -93,7 +93,7 @@ if sCommand == "host" then
tPingPongTimer[ timer ] = nUserID
end
function printUsers()
local function printUsers()
local x,y = term.getCursorPos()
term.setCursorPos( 1, y - 1 )
term.clearLine()
@ -274,7 +274,7 @@ elseif sCommand == "join" then
local bPingPonged = true
local pingPongTimer = os.startTimer( 0 )
function ping()
local function ping()
rednet.send( nHostID, {
sType = "ping to server",
nUserID = nUserID,
@ -296,7 +296,7 @@ elseif sCommand == "join" then
term.redirect( promptWindow )
promptWindow.restoreCursor()
function drawTitle()
local function drawTitle()
local x,y = titleWindow.getCursorPos()
local w,h = titleWindow.getSize()
local sTitle = sUsername.." on "..sHostname
@ -307,7 +307,7 @@ elseif sCommand == "join" then
promptWindow.restoreCursor()
end
function printMessage( sMessage )
local function printMessage( sMessage )
term.redirect( historyWindow )
print()
if string.match( sMessage, "^%*" ) then