|
Author |
Topic: [solved] Segfault on "create spell" |
Title: Neophyte
Posts: 3
Joined: 29 Jun 2014
|
Date Posted: Fri Mar 17, 2017 5:13 am
Subject: [solved] Segfault on "create spell"
|
I successfully built the current source. However the game segfaults when selecting 'Type' during spell creation.
4) Type shows null where it should be UNDEF
Selection list is empty.
Code: |
1) Name: A blank spell formula
2) Look Desc:
It looks very blank.
3) Category: Combat
4) Type: (null)
5) Force: 1
q) Quit
Enter your choice: 4
1)
2)
3)
4)
5)
6)
7)
Enter spell type: 1
|
Selecting an empty string causes a segfault.
Code: |
Fri Mar 17 06:01:38 :: CHEATLOG: [60599] Root drops: (obj 17137) a rating 8 sorcery library
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff6ace943 in _IO_vfprintf_internal (s=s@entry=0x7fffffffc980, format=<optimized>,
format@entry=0x5f466f "4) Type: ^c%s^n\r\n", ap=ap@entry=0x7fffffffcab8) at vfprintf.c:1661
1661 vfprintf.c: No such file or directory.
(gdb) bt
#0 0x00007ffff6ace943 in _IO_vfprintf_internal (s=s@entry=0x7fffffffc980, format=<optimized>,
format@entry=0x5f466f "4) Type: ^c%s^n\r\n", ap=ap@entry=0x7fffffffcab8) at vfprintf.c:1661
#1 0x00007ffff6af38fb in __IO_vsprintf (string=0x897280 <buf3> "4) Type: ^c: ^cCombat^n\r\n",
format=0x5f466f "4) Type: ^c%s^n\r\n", args=0x7fffffffcab8) at iovsprintf.c:42
#2 0x00000000004af391 in send_to_char (ch=0xb0bbc0, messg=0x5f466f "4) Type: ^c%s^n\r\n") at comm.cpp:2123
#3 0x000000000052121d in spedit_disp_menu (d=0xb05740) at magcreate.cpp:29
#4 0x0000000000521be5 in spedit_parse (d=0xb05740, arg=0x7fffffffd720 "1") at magcreate.cpp:165
#5 0x000000000051685d in nanny (d=0xb05740, arg=0x7fffffffd720 "1") at interpreter.cpp:2037
#6 0x00000000004ab114 in game_loop (mother_desc=3) at comm.cpp:652
#7 0x00000000004aa40a in init_game (port=4000) at comm.cpp:351
#8 0x00000000004a9e75 in main (argc=1, argv=0x7fffffffe078) at comm.cpp:235
(gdb)
|
How can I make sure the types are passed correctly?
Thanks in advance!
--
edit: added missing methods in magcreate.cpp
Code: |
--- a/work/src/magcreate.cpp
+++ b/work/src/magcreate.cpp
@@ -26,7 +26,7 @@ void spedit_disp_menu(struct descriptor_data *d)
send_to_char(CH, "1) Name: ^c%s^n\r\n", SPELL->restring);
send_to_char(CH, "2) Look Desc:\r\n^c%s^n\r\n", SPELL->photo);
send_to_char(CH, "3) Category: ^c%s^n\r\n", spell_category[GET_OBJ_VAL(SPELL, 9)]);
- send_to_char(CH, "4) Type: ^c%s^n\r\n", spells[GET_OBJ_VAL(SPELL, 1)]);
+ send_to_char(CH, "4) Type: ^c%s^n\r\n", spells[GET_OBJ_VAL(SPELL, 1)].name);
send_to_char(CH, "5) Force: ^c%d^n\r\n", GET_OBJ_VAL(SPELL, 0));
if (GET_OBJ_VAL(SPELL, 1) == SPELL_INCATTR || GET_OBJ_VAL(SPELL, 1) == SPELL_INCCYATTR ||
GET_OBJ_VAL(SPELL, 1) == SPELL_DECATTR || GET_OBJ_VAL(SPELL, 1) == SPELL_DECCYATTR)
@@ -40,7 +40,7 @@ void spedit_disp_spell_type(struct descriptor_data *d)
int x = 1;
for (int i = 0; i < MAX_SPELLS; i++)
if (spells[i].category == GET_OBJ_VAL(SPELL, 9)) {
- send_to_char(CH, "%d) %s\r\n", x, spells[i]);
+ send_to_char(CH, "%d) %s\r\n", x, spells[i].name);
x++;
}
send_to_char("Enter spell type: ", CH);
|
|
Post Reply | Quote | Private Message
|
Title: Member
Posts: 274
Joined: 31 Mar 2007
|
Date Posted: Wed Apr 19, 2017 12:49 am
Subject:
|
Good work on self-solving this one. Let us know if you run into any other issues-- I still swing by every so often to help people with running dev ports, and I know there are a few others who do so as well.
-----signature----- :::The Star Sapphire:::
|
Post Reply | Quote | Private Message
|
Title: Neophyte
Posts: 3
Joined: 29 Jun 2014
|
Date Posted: Wed Apr 19, 2017 4:15 pm
Subject:
|
Thanks, Lucien. The code can be quite challenging when all you know is Shell and a little Perl.
|
Post Reply | Quote | Private Message
|
|
|
Awakened Worlds Forum Index » AwakeMUD Core Development |
|
All times are GMT
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|
The time now is Sat Apr 21, 2018 7:44 am
|
powered by hailBoards v.1.2.0 ©2006 SPIRE / [based on phpBB©]
|
| |