Skip to content

Commit

Permalink
Large update with lots of minor cleanups. Updated PopDownConsole to w…
Browse files Browse the repository at this point in the history
…ork with all resolutions [untetsted]. Restored pause, escape, help, etc. menus.

Updated preferences LuaBind registry.

Simplified some functions in KeyboardControl.lua to use for loops instead of while loops. Added some documentation to KeyboardControl.lua.

Fixed pointer drawing when on top of the panel.

Signed-off-by: Adam Hintz <[email protected]>
  • Loading branch information
adam000 committed Mar 17, 2010
1 parent 216d8ae commit 69b417e
Show file tree
Hide file tree
Showing 12 changed files with 415 additions and 285 deletions.
1 change: 1 addition & 0 deletions Engine/Preferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ void Save ()
buffer.append(iter->first + ":" + iter->second + "\n");
}
ResourceManager::WriteFile("Config/Preferences.cfg", buffer.data(), buffer.length());
ResourceManager::WriteFile("Config/Preferences.cfg", buffer.data(), sizeof(buffer.data()));
}

}
17 changes: 14 additions & 3 deletions Engine/Scripting/LuaBind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,8 @@ int Pref_Get ( lua_State* L )
{
const char* arg = luaL_checkstring(L, 1);
std::string push = Preferences::Get(arg, "nil");
// lua_pushstring(L, push);
// [TODO, ADAM] Make this not hardcoded... I think we have to recognize what type "push" is and format it accordingly
// lua_pushstring(L, push);
if (push == "true") // [HARDCODED]
{
lua_pushboolean(L, true);
Expand All @@ -555,26 +556,36 @@ int Pref_Get ( lua_State* L )
return 1;
}

int Pref_Set ( lua_State* L )
{
const char* arg = luaL_checkstring(L, 1);
const char* set = luaL_checkstring(L, 2);
Preferences::Set(arg, set);
Preferences::Save();
return 0;
}

/**
* @page lua_preferences The Lua Preferences Registry
* This page contains information about the Lua preferences registry.
*
* This registry currently only contains one function, used for retrieving
* preferences. In Lua, it is called called like so: "preferences.get(name)".
*
* @section xml_get get
* @section pref_get get
* Finds and returns a particular preference.\n
* Parameters:\n
* name - The name of the preference to be fetched.\n
* Returns:\n
* boolean - The status of the requested preference.
* boolean - The status of the requested preference. (currently, this is hardcoded)
*
* @todo Make @ref xml_get un-hardcoded.
*/

luaL_Reg registryPreferences[] =
{
"get", Pref_Get,
"set", Pref_Set,
NULL, NULL
};

Expand Down
1 change: 0 additions & 1 deletion Engine/Sound/Sound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ void PreloadingThread ()

const char* extensions[] =
{
".s3m",
".ogg",
".xm",
".mod",
Expand Down
10 changes: 10 additions & 0 deletions Engine/Utilities/ResourceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,16 @@ void WriteFile ( const std::string& name, const void* data, size_t len )
{
std::string path = userDirectoryPath + '/' + name;
CreateDirectoryWithIntermediates(path.substr(0, path.find_last_of('/')));
if (!FileExists(path))
{
LOG("ResourceManager", LOG_NOTICE, "This file does not exist: %s", path.c_str());
LOG("ResourceManager", LOG_NOTICE, "Creating file...");
if (WriteFile(name) == NULL)
{
LOG("ResourceManager", LOG_ERROR, "Unable to create file\n");
exit(1);
}
}
FILE* fp = fopen(path.c_str(), "rb");
assert(fp);
fwrite(data, 1, len, fp);
Expand Down
Loading

0 comments on commit 69b417e

Please sign in to comment.