changeset 2034:cc197a3b6eff

GetScriptFileLocation
author Ritor1
date Wed, 20 Nov 2013 00:25:58 +0600
parents e78fa9082174
children cef3439340fa
files mm7_2.cpp
diffstat 1 files changed, 13 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mm7_2.cpp	Tue Nov 19 20:23:42 2013 +0600
+++ b/mm7_2.cpp	Wed Nov 20 00:25:58 2013 +0600
@@ -4309,6 +4309,14 @@
 bool draw_debug_line = false;
 bool new_speed = true;
 
+
+const char *GetScriptFileLocation(const char *script_name)
+{
+  static char buf[2048];
+  strcpy(buf, "scripts/");
+  strcat(buf, script_name);
+  return buf;
+}
 //----- (00462C94) --------------------------------------------------------
 bool MM_Main(const wchar_t *pCmdLine)
 {
@@ -4318,20 +4326,19 @@
   sprintfex(test, "^Pi[%s]: знахар^R[ь;ка;]", "Золтан");
 
   lua_State *L = luaL_newstate();
-  char test2[1024];
   if ( L == NULL )
     printf ( "Error creating Lua context.\n" );
   luaL_openlibs(L);
-  if ( luaL_dofile(L,"lua_scripts/script.lua"))
+  if ( luaL_dofile(L,GetScriptFileLocation("script.lua")))
     printf ( "Error opening script.lua\n" );
 
   luaopen_test(L);    // load the wrappered module
-  if (luaL_dofile(L,"lua_scripts/test.lua"))
-    printf("unable to load file");
+  if (luaL_dofile(L,GetScriptFileLocation("test.lua")))
+    printf("unable to load file\n");
 
   luaopen_UIControl(L);    // load the wrappered module
-  if (luaL_dofile(L,"lua_scripts/UIControl.lua"))
-    printf("unable to load file");
+  if (luaL_dofile(L,GetScriptFileLocation("UIControl.lua")))
+    printf("unable to load file\n");
   //lua_close(l);
 
   bool bNoMargareth = false;