Jump to content

Some Usefull Stuffs


Recommended Posts

  • 2 months later...
  • 1 month later...
  • 3 months later...
  • 3 years later...

Is it working at gcc49? What should i change at your codes ?

At my codes

	ALUA(item_select_cell)
	{
		lua_pushboolean(L, 0);
		if (!lua_isnumber(L, 1))
		{
			return 1;
		}
		DWORD cell = (DWORD) lua_tonumber(L, 1);

		LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
		LPITEM item = ch ? ch->GetInventoryItem(cell) : NULL;

		if (!item)
		{
			return 1;
		}

		CQuestManager::instance().SetCurrentItem(item);
		lua_pushboolean(L, 1);

		return 1;
	}

At your codes 

	int item_get_flag(lua_State* L)
	{
		LPITEM item = CQuestManager::instance().GetCurrentItem();

		lua_pushnumber(L, item ? item->GetFlag() : 0);
		return 1;
	}

 

Link to comment
Share on other sites

  • Premium
54 minutes ago, AltanOzkan said:

Is it working at gcc49? What should i change at your codes ?

At my codes


	ALUA(item_select_cell)
	{
		lua_pushboolean(L, 0);
		if (!lua_isnumber(L, 1))
		{
			return 1;
		}
		DWORD cell = (DWORD) lua_tonumber(L, 1);

		LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
		LPITEM item = ch ? ch->GetInventoryItem(cell) : NULL;

		if (!item)
		{
			return 1;
		}

		CQuestManager::instance().SetCurrentItem(item);
		lua_pushboolean(L, 1);

		return 1;
	}

At your codes 


	int item_get_flag(lua_State* L)
	{
		LPITEM item = CQuestManager::instance().GetCurrentItem();

		lua_pushnumber(L, item ? item->GetFlag() : 0);
		return 1;
	}

 

	ALUA (item_get_flag)
	{
		LPITEM item = CQuestManager::instance().GetCurrentItem();

		lua_pushnumber(L, item ? item->GetFlag() : 0);
		return 1;
	}
54 minutes ago, AltanOzkan said:

Is it working at gcc49?

Yes.

  • Love 1
Link to comment
Share on other sites

I just tried for questlua_item.cpp and it gave to me this errors.

 

questlua_item.cpp: In function 'int quest::item_get_flag(lua_State*)':
questlua_item.cpp:769:3: error: 'lua_pushnumb' was not declared in this scope
   lua_pushnumb?er(L, item ? item->GetFlag() : 0);
   ^
questlua_item.cpp:769:48: error: 'er' was not declared in this scope
   lua_pushnumb?er(L, item ? item->GetFlag() : 0);
                                                ^
questlua_item.cpp:769:49: error: expected ':' before ';' token
   lua_pushnumb?er(L, item ? item->GetFlag() : 0);
                                                 ^
questlua_item.cpp:769:49: error: expected primary-expression before ';' token
questlua_item.cpp: In function 'int quest::item_get_applies(lua_State*)':
questlua_item.cpp:898:10: warning: unused variable 'Key1' [-Wunused-variable]
     char Key1[64] = "", Key2[64] = "";
          ^
questlua_item.cpp:898:25: warning: unused variable 'Key2' [-Wunused-variable]
     char Key1[64] = "", Key2[64] = "";
                         ^
questlua_item.cpp: In function 'int quest::item_equip_selected(lua_State*)':
questlua_item.cpp:1341:30: warning: NULL used in arithmetic [-Wpointer-arith]
   if (equipped->GetVnum() != NULL || item->IsEquipped())
                              ^
gmake[1]: *** [Makefile:188: .obj/questlua_item.o] Error 1
gmake[1]: *** Waiting for unfinished jobs....
gmake[1]: Leaving directory '/usr/Srcs/Server/game/src'
gmake: *** [Makefile:111: all] Error 2

 

Link to comment
Share on other sites

  • Premium
4 hours ago, AltanOzkan said:

I just tried for questlua_item.cpp and it gave to me this errors.

 


questlua_item.cpp: In function 'int quest::item_get_flag(lua_State*)':
questlua_item.cpp:769:3: error: 'lua_pushnumb' was not declared in this scope
   lua_pushnumb?er(L, item ? item->GetFlag() : 0);
   ^
questlua_item.cpp:769:48: error: 'er' was not declared in this scope
   lua_pushnumb?er(L, item ? item->GetFlag() : 0);
                                                ^
questlua_item.cpp:769:49: error: expected ':' before ';' token
   lua_pushnumb?er(L, item ? item->GetFlag() : 0);
                                                 ^
questlua_item.cpp:769:49: error: expected primary-expression before ';' token
questlua_item.cpp: In function 'int quest::item_get_applies(lua_State*)':
questlua_item.cpp:898:10: warning: unused variable 'Key1' [-Wunused-variable]
     char Key1[64] = "", Key2[64] = "";
          ^
questlua_item.cpp:898:25: warning: unused variable 'Key2' [-Wunused-variable]
     char Key1[64] = "", Key2[64] = "";
                         ^
questlua_item.cpp: In function 'int quest::item_equip_selected(lua_State*)':
questlua_item.cpp:1341:30: warning: NULL used in arithmetic [-Wpointer-arith]
   if (equipped->GetVnum() != NULL || item->IsEquipped())
                              ^
gmake[1]: *** [Makefile:188: .obj/questlua_item.o] Error 1
gmake[1]: *** Waiting for unfinished jobs....
gmake[1]: Leaving directory '/usr/Srcs/Server/game/src'
gmake: *** [Makefile:111: all] Error 2

 

lua_pushnumb?er to lua_pushnumber

  • Love 1

c++latest, latest libs...

Link to comment
Share on other sites

  • 1 year later...
  • Management
Link to comment
Share on other sites

  • 4 months later...

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.