fix bug on how lua detect source paths
This commit is contained in:
		
							parent
							
								
									80e42b0f96
								
							
						
					
					
						commit
						f5a15939b2
					
				| 
						 | 
					@ -1,25 +1,25 @@
 | 
				
			||||||
window#enterGameWindow:
 | 
					window#enterGameWindow
 | 
				
			||||||
  title: Enter Game
 | 
					  title: Enter Game
 | 
				
			||||||
  size: [236, 178]
 | 
					  size: [236, 178]
 | 
				
			||||||
  anchors.horizontalCenter: parent.horizontalCenter
 | 
					  anchors.horizontalCenter: parent.horizontalCenter
 | 
				
			||||||
  anchors.verticalCenter: parent.verticalCenter
 | 
					  anchors.verticalCenter: parent.verticalCenter
 | 
				
			||||||
  onLoad: self.locked = true
 | 
					  onLoad: self.locked = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  label#accountNameLabel:
 | 
					  label#accountNameLabel
 | 
				
			||||||
    text: Account name
 | 
					    text: Account name
 | 
				
			||||||
    anchors.left: parent.left
 | 
					    anchors.left: parent.left
 | 
				
			||||||
    anchors.top: parent.top
 | 
					    anchors.top: parent.top
 | 
				
			||||||
    margin.left: 18
 | 
					    margin.left: 18
 | 
				
			||||||
    margin.top: 33
 | 
					    margin.top: 33
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  label#passwordLabel:
 | 
					  label#passwordLabel
 | 
				
			||||||
    text: "Password:"
 | 
					    text: "Password:"
 | 
				
			||||||
    anchors.left: parent.left
 | 
					    anchors.left: parent.left
 | 
				
			||||||
    anchors.top: parent.top
 | 
					    anchors.top: parent.top
 | 
				
			||||||
    margin.left: 18
 | 
					    margin.left: 18
 | 
				
			||||||
    margin.top: 62
 | 
					    margin.top: 62
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  label#createAccountLabel:
 | 
					  label#createAccountLabel
 | 
				
			||||||
    text: |
 | 
					    text: |
 | 
				
			||||||
      If you don't have
 | 
					      If you don't have
 | 
				
			||||||
      an account yet
 | 
					      an account yet
 | 
				
			||||||
| 
						 | 
					@ -28,7 +28,7 @@ window#enterGameWindow:
 | 
				
			||||||
    margin.left: 18
 | 
					    margin.left: 18
 | 
				
			||||||
    margin.top: 87
 | 
					    margin.top: 87
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  button#createAccountButton:
 | 
					  button#createAccountButton
 | 
				
			||||||
    text: Create Account
 | 
					    text: Create Account
 | 
				
			||||||
    anchors.left: parent.left
 | 
					    anchors.left: parent.left
 | 
				
			||||||
    anchors.top: parent.top
 | 
					    anchors.top: parent.top
 | 
				
			||||||
| 
						 | 
					@ -36,7 +36,7 @@ window#enterGameWindow:
 | 
				
			||||||
    margin.left: 132
 | 
					    margin.left: 132
 | 
				
			||||||
    onClick: messageBox("Error", "Not implemented yet")
 | 
					    onClick: messageBox("Error", "Not implemented yet")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  button#okButton:
 | 
					  button#okButton
 | 
				
			||||||
    text: Ok
 | 
					    text: Ok
 | 
				
			||||||
    size: [43, 20]
 | 
					    size: [43, 20]
 | 
				
			||||||
    anchors.right: parent.right
 | 
					    anchors.right: parent.right
 | 
				
			||||||
| 
						 | 
					@ -44,7 +44,7 @@ window#enterGameWindow:
 | 
				
			||||||
    margin.bottom: 10
 | 
					    margin.bottom: 10
 | 
				
			||||||
    margin.right: 66
 | 
					    margin.right: 66
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  button#cancelButton:
 | 
					  button#cancelButton
 | 
				
			||||||
    text: Cancel
 | 
					    text: Cancel
 | 
				
			||||||
    size: [43, 20]
 | 
					    size: [43, 20]
 | 
				
			||||||
    anchors.right: parent.right
 | 
					    anchors.right: parent.right
 | 
				
			||||||
| 
						 | 
					@ -53,13 +53,13 @@ window#enterGameWindow:
 | 
				
			||||||
    margin.right: 13
 | 
					    margin.right: 13
 | 
				
			||||||
    onClick: self.parent:destroy()
 | 
					    onClick: self.parent:destroy()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  textEdit#accountNameTextEdit:
 | 
					  textEdit#accountNameTextEdit
 | 
				
			||||||
    anchors.right: parent.right
 | 
					    anchors.right: parent.right
 | 
				
			||||||
    anchors.top: parent.top
 | 
					    anchors.top: parent.top
 | 
				
			||||||
    margin.top: 32
 | 
					    margin.top: 32
 | 
				
			||||||
    margin.right: 18
 | 
					    margin.right: 18
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  textEdit#passwordTextEdit:
 | 
					  textEdit#passwordTextEdit
 | 
				
			||||||
    anchors.right: parent.right
 | 
					    anchors.right: parent.right
 | 
				
			||||||
    anchors.top: parent.top
 | 
					    anchors.top: parent.top
 | 
				
			||||||
    margin.top: 61
 | 
					    margin.top: 61
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,11 +1,11 @@
 | 
				
			||||||
window#infoWindow:
 | 
					window#infoWindow
 | 
				
			||||||
  title: Info
 | 
					  title: Info
 | 
				
			||||||
  size: [244, 221]
 | 
					  size: [244, 221]
 | 
				
			||||||
  anchors.horizontalCenter: parent.horizontalCenter
 | 
					  anchors.horizontalCenter: parent.horizontalCenter
 | 
				
			||||||
  anchors.verticalCenter: parent.verticalCenter
 | 
					  anchors.verticalCenter: parent.verticalCenter
 | 
				
			||||||
  onLoad: self.locked = true
 | 
					  onLoad: self.locked = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  panel#infoPanel:
 | 
					  panel#infoPanel
 | 
				
			||||||
    skin: flatPanel
 | 
					    skin: flatPanel
 | 
				
			||||||
    size: [208, 129]
 | 
					    size: [208, 129]
 | 
				
			||||||
    anchors.left: parent.left
 | 
					    anchors.left: parent.left
 | 
				
			||||||
| 
						 | 
					@ -13,7 +13,7 @@ window#infoWindow:
 | 
				
			||||||
    margin.top: 32
 | 
					    margin.top: 32
 | 
				
			||||||
    margin.left: 18
 | 
					    margin.left: 18
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    label#infoLabel:
 | 
					    label#infoLabel
 | 
				
			||||||
      align: center
 | 
					      align: center
 | 
				
			||||||
      text: |-
 | 
					      text: |-
 | 
				
			||||||
        OTClient
 | 
					        OTClient
 | 
				
			||||||
| 
						 | 
					@ -23,21 +23,21 @@ window#infoWindow:
 | 
				
			||||||
      anchors.top: parent.top
 | 
					      anchors.top: parent.top
 | 
				
			||||||
      margin.top: 20
 | 
					      margin.top: 20
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    lineDecoration#bottomSeparator:
 | 
					    lineDecoration#bottomSeparator
 | 
				
			||||||
      size: [190,2]
 | 
					      size: [190, 2]
 | 
				
			||||||
      anchors.left: parent.left
 | 
					      anchors.left: parent.left
 | 
				
			||||||
      anchors.top: parent.top
 | 
					      anchors.top: parent.top
 | 
				
			||||||
      margin.top: 83
 | 
					      margin.top: 83
 | 
				
			||||||
      margin.left: 9
 | 
					      margin.left: 9
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    label#websiteLabel:
 | 
					    label#websiteLabel
 | 
				
			||||||
      text: Official Website
 | 
					      text: Official Website
 | 
				
			||||||
      anchors.left: parent.left
 | 
					      anchors.left: parent.left
 | 
				
			||||||
      anchors.bottom: parent.bottom
 | 
					      anchors.bottom: parent.bottom
 | 
				
			||||||
      margin.bottom: 14
 | 
					      margin.bottom: 14
 | 
				
			||||||
      margin.left: 9
 | 
					      margin.left: 9
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    button#websiteButton:
 | 
					    button#websiteButton
 | 
				
			||||||
      text: Github Page
 | 
					      text: Github Page
 | 
				
			||||||
      size: [80,22]
 | 
					      size: [80,22]
 | 
				
			||||||
      anchors.right: parent.right
 | 
					      anchors.right: parent.right
 | 
				
			||||||
| 
						 | 
					@ -45,7 +45,7 @@ window#infoWindow:
 | 
				
			||||||
      margin.bottom: 9
 | 
					      margin.bottom: 9
 | 
				
			||||||
      margin.right: 9
 | 
					      margin.right: 9
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  lineDecoration#bottomSeparator:
 | 
					  lineDecoration#bottomSeparator
 | 
				
			||||||
    anchors.left: parent.left
 | 
					    anchors.left: parent.left
 | 
				
			||||||
    anchors.right: parent.right
 | 
					    anchors.right: parent.right
 | 
				
			||||||
    anchors.bottom: parent.bottom
 | 
					    anchors.bottom: parent.bottom
 | 
				
			||||||
| 
						 | 
					@ -53,7 +53,7 @@ window#infoWindow:
 | 
				
			||||||
    margin.left: 13
 | 
					    margin.left: 13
 | 
				
			||||||
    margin.right: 13
 | 
					    margin.right: 13
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  button#okButton:
 | 
					  button#okButton
 | 
				
			||||||
    text: Ok
 | 
					    text: Ok
 | 
				
			||||||
    size: [43, 20]
 | 
					    size: [43, 20]
 | 
				
			||||||
    anchors.left: parent.left
 | 
					    anchors.left: parent.left
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,11 +1,11 @@
 | 
				
			||||||
panel#background:
 | 
					panel#background
 | 
				
			||||||
  skin: mainMenuBackground
 | 
					  skin: mainMenuBackground
 | 
				
			||||||
  anchors.left: parent.left
 | 
					  anchors.left: parent.left
 | 
				
			||||||
  anchors.right: parent.right
 | 
					  anchors.right: parent.right
 | 
				
			||||||
  anchors.top: parent.top
 | 
					  anchors.top: parent.top
 | 
				
			||||||
  anchors.bottom: parent.bottom
 | 
					  anchors.bottom: parent.bottom
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  panel#icos4d:
 | 
					  panel#icos4d
 | 
				
			||||||
    skin:
 | 
					    skin:
 | 
				
			||||||
      image: /skins/lightness/mouse.png
 | 
					      image: /skins/lightness/mouse.png
 | 
				
			||||||
    anchors.left: parent.left
 | 
					    anchors.left: parent.left
 | 
				
			||||||
| 
						 | 
					@ -13,7 +13,7 @@ panel#background:
 | 
				
			||||||
    margin.left: -2
 | 
					    margin.left: -2
 | 
				
			||||||
    margin.top: 70
 | 
					    margin.top: 70
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  panel#mouse:
 | 
					  panel#mouse
 | 
				
			||||||
    skin:
 | 
					    skin:
 | 
				
			||||||
      image: /skins/lightness/icos4d.png
 | 
					      image: /skins/lightness/icos4d.png
 | 
				
			||||||
    anchors.right: parent.right
 | 
					    anchors.right: parent.right
 | 
				
			||||||
| 
						 | 
					@ -21,7 +21,7 @@ panel#background:
 | 
				
			||||||
    margin.left: 60
 | 
					    margin.left: 60
 | 
				
			||||||
    margin.top: 70
 | 
					    margin.top: 70
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  panel#mainMenu:
 | 
					  panel#mainMenu
 | 
				
			||||||
    skin: roundedGridPanel
 | 
					    skin: roundedGridPanel
 | 
				
			||||||
    size: [117, 171]
 | 
					    size: [117, 171]
 | 
				
			||||||
    anchors.left: parent.left
 | 
					    anchors.left: parent.left
 | 
				
			||||||
| 
						 | 
					@ -29,35 +29,35 @@ panel#background:
 | 
				
			||||||
    margin.left: 60
 | 
					    margin.left: 60
 | 
				
			||||||
    margin.bottom: 70
 | 
					    margin.bottom: 70
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    button#enterGameButton:
 | 
					    button#enterGameButton
 | 
				
			||||||
      text: Enter Game
 | 
					      text: Enter Game
 | 
				
			||||||
      anchors.top: parent.top
 | 
					      anchors.top: parent.top
 | 
				
			||||||
      anchors.horizontalCenter: parent.horizontalCenter
 | 
					      anchors.horizontalCenter: parent.horizontalCenter
 | 
				
			||||||
      margin.top: 16
 | 
					      margin.top: 16
 | 
				
			||||||
      onClick: UI.load("entergamewindow.yml")
 | 
					      onClick: UI.load("entergamewindow.yml")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    button#accessAccountButton:
 | 
					    button#accessAccountButton
 | 
				
			||||||
      text: Access Account
 | 
					      text: Access Account
 | 
				
			||||||
      anchors.top: parent.top
 | 
					      anchors.top: parent.top
 | 
				
			||||||
      anchors.horizontalCenter: parent.horizontalCenter
 | 
					      anchors.horizontalCenter: parent.horizontalCenter
 | 
				
			||||||
      margin.top: 46
 | 
					      margin.top: 46
 | 
				
			||||||
      onClick: messageBox("Error", "Not implemented yet")
 | 
					      onClick: messageBox("Error", "Not implemented yet")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    button#optionsButton:
 | 
					    button#optionsButton
 | 
				
			||||||
      text: Options
 | 
					      text: Options
 | 
				
			||||||
      anchors.top: parent.top
 | 
					      anchors.top: parent.top
 | 
				
			||||||
      anchors.horizontalCenter: parent.horizontalCenter
 | 
					      anchors.horizontalCenter: parent.horizontalCenter
 | 
				
			||||||
      margin.top: 76
 | 
					      margin.top: 76
 | 
				
			||||||
      onClick: UI.load("optionswindow.yml")
 | 
					      onClick: UI.load("optionswindow.yml")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    button#infoButton:
 | 
					    button#infoButton
 | 
				
			||||||
      text: Info
 | 
					      text: Info
 | 
				
			||||||
      anchors.top: parent.top
 | 
					      anchors.top: parent.top
 | 
				
			||||||
      anchors.horizontalCenter: parent.horizontalCenter
 | 
					      anchors.horizontalCenter: parent.horizontalCenter
 | 
				
			||||||
      margin.top: 106
 | 
					      margin.top: 106
 | 
				
			||||||
      onClick: UI.load("infowindow.yml")
 | 
					      onClick: UI.load("infowindow.yml")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    button#exitGameButton:
 | 
					    button#exitGameButton
 | 
				
			||||||
      text: Exit
 | 
					      text: Exit
 | 
				
			||||||
      anchors.top: parent.top
 | 
					      anchors.top: parent.top
 | 
				
			||||||
      anchors.horizontalCenter: parent.horizontalCenter
 | 
					      anchors.horizontalCenter: parent.horizontalCenter
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,4 @@
 | 
				
			||||||
window#optionsWindow:
 | 
					window#optionsWindow
 | 
				
			||||||
  title: Options
 | 
					  title: Options
 | 
				
			||||||
  size: [286, 262]
 | 
					  size: [286, 262]
 | 
				
			||||||
  anchors.horizontalCenter: parent.horizontalCenter
 | 
					  anchors.horizontalCenter: parent.horizontalCenter
 | 
				
			||||||
| 
						 | 
					@ -6,14 +6,14 @@ window#optionsWindow:
 | 
				
			||||||
  onLoad: self.locked = true
 | 
					  onLoad: self.locked = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # general
 | 
					  # general
 | 
				
			||||||
  button#generalButton:
 | 
					  button#generalButton
 | 
				
			||||||
    text: General
 | 
					    text: General
 | 
				
			||||||
    anchors.left: parent.left
 | 
					    anchors.left: parent.left
 | 
				
			||||||
    anchors.top: parent.top
 | 
					    anchors.top: parent.top
 | 
				
			||||||
    margin.left: 18
 | 
					    margin.left: 18
 | 
				
			||||||
    margin.top: 32
 | 
					    margin.top: 32
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  label#generalLabel:
 | 
					  label#generalLabel
 | 
				
			||||||
    text: |-
 | 
					    text: |-
 | 
				
			||||||
      Change general
 | 
					      Change general
 | 
				
			||||||
      game options
 | 
					      game options
 | 
				
			||||||
| 
						 | 
					@ -23,14 +23,14 @@ window#optionsWindow:
 | 
				
			||||||
    margin.top: 29
 | 
					    margin.top: 29
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # graphics
 | 
					  # graphics
 | 
				
			||||||
  button#graphicsButton:
 | 
					  button#graphicsButton
 | 
				
			||||||
    text: Graphics
 | 
					    text: Graphics
 | 
				
			||||||
    anchors.left: parent.left
 | 
					    anchors.left: parent.left
 | 
				
			||||||
    anchors.top: parent.top
 | 
					    anchors.top: parent.top
 | 
				
			||||||
    margin.left: 18
 | 
					    margin.left: 18
 | 
				
			||||||
    margin.top: 65
 | 
					    margin.top: 65
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  label#graphicsLabel:
 | 
					  label#graphicsLabel
 | 
				
			||||||
    text: |-
 | 
					    text: |-
 | 
				
			||||||
      Change graphics and
 | 
					      Change graphics and
 | 
				
			||||||
      performance settings
 | 
					      performance settings
 | 
				
			||||||
| 
						 | 
					@ -40,14 +40,14 @@ window#optionsWindow:
 | 
				
			||||||
    margin.top: 62
 | 
					    margin.top: 62
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # console
 | 
					  # console
 | 
				
			||||||
  button#consoleButton:
 | 
					  button#consoleButton
 | 
				
			||||||
    text: Console
 | 
					    text: Console
 | 
				
			||||||
    anchors.left: parent.left
 | 
					    anchors.left: parent.left
 | 
				
			||||||
    anchors.top: parent.top
 | 
					    anchors.top: parent.top
 | 
				
			||||||
    margin.left: 18
 | 
					    margin.left: 18
 | 
				
			||||||
    margin.top: 98
 | 
					    margin.top: 98
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  label#consoleLabel:
 | 
					  label#consoleLabel
 | 
				
			||||||
    text: Customise the console
 | 
					    text: Customise the console
 | 
				
			||||||
    anchors.left: parent.left
 | 
					    anchors.left: parent.left
 | 
				
			||||||
    anchors.top: parent.top
 | 
					    anchors.top: parent.top
 | 
				
			||||||
| 
						 | 
					@ -55,21 +55,21 @@ window#optionsWindow:
 | 
				
			||||||
    margin.top: 95
 | 
					    margin.top: 95
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # hotkeys
 | 
					  # hotkeys
 | 
				
			||||||
  button#hotkeysButton:
 | 
					  button#hotkeysButton
 | 
				
			||||||
    text: Hotkeys
 | 
					    text: Hotkeys
 | 
				
			||||||
    anchors.left: parent.left
 | 
					    anchors.left: parent.left
 | 
				
			||||||
    anchors.top: parent.top
 | 
					    anchors.top: parent.top
 | 
				
			||||||
    margin.left: 18
 | 
					    margin.left: 18
 | 
				
			||||||
    margin.top: 131
 | 
					    margin.top: 131
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  label#hotkeysLabel:
 | 
					  label#hotkeysLabel
 | 
				
			||||||
    text: Edit your hotkey texts
 | 
					    text: Edit your hotkey texts
 | 
				
			||||||
    anchors.left: parent.left
 | 
					    anchors.left: parent.left
 | 
				
			||||||
    anchors.top: parent.top
 | 
					    anchors.top: parent.top
 | 
				
			||||||
    margin.left: 117
 | 
					    margin.left: 117
 | 
				
			||||||
    margin.top: 128
 | 
					    margin.top: 128
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  lineDecoration#middleSeparator:
 | 
					  lineDecoration#middleSeparator
 | 
				
			||||||
    anchors.left: parent.left
 | 
					    anchors.left: parent.left
 | 
				
			||||||
    anchors.right: parent.right
 | 
					    anchors.right: parent.right
 | 
				
			||||||
    anchors.bottom: parent.bottom
 | 
					    anchors.bottom: parent.bottom
 | 
				
			||||||
| 
						 | 
					@ -78,14 +78,14 @@ window#optionsWindow:
 | 
				
			||||||
    margin.right: 18
 | 
					    margin.right: 18
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # motd
 | 
					  # motd
 | 
				
			||||||
  button#motdButton:
 | 
					  button#motdButton
 | 
				
			||||||
    text: Motd
 | 
					    text: Motd
 | 
				
			||||||
    anchors.left: parent.left
 | 
					    anchors.left: parent.left
 | 
				
			||||||
    anchors.bottom: parent.bottom
 | 
					    anchors.bottom: parent.bottom
 | 
				
			||||||
    margin.left: 18
 | 
					    margin.left: 18
 | 
				
			||||||
    margin.bottom: 60
 | 
					    margin.bottom: 60
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  label#motdLabel:
 | 
					  label#motdLabel
 | 
				
			||||||
    text: |-
 | 
					    text: |-
 | 
				
			||||||
      Show the most recent
 | 
					      Show the most recent
 | 
				
			||||||
      Message of the Day
 | 
					      Message of the Day
 | 
				
			||||||
| 
						 | 
					@ -94,7 +94,7 @@ window#optionsWindow:
 | 
				
			||||||
    margin.left: 117
 | 
					    margin.left: 117
 | 
				
			||||||
    margin.bottom: 56
 | 
					    margin.bottom: 56
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  lineDecoration#bottomSeparator:
 | 
					  lineDecoration#bottomSeparator
 | 
				
			||||||
    anchors.left: parent.left
 | 
					    anchors.left: parent.left
 | 
				
			||||||
    anchors.right: parent.right
 | 
					    anchors.right: parent.right
 | 
				
			||||||
    anchors.bottom: parent.bottom
 | 
					    anchors.bottom: parent.bottom
 | 
				
			||||||
| 
						 | 
					@ -103,7 +103,7 @@ window#optionsWindow:
 | 
				
			||||||
    margin.right: 13
 | 
					    margin.right: 13
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # ok button
 | 
					  # ok button
 | 
				
			||||||
  button#okButton:
 | 
					  button#okButton
 | 
				
			||||||
    text: Ok
 | 
					    text: Ok
 | 
				
			||||||
    size: [43, 20]
 | 
					    size: [43, 20]
 | 
				
			||||||
    anchors.right: parent.right
 | 
					    anchors.right: parent.right
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -7,5 +7,5 @@ function messageBox(title, text)
 | 
				
			||||||
    msgBox.locked = true
 | 
					    msgBox.locked = true
 | 
				
			||||||
    msgBox.title = title
 | 
					    msgBox.title = title
 | 
				
			||||||
    msgBox:child("textLabel").text = text
 | 
					    msgBox:child("textLabel").text = text
 | 
				
			||||||
    msgBox:child("okButton").onClick = autoDestroyParentz
 | 
					    msgBox:child("okButton").onClick = autoDestroyParent
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -105,10 +105,11 @@ bool Resources::directoryExists(const std::string& directoryName)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool Resources::loadFile(const std::string& fileName, std::iostream& out)
 | 
					bool Resources::loadFile(const std::string& fileName, std::iostream& out)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    std::string fullPath = resolvePath(fileName);
 | 
				
			||||||
    out.clear(std::ios::goodbit);
 | 
					    out.clear(std::ios::goodbit);
 | 
				
			||||||
    PHYSFS_file *file = PHYSFS_openRead(resolvePath(fileName).c_str());
 | 
					    PHYSFS_file *file = PHYSFS_openRead(fullPath.c_str());
 | 
				
			||||||
    if(!file) {
 | 
					    if(!file) {
 | 
				
			||||||
        flogError("ERROR: Failed to load file \"%s\": %s", fileName.c_str() % PHYSFS_getLastError());
 | 
					        flogError("ERROR: Failed to load file \"%s\": %s", fullPath.c_str() % PHYSFS_getLastError());
 | 
				
			||||||
        out.clear(std::ios::failbit);
 | 
					        out.clear(std::ios::failbit);
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -379,20 +379,25 @@ void LuaScript::pushRef(int ref)
 | 
				
			||||||
    lua_rawgeti(L, LUA_REGISTRYINDEX, ref);
 | 
					    lua_rawgeti(L, LUA_REGISTRYINDEX, ref);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
std::string LuaScript::getFunctionSourcePath()
 | 
					std::string LuaScript::getFunctionSourcePath(bool functionIsOnStack, int level)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    std::string path;
 | 
					    std::string path;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    lua_Debug ar;
 | 
					    lua_Debug ar;
 | 
				
			||||||
    memset(&ar, 0, sizeof(ar));
 | 
					    memset(&ar, 0, sizeof(ar));
 | 
				
			||||||
 | 
					    if(functionIsOnStack)
 | 
				
			||||||
        lua_getinfo(L, ">Sn", &ar);
 | 
					        lua_getinfo(L, ">Sn", &ar);
 | 
				
			||||||
 | 
					    else {
 | 
				
			||||||
 | 
					        if(lua_getstack(L, level-1, &ar) == 1)
 | 
				
			||||||
 | 
					            lua_getinfo(L, "Sn", &ar);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // c function, we must get information of level above
 | 
					    // c function, we must get information of a level above
 | 
				
			||||||
    if(strcmp("C", ar.what) == 0) {
 | 
					    if(strcmp("C", ar.what) == 0) {
 | 
				
			||||||
        memset(&ar, 0, sizeof(ar));
 | 
					        memset(&ar, 0, sizeof(ar));
 | 
				
			||||||
        if(lua_getstack(L, 1, &ar) == 1) {
 | 
					        if(lua_getstack(L, level, &ar) == 1) {
 | 
				
			||||||
            lua_getinfo(L, "f", &ar);
 | 
					            lua_getinfo(L, "f", &ar);
 | 
				
			||||||
            return getFunctionSourcePath();
 | 
					            return getFunctionSourcePath(true, level+1);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
| 
						 | 
					@ -411,7 +416,7 @@ std::string LuaScript::getFunctionSourcePath()
 | 
				
			||||||
bool LuaScript::callFunction(int numArgs, int numRets)
 | 
					bool LuaScript::callFunction(int numArgs, int numRets)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    pushValue(-numArgs - 1);
 | 
					    pushValue(-numArgs - 1);
 | 
				
			||||||
    g_resources.pushCurrentPath(getFunctionSourcePath());
 | 
					    g_resources.pushCurrentPath(getFunctionSourcePath(true));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    int size = getStackSize();
 | 
					    int size = getStackSize();
 | 
				
			||||||
    int errorIndex = -numArgs - 2;
 | 
					    int errorIndex = -numArgs - 2;
 | 
				
			||||||
| 
						 | 
					@ -726,8 +731,14 @@ int LuaScript::luaFunctionCallback(lua_State* L)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    // look for function id
 | 
					    // look for function id
 | 
				
			||||||
    int id = lua_tonumber(L, lua_upvalueindex(1));
 | 
					    int id = lua_tonumber(L, lua_upvalueindex(1));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    g_resources.pushCurrentPath(g_lua.getFunctionSourcePath(false));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // call the function
 | 
					    // call the function
 | 
				
			||||||
    return (*(g_lua.m_functions[id]))();
 | 
					    int ret = (*(g_lua.m_functions[id]))();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    g_resources.popCurrentPath();
 | 
				
			||||||
 | 
					    return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int LuaScript::luaErrorHandler(lua_State *L)
 | 
					int LuaScript::luaErrorHandler(lua_State *L)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -104,7 +104,7 @@ public:
 | 
				
			||||||
    void pushValue(int index = -1);
 | 
					    void pushValue(int index = -1);
 | 
				
			||||||
    void pushRef(int ref);
 | 
					    void pushRef(int ref);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    std::string getFunctionSourcePath();
 | 
					    std::string getFunctionSourcePath(bool functionIsOnStack, int level = 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    bool callFunction(int numArgs = 0, int numRets = 0);
 | 
					    bool callFunction(int numArgs = 0, int numRets = 0);
 | 
				
			||||||
    void callModuleField(const std::string& module, const std::string& field);
 | 
					    void callModuleField(const std::string& module, const std::string& field);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -71,7 +71,7 @@ UIElementPtr UILoader::loadFromFile(std::string filePath, const UIContainerPtr&
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    std::stringstream fin;
 | 
					    std::stringstream fin;
 | 
				
			||||||
    if(!g_resources.loadFile(filePath, fin)) {
 | 
					    if(!g_resources.loadFile(filePath, fin)) {
 | 
				
			||||||
        flogError("ERROR: Could not load ui file \"%s", filePath.c_str());
 | 
					        flogError("ERROR: Could not load ui %s", filePath.c_str());
 | 
				
			||||||
        return UIElementPtr();
 | 
					        return UIElementPtr();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -106,7 +106,7 @@ UIElementPtr UILoader::loadFromFile(std::string filePath, const UIContainerPtr&
 | 
				
			||||||
        element->onLoad();
 | 
					        element->onLoad();
 | 
				
			||||||
        return element;
 | 
					        return element;
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        flogError("ERROR: Failed to load ui file \"%s\":\n  %s", filePath.c_str() % parser.getErrorMessage());
 | 
					        flogError("ERROR: Failed to load ui %s: %s", filePath.c_str() % parser.getErrorMessage());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return UIElementPtr();
 | 
					    return UIElementPtr();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue