Jump to content

Vega's Title System Game Crash


Go to solution Solved by Karbust,

Recommended Posts

  • Management

Sup bois

 

I've used this system previously on another source and worked fine, no issues. Today I've tried on my new source and I have a crash and I can't figure out why...

 

This is the gdb game.core:

root@vanilla_source:~/game/cores/channel1/core1 # gdb game game.core
GNU gdb (GDB) 8.2.1 [GDB v8.2.1 for FreeBSD]
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "i386-portbld-freebsd12.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from game...done.
[New LWP 100496]
[New LWP 101145]
[New LWP 101146]
[New LWP 101150]
Core was generated by `game'.
Program terminated with signal SIGILL, Illegal instruction.
#0  TitleManager::UpdateTitle (this=0xffbfecc0, ch=0x3c6d7000, changeTitle=19, changeMoney=0) at title.cpp:417
417             if (changeTitle > 0 && changeMoney > 0)
[Current thread is 1 (LWP 100496)]
(gdb) bt
#0  TitleManager::UpdateTitle (this=0xffbfecc0, ch=0x3c6d7000, changeTitle=19, changeMoney=0) at title.cpp:417
#1  0x0823ee17 in TitleManager::SetAffect (this=0xffbfecc0, ch=0x3c6d7000, valueAffect=0x86ff2ec "send_premium_3") at title.cpp:474
#2  0x08240154 in TitleManager::SetTitle (this=0xffbfecc0, ch=0x3c6d7000, pTitle=0x86ebf65 "title19") at title.cpp:596
#3  0x0807f91e in do_prestige_title (ch=0x3c6d7000, argument=0xffbf9da1 " prestige_19", cmd=236, subcmd=0) at cmd_general.cpp:3094
#4  0x085d703e in interpret_command (ch=0x3c6d7000, argument=0xffbfaf53 "prestige_title_name prestige_19", len=31) at cmd.cpp:795
#5  0x0844f61c in CInputMain::Chat (this=0x3bcfc678, ch=0x3c6d7000, data=0x3c5c4b80 "\003%", uiBytes=38) at input_main.cpp:733
#6  0x0845aaf4 in CInputMain::Analyze (this=0x3bcfc678, d=0x3bcfc600, bHeader=3 '\003', c_pData=0x3c5c4b80 "\003%") at input_main.cpp:3338
#7  0x0815f404 in CInputProcessor::Process (this=0x3bcfc678, lpDesc=0x3bcfc600, c_pvOrig=0x3c5c4b80, iBytes=38, r_iBytesProceed=@0xffbfbc18: 0) at input.cpp:99
#8  0x081dc07d in DESC::ProcessInput (this=0x3bcfc600) at desc.cpp:301
#9  0x084cb060 in io_loop (fdw=0x29cac300) at main.cpp:961
#10 0x084caaf0 in idle () at main.cpp:844
#11 0x084c9359 in main (argc=1, argv=0xffbfeebc) at main.cpp:520
(gdb)
bool TitleManager::UpdateTitle(LPCHARACTER ch, int changeTitle, int changeMoney)
{
	if (changeTitle > 0 && changeMoney > 0) //line 417
	{
		ch->UpdateTitle(changeTitle - ch->GetTitle());
		ch->PointChange(POINT_GOLD, - changeMoney);	
	}
	else if (changeTitle > 0 && changeMoney < 1)
	{
		ch->UpdateTitle(changeTitle - ch->GetTitle());
	}	
}

This error happens on setting premium title, setting free title and trading premium title for the potion.

 

The first 2 errors are thrown on the function above, the other is also on a if.

 

If I don't have the potion I get the error on this function always on the if's, which one depends on the title I want:

bool TitleManager::SetTitle(LPCHARACTER ch, const char* pTitle)
{
	if (NULL == ch)
		return false;

	if (!ch->IsPC())
		return false;

	if (!*pTitle)
	{	
		return false;
	}
/****************
* Title  free
*/
	if (!strcmp(pTitle, "disable")	&& (GetTitleActual(ch, sTitle[17]) == true) && (GetTitleActual(ch, sTitle[18]) == true) && (GetTitleActual(ch, sTitle[19]) == true))	
	{		
		ch->UpdateTitle(- ch->GetTitle());	
		ch->ChatPacket(CHAT_TYPE_NOTICE, title_translate[12]);
	}
	
	if (!strcmp(pTitle, "title1") && (GetLevel(ch, need_level_1) == true) && (GetPlayTime(ch, need_minutes_1) == true) && (GetMoney(ch, need_gold_1) == true) && (GetTitlePremium(ch) == true) && (GetTitleActual(ch, sTitle[1]) == true))	
	{	
			UpdateTitle(ch, sTitle[1], need_gold_1);
	}
	
	if (!strcmp(pTitle, "title2") && (GetLevel(ch, need_level_2) == true) && (GetPlayTime(ch, need_minutes_2) == true) && (GetMoney(ch, need_gold_2) == true) && (GetTitlePremium(ch) == true) && (GetTitleActual(ch, sTitle[2]) == true))	
	{
			UpdateTitle(ch, sTitle[2], need_gold_2);
	}	
	
	if (!strcmp(pTitle, "title3") && (GetLevel(ch, need_level_3) == true) && (GetPlayTime(ch, need_minutes_3) == true) && (GetMoney(ch, need_gold_3) == true) && (GetTitlePremium(ch) == true) && (GetTitleActual(ch, sTitle[3]) == true))	
	{		
			UpdateTitle(ch, sTitle[3], need_gold_3);
	}	
	
	if (!strcmp(pTitle, "title4") && (GetLevel(ch, need_level_4) == true) && (GetPlayTime(ch, need_minutes_4) == true) && (GetMoney(ch, need_gold_4) == true) && (GetTitlePremium(ch) == true) && (GetTitleActual(ch, sTitle[4]) == true))	
	{
			UpdateTitle(ch, sTitle[4], need_gold_4);
	}	
	
	if (!strcmp(pTitle, "title5") && (GetLevel(ch, need_level_5) == true) && (GetPlayTime(ch, need_minutes_5) == true) && (GetMoney(ch, need_gold_5) == true) && (GetTitlePremium(ch) == true) && (GetTitleActual(ch, sTitle[5]) == true))	
	{
			UpdateTitle(ch, sTitle[5], need_gold_5);
	}	
	
	if (!strcmp(pTitle, "title6") && (GetLevel(ch, need_level_6) == true) && (GetPlayTime(ch, need_minutes_6) == true) && (GetMoney(ch, need_gold_6) == true) && (GetTitlePremium(ch) == true) && (GetTitleActual(ch, sTitle[6]) == true))	
	{
			UpdateTitle(ch, sTitle[6], need_gold_6);
	}
	
	if (!strcmp(pTitle, "title7") && (GetLevel(ch, need_level_7) == true) && (GetPlayTime(ch, need_minutes_7) == true) && (GetMoney(ch, need_gold_7) == true) && (GetTitlePremium(ch) == true) && (GetTitleActual(ch, sTitle[7]) == true))	
	{
			UpdateTitle(ch, sTitle[7], need_gold_7);
	}	
	
	if (!strcmp(pTitle, "title8") && (GetLevel(ch, need_level_8) == true) && (GetPlayTime(ch, need_minutes_8) == true) && (GetMoney(ch, need_gold_8) == true) && (GetTitlePremium(ch) == true) && (GetTitleActual(ch, sTitle[8]) == true))	
	{
			UpdateTitle(ch, sTitle[8], need_gold_8);
	}
	
	if (!strcmp(pTitle, "title9") && (GetLevel(ch, need_level_9) == true) && (GetPlayTime(ch, need_minutes_9) == true) && (GetMoney(ch, need_gold_9) == true) && (GetTitlePremium(ch) == true) && (GetTitleActual(ch, sTitle[9]) == true))	
	{
			UpdateTitle(ch, sTitle[9], need_gold_9);
	}	
	
	if (!strcmp(pTitle, "title10") && (GetLevel(ch, need_level_10) == true) && (GetPlayTime(ch, need_minutes_10) == true) && (GetMoney(ch, need_gold_10) == true) && (GetTitlePremium(ch) == true) && (GetTitleActual(ch, sTitle[10]) == true))	
	{
			UpdateTitle(ch, sTitle[10], need_gold_10);
	}
	
	if (!strcmp(pTitle, "title11") && (GetLevel(ch, need_level_11) == true) && (GetPlayTime(ch, need_minutes_11) == true) && (GetMoney(ch, need_gold_11) == true) && (GetTitlePremium(ch) == true) && (GetTitleActual(ch, sTitle[11]) == true))	
	{
			UpdateTitle(ch, sTitle[11], need_gold_11);
	}	
	
	if (!strcmp(pTitle, "title12") && (GetLevel(ch, need_level_12) == true) && (GetPlayTime(ch, need_minutes_12) == true) && (GetMoney(ch, need_gold_12) == true) && (GetTitlePremium(ch) == true) && (GetTitleActual(ch, sTitle[12]) == true))	
	{
			UpdateTitle(ch, sTitle[12], need_gold_12);
	}
	
	if (!strcmp(pTitle, "title13") && (GetLevel(ch, need_level_13) == true) && (GetPlayTime(ch, need_minutes_13) == true) && (GetMoney(ch, need_gold_13) == true) && (GetTitlePremium(ch) == true) && (GetTitleActual(ch, sTitle[13]) == true))	
	{
			UpdateTitle(ch, sTitle[13], need_gold_13);
	}	
	
	if (!strcmp(pTitle, "title14") && (GetLevel(ch, need_level_14) == true) && (GetPlayTime(ch, need_minutes_14) == true) && (GetMoney(ch, need_gold_14) == true) && (GetTitlePremium(ch) == true) && (GetTitleActual(ch, sTitle[14]) == true))	
	{
			UpdateTitle(ch, sTitle[14], need_gold_14);
	}	
	
	if (!strcmp(pTitle, "title15") && (GetLevel(ch, need_level_15) == true) && (GetPlayTime(ch, need_minutes_15) == true) && (GetMoney(ch, need_gold_15) == true) && (GetTitlePremium(ch) == true) && (GetTitleActual(ch, sTitle[15]) == true))	
	{
			UpdateTitle(ch, sTitle[15], need_gold_15);
	}	
	
	if (!strcmp(pTitle, "title16") && (GetLevel(ch, need_level_16) == true) && (GetPlayTime(ch, need_minutes_16) == true) && (GetMoney(ch, need_gold_16) == true) && (GetTitlePremium(ch) == true) && (GetTitleActual(ch, sTitle[16]) == true))	
	{
			UpdateTitle(ch, sTitle[16], need_gold_16);
	}
/****************
* Title  premium
*/
	if (!strcmp(pTitle, "title17") && (GetTitlePremium(ch) == true))
	{
			SetAffect(ch, "send_premium_1");
	}	
	
	if (!strcmp(pTitle, "title18") && (GetTitlePremium(ch) == true))	
	{
			SetAffect(ch, "send_premium_2");
	}	
	
	if (!strcmp(pTitle, "title19") && (GetTitlePremium(ch) == true))	
	{
			SetAffect(ch, "send_premium_3");
	}		
}

I've searched about the Illegal Instruction error and find the mtune command, tried -mtune=i686 and -mtune=x86-64, none worked (I don't have this instruction on my Makefile, I tried to add).

 

The errors are always occurring on the if's, nowhere else...

 

Anyone has any idea on how to solve this?

 

Thank you

Edited by Karbust
Solved

raw

raw

Link to comment
Share on other sites

  • Management
  • Solution

Problem solved

 

There're a few bool functions that weren't returning anything, neither false or true. But since their value was never used, they were only called outside of if's I passed them all to void and the few return false changed to return.

 

My compiler wasn't giving error about bool functions not returning a value. About this, anyone has any idea?

 

EDIT: Added this to my CFLAGS:  -Werror=return-type

Edited by Karbust
Solved the compiler throw error
  • Scream 1
  • Love 1

raw

raw

Link to comment
Share on other sites

  • Premium
17 minutes ago, Karbust said:

Problem solved

 

There're a few bool functions that weren't returning anything, neither false or true. But since their value was never used, they were only called outside of if's I passed them all to void and the few return false changed to return.

 

My compiler wasn't giving error about bool functions not returning a value. About this, anyone has any idea?

 

Try to increase warning level at vs, maybe it then triggers it

gcc reports that situation with vegas biolog system (what you described happens there as warning also, you can just make them return a default value)

Edited by tierrilopes
Link to comment
Share on other sites

  • Management
1 minute ago, tierrilopes said:

 

Try to increase warning level at vs, maybe it then triggers it

gcc reports that situation with vegas biolog system (what yopu described happens there as warning also)

I'm not using VS for the game source

 

On vegas biolog system I don't have any problem whatsoever.

raw

raw

Link to comment
Share on other sites

  • 1 year later...
On 5/21/2020 at 12:32 AM, Karbust said:

Problem solved

 

There're a few bool functions that weren't returning anything, neither false or true. But since their value was never used, they were only called outside of if's I passed them all to void and the few return false changed to return.

 

My compiler wasn't giving error about bool functions not returning a value. About this, anyone has any idea?

 

EDIT: Added this to my CFLAGS:  -Werror=return-type

Hello, could you share your fixed files please ? Thanks...

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

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.