App Class
Add patient costs inflation
Method Index
- _checkOrFind(test_file, campaign_dir)
- _loadLevel(level, difficulty, level_name, level_file, level_intro, map_editor, campaign_info)
- abandon()
- afterLoad()
- checkCompatibility(save_version, gfx_set)
- checkForUpdates()
- checkInstallFolder()
- checkMissingStringsInLanguage(dir, language)
- compareVersions(version_a, version_b, method)
- dispatch(evt_type, ...)
- drawFrame()
- dumpStrings()
- errorHandler(last_dispatch_type, st)
- exit()
- findFileInDirs(search_paths, filename)
- findSoundFont()
- finishVideoUpdate()
- fixConfig()
- fixHotkeys()
- gamelogHeader()
- getBitmapDir()
- getConfigPath()
- getCurrentVersion()
- getDefaultSavegameDir()
- getDefaultScreenshotsDir()
- getFPS()
- getFullPath(folders, trailing_slash)
- getReleaseData(savegame_version)
- getReleaseString(savegame_version)
- getVideoOptions(overrides)
- idle()
- init()
- initGamelogFile()
- initLanguage()
- initMusicDir()
- initSavegameDir()
- initScreenshotsDir()
- initUserDirectories()
- isThemeHospitalPath(path)
- isUpdateCheckAvailable()
- isUpdateCheckDisabledByConfig()
- load(filepath)
- loadCampaign(campaign_file)
- loadLevel(level, difficulty, level_name, level_file, level_intro, map_editor, error_prefix, campaign_info)
- loadLuaFolder(dir, no_results, append_to)
- loadMainMenu(message)
- mapEdit()
- onEditingText(...)
- onKeyDown(...)
- onKeyUp(...)
- onMouseDown(...)
- onMouseMove(...)
- onMouseUp(...)
- onMouseWheel(...)
- onMovieOver(...)
- onMusicOver(...)
- onPinchBegin(...)
- onPinchEnd(...)
- onPinchUpdate(...)
- onSoundOver(...)
- onTextInput(...)
- onTick(...)
- onWindowActive(...)
- onWindowDisplayScaleChanged(...)
- onWindowMaximised(...)
- onWindowPixelSizeChanged(...)
- onWindowResized(...)
- onWindowRestored(...)
- prepareVideoUpdate()
- quickLoad()
- quickSave()
- readBitmapDataFile(filename)
- readCampaignFile(campaign_file)
- readDataFile(dir, filename)
- readLevelFile(level, campaign_dir)
- readMapDataFile(path)
- reset()
- resetIdle()
- restart(message)
- save(filename)
- saveConfig()
- saveHotkeys()
- setCaptureMouse()
- setCommandLine(...)
- startTextInput()
- stopTextInput()
- trimLogs()
- worldExited()
- writeToFileOrTmp(file, mode)
Member Index
- animation_manager
- anims
- audio
- campaign_dir
- caption
- check_for_updates
- command_line
- config
- diseases
- eventHandlers
- fs
- gamelog_path
- gfx
- good_install_folder
- hotkeys
- humanoid_actions
- idle_tick
- key_modifiers
- level_dir
- map
- modes
- moviePlayer
- objects
- os
- rooms
- runtime_config
- savegame_dir
- savegame_version
- screenshot_dir
- strings
- ui
- user_campaign_dir
- user_level_dir
- user_log_dir
- using_demo_files
- video
- walls
- window_active_status
- world
function App:App()
Declared on: line 41 of Lua/app.lua.
function App:_checkOrFind(test_file, campaign_dir)
Check that a file at a full path exists, or find it, or expand filename to full paths
Parameters:
| Name | Type | Description |
|---|---|---|
| test_file | string | A full path or a filename of a level or map file |
| campaign_dir | ? | ? |
Declared on: line 1914 of Lua/app.lua.
function App:_loadLevel(level, difficulty, level_name, level_file, level_intro, map_editor, campaign_info)
Private Function to load the level. Call via App:loadLevel(...)
Loads the specified level.
Parameters:
| Name | Type | Description |
|---|---|---|
| level | string | Full path of a custom level, name of a TH level, or nil for mapeditor |
| difficulty | string | One of "easy, full, hard", or nil for custom levels |
| level_name | string | Display name of the level |
| level_file | string | Full path of a custom map, name of a TH level, or nil for TH campaign or mapeditor |
| level_intro | string | Introduction text displayed to the player |
| map_editor | boolean | True for opening the map editor |
| campaign_info | table or of or strings | Information about campaign in case loading level is a part of a campaign. if not part of a campaign then campaign_info is nil. |
Declared on: line 898 of Lua/app.lua.
function App:abandon()
Exits the game completely without saving the config i.e. Alt+F4 for Quit Application
Declared on: line 1996 of Lua/app.lua.
function App:afterLoad()
This function is automatically called after loading a game and serves for compatibility.
Declared on: line 2006 of Lua/app.lua.
function App:checkCompatibility(save_version, gfx_set)
Function to check the loaded game is compatible with the program
Parameters:
| Name | Type | Description |
|---|---|---|
| save_version | num | |
| gfx_set | string | What graphics set is used |
Declared on: line 1889 of Lua/app.lua.
function App:checkForUpdates()
that any current version with a patch in its name (Beta, RC, etc) will be older
than the update table's version if their major, minor, and revision components match.
Declared on: line 2072 of Lua/app.lua.
function App:checkInstallFolder()
Declared on: line 1450 of Lua/app.lua.
function App:checkMissingStringsInLanguage(dir, language)
Compares strings provided by language file of given language WITHOUT inheritance
with strings provided by english language with inheritance (i.e. all strings).
This will give translators an idea which strings are missing in their translation.
Parameters:
| Name | Type | Description |
|---|---|---|
| dir | ? | The directory where the file to write to should be. |
| language | ? | The language to check against. |
Declared on: line 1048 of Lua/app.lua.
function App:compareVersions(version_a, version_b, method)
Reports a difference between two versions based on requested methodology.
Parameters:
| Name | Type | Description |
|---|---|---|
| version_a | number or or or table | The first (usually newer) version to test |
| version_b | number or or or table | The second (usually older) version to test |
| method | string | What method to compare by - method(release) reports the difference between the matching releases in steps, - revisions are not counted. - For development builds it will use the base release it started from when using - the release method - method(version) reports the difference between two savegame versions |
Declared on: line 1810 of Lua/app.lua.
function App:dispatch(evt_type, ...)
Parameters:
| Name | Type | Description |
|---|---|---|
| evt_type | ? | ? |
| ... | ? | ? |
Declared on: line 1269 of Lua/app.lua.
function App:drawFrame()
Used to loop through fps_history when [over]writing
Declared on: line 1320 of Lua/app.lua.
function App:dumpStrings()
This is a useful debug and development aid
Declared on: line 964 of Lua/app.lua.
function App:errorHandler(last_dispatch_type, st)
Parameters:
| Name | Type | Description |
|---|---|---|
| last_dispatch_type | ? | ? |
| st | ? | ? |
Declared on: line 1222 of Lua/app.lua.
function App:exit()
Exits the game completely (no confirmation window)
Declared on: line 1988 of Lua/app.lua.
function App:findFileInDirs(search_paths, filename)
Searches in the given folders for the given filename
Parameters:
| Name | Type | Description |
|---|---|---|
| search_paths | table | List of folders (strings) to look through |
| filename | string | Filename to search for. |
Declared on: line 865 of Lua/app.lua.
function App:findSoundFont()
Declared on: line 1589 of Lua/app.lua.
function App:finishVideoUpdate()
Update / start any resources relying on a video object
Declared on: line 2165 of Lua/app.lua.
function App:fixConfig()
Declared on: line 1116 of Lua/app.lua.
function App:fixHotkeys()
Declared on: line 1204 of Lua/app.lua.
function App:gamelogHeader()
Generate information about user's system and the program
Declared on: line 2194 of Lua/app.lua.
function App:getBitmapDir()
Get the directory containing the bitmap files.
Declared on: line 1611 of Lua/app.lua.
function App:getConfigPath()
Declared on: line 448 of Lua/app.lua.
function App:getCurrentVersion()
Retrieve the current savegame version as defined in the application.
Declared on: line 1768 of Lua/app.lua.
function App:getDefaultSavegameDir()
Declared on: line 457 of Lua/app.lua.
function App:getFPS()
Declared on: line 1341 of Lua/app.lua.
function App:getFullPath(folders, trailing_slash)
Returns the full path of the local path given
Parameters:
| Name | Type | Description |
|---|---|---|
| folders | string or or or table | A string of one segment or an set of many segments of the path |
| trailing_slash | boolean | Whether the path needs to end with a local path separator |
Declared on: line 89 of Lua/app.lua.
function App:getReleaseData(savegame_version)
Requests data regarding a given savegame version
Parameters:
| Name | Type | Description |
|---|---|---|
| savegame_version | number | What to lookup, uses application version if blank |
Declared on: line 1773 of Lua/app.lua.
function App:getReleaseString(savegame_version)
Provides the release (or development) string for a given savegame version
For development builds, the savegame version is appended as a patch e.g. 'dev213'
Parameters:
| Name | Type | Description |
|---|---|---|
| savegame_version | number | The version to look up |
Declared on: line 1798 of Lua/app.lua.
function App:getVideoOptions(overrides)
Parameters:
| Name | Type | Description |
|---|---|---|
| overrides | ? | ? |
Declared on: line 2181 of Lua/app.lua.
function App:idle()
Function for handling idle time in the main menu, which leads to playing the
demo gameplay trailer if left long enough
Declared on: line 1292 of Lua/app.lua.
function App:init()
Declared on: line 99 of Lua/app.lua.
function App:initGamelogFile()
Create the gamelog, using the launch time in the filename, and write the system information.
Declared on: line 424 of Lua/app.lua.
function App:initLanguage()
Initialises the application's language based on the player's choice.
Declared on: line 615 of Lua/app.lua.
function App:initMusicDir()
Declared on: line 533 of Lua/app.lua.
function App:initSavegameDir()
Tries to initialize the savegame directory, returns true on success and
false on failure.
Declared on: line 493 of Lua/app.lua.
function App:initScreenshotsDir()
Declared on: line 514 of Lua/app.lua.
function App:initUserDirectories()
Tries to initialize the user level and campaign directories
TODO: Integrate other directory initialisations into this function
Declared on: line 462 of Lua/app.lua.
function App:isThemeHospitalPath(path)
Parameters:
| Name | Type | Description |
|---|---|---|
| path | ? | ? |
Declared on: line 1435 of Lua/app.lua.
function App:load(filepath)
Parameters:
| Name | Type | Description |
|---|---|---|
| filepath | ? | ? |
Declared on: line 1871 of Lua/app.lua.
function App:loadCampaign(campaign_file)
Loads the first level of the specified campaign and prepares the world
to be able to progress through that campaign.
Parameters:
| Name | Type | Description |
|---|---|---|
| campaign_file | string | Full path of a CorsixTH Campaign definition Lua file. |
Declared on: line 751 of Lua/app.lua.
function App:loadLevel(level, difficulty, level_name, level_file, level_intro, map_editor, error_prefix, campaign_info)
error to the player
return (boolean) The outcome of the pcall
Parameters:
| Name | Type | Description |
|---|---|---|
| level | ? | ? |
| difficulty | ? | ? |
| level_name | ? | ? |
| level_file | ? | ? |
| level_intro | ? | ? |
| map_editor | ? | ? |
| error_prefix | string | (Optional) Prefixes the error relevant to what was loaded |
| campaign_info | ? | ? |
Declared on: line 880 of Lua/app.lua.
function App:loadLuaFolder(dir, no_results, append_to)
Parameters:
| Name | Type | Description |
|---|---|---|
| dir | ? | ? |
| no_results | ? | ? |
| append_to | ? | ? |
Declared on: line 1683 of Lua/app.lua.
function App:loadMainMenu(message)
Initialise CorsixTH's main menu screen including relevant windows
Parameters:
| Name | Type | Description |
|---|---|---|
| message | string | Something to display to the user |
Declared on: line 705 of Lua/app.lua.
function App:mapEdit()
Begin the map editor
Declared on: line 1983 of Lua/app.lua.
function App:onEditingText(...)
Parameters:
| Name | Type | Description |
|---|---|---|
| ... | ? | ? |
Declared on: line 1355 of Lua/app.lua.
function App:onKeyDown(...)
Parameters:
| Name | Type | Description |
|---|---|---|
| ... | ? | ? |
Declared on: line 1347 of Lua/app.lua.
function App:onKeyUp(...)
Parameters:
| Name | Type | Description |
|---|---|---|
| ... | ? | ? |
Declared on: line 1351 of Lua/app.lua.
function App:onMouseDown(...)
Parameters:
| Name | Type | Description |
|---|---|---|
| ... | ? | ? |
Declared on: line 1367 of Lua/app.lua.
function App:onMouseMove(...)
Parameters:
| Name | Type | Description |
|---|---|---|
| ... | ? | ? |
Declared on: line 1371 of Lua/app.lua.
function App:onMouseUp(...)
Parameters:
| Name | Type | Description |
|---|---|---|
| ... | ? | ? |
Declared on: line 1363 of Lua/app.lua.
function App:onMouseWheel(...)
Parameters:
| Name | Type | Description |
|---|---|---|
| ... | ? | ? |
Declared on: line 1375 of Lua/app.lua.
function App:onMovieOver(...)
Parameters:
| Name | Type | Description |
|---|---|---|
| ... | ? | ? |
Declared on: line 1415 of Lua/app.lua.
function App:onMusicOver(...)
Parameters:
| Name | Type | Description |
|---|---|---|
| ... | ? | ? |
Declared on: line 1411 of Lua/app.lua.
function App:onPinchBegin(...)
Parameters:
| Name | Type | Description |
|---|---|---|
| ... | ? | ? |
Declared on: line 1423 of Lua/app.lua.
function App:onPinchEnd(...)
Parameters:
| Name | Type | Description |
|---|---|---|
| ... | ? | ? |
Declared on: line 1431 of Lua/app.lua.
function App:onPinchUpdate(...)
Parameters:
| Name | Type | Description |
|---|---|---|
| ... | ? | ? |
Declared on: line 1427 of Lua/app.lua.
function App:onSoundOver(...)
Parameters:
| Name | Type | Description |
|---|---|---|
| ... | ? | ? |
Declared on: line 1419 of Lua/app.lua.
function App:onTextInput(...)
Parameters:
| Name | Type | Description |
|---|---|---|
| ... | ? | ? |
Declared on: line 1359 of Lua/app.lua.
function App:onTick(...)
Parameters:
| Name | Type | Description |
|---|---|---|
| ... | ? | ? |
Declared on: line 1282 of Lua/app.lua.
function App:onWindowActive(...)
Parameters:
| Name | Type | Description |
|---|---|---|
| ... | ? | ? |
Declared on: line 1379 of Lua/app.lua.
function App:onWindowDisplayScaleChanged(...)
Parameters:
| Name | Type | Description |
|---|---|---|
| ... | ? | ? |
Declared on: line 1395 of Lua/app.lua.
function App:onWindowMaximised(...)
Window has been maximize by the user
Call the UI to report the new window mode
Parameters:
| Name | Type | Description |
|---|---|---|
| ... | ? | ? |
Declared on: line 1399 of Lua/app.lua.
function App:onWindowPixelSizeChanged(...)
Render size has changed
Call the UI to adjust to the new render size
Parameters:
| Name | Type | Description |
|---|---|---|
| ... | ? | ? |
Declared on: line 1389 of Lua/app.lua.
function App:onWindowResized(...)
Window has been resized by the user
Call the UI to report the new window size
Parameters:
| Name | Type | Description |
|---|---|---|
| ... | ? | ? |
Declared on: line 1383 of Lua/app.lua.
function App:onWindowRestored(...)
Window has been restored (remove maximize/minimize) by the user
Call the UI to report the new window mode
Parameters:
| Name | Type | Description |
|---|---|---|
| ... | ? | ? |
Declared on: line 1405 of Lua/app.lua.
function App:prepareVideoUpdate()
Free up / stop any resources relying on the current video object
Declared on: line 2159 of Lua/app.lua.
function App:quickLoad()
Declared on: line 1879 of Lua/app.lua.
function App:quickSave()
Omit the usual file extension so this file cannot be seen from the normal load and save screen and cannot be overwritten
Declared on: line 1865 of Lua/app.lua.
function App:readBitmapDataFile(filename)
Load bitmap data into memory.
Parameters:
| Name | Type | Description |
|---|---|---|
| filename | ? | Name of the file to load. |
Declared on: line 1618 of Lua/app.lua.
function App:readCampaignFile(campaign_file)
Reads the given file name as a Lua chunk from the Campaign folders
A correct campaign definition contains "name", "description", "levels", and "winning_text".
Parameters:
| Name | Type | Description |
|---|---|---|
| campaign_file | string | Full path of the file to read. |
Declared on: line 795 of Lua/app.lua.
function App:readDataFile(dir, filename)
Read a data file of the application into memory (possibly with decompression).
Parameters:
| Name | Type | Description |
|---|---|---|
| dir | string | Directory to read from. "Bitmap" and "Levels" are meta-directories, and get resolved to real directories in the function. |
| filename | string or or or nil | If specified, the file to load. If 'nil', the 'dir' parameter is the filename in the "Data" directory. |
Declared on: line 1632 of Lua/app.lua.
function App:readLevelFile(level, campaign_dir)
Opens the given file name and returns all Level definitions in a table.
Values in the returned table: "path", "level_file", "name", "map_file", "briefing", and "end_praise".
Parameters:
| Name | Type | Description |
|---|---|---|
| level | string | Full path or name of the file to read. |
| campaign_dir | string | Folder of the parent campaign file |
Declared on: line 810 of Lua/app.lua.
function App:readMapDataFile(path)
Get a level file.
Parameters:
| Name | Type | Description |
|---|---|---|
| path | string | Full path of the level file, or a Theme Hospital level filename |
Declared on: line 1654 of Lua/app.lua.
function App:reset()
Declared on: line 2001 of Lua/app.lua.
function App:resetIdle()
Reset the idle count
Declared on: line 1312 of Lua/app.lua.
function App:restart(message)
Restarts the current level (offers confirmation window first)
Parameters:
| Name | Type | Description |
|---|---|---|
| message | string | Optional message to the player |
Declared on: line 1955 of Lua/app.lua.
function App:save(filename)
Parameters:
| Name | Type | Description |
|---|---|---|
| filename | ? | ? |
Declared on: line 1861 of Lua/app.lua.
function App:saveConfig()
Declared on: line 1180 of Lua/app.lua.
function App:saveHotkeys()
Declared on: line 1216 of Lua/app.lua.
function App:setCaptureMouse()
Sets the mouse capture to the state set within
app.config.capture_mouse
Declared on: line 737 of Lua/app.lua.
function App:setCommandLine(...)
Parameters:
| Name | Type | Description |
|---|---|---|
| ... | ? | ? |
Declared on: line 79 of Lua/app.lua.
function App:startTextInput()
Declared on: line 743 of Lua/app.lua.
function App:stopTextInput()
Declared on: line 747 of Lua/app.lua.
function App:trimLogs()
Trims the logs folder of old game logs down to ten files.
Declared on: line 434 of Lua/app.lua.
function App:worldExited()
Declared on: line 701 of Lua/app.lua.
function App:writeToFileOrTmp(file, mode)
Tries to open the given file or a file in OS's temp dir.
Returns the file handler, and true if it was written to the intended file.
Parameters:
| Name | Type | Description |
|---|---|---|
| file | ? | The full path of the intended file |
| mode | ? | The mode in which the file is opened, defaults to write |
Declared on: line 1185 of Lua/app.lua.