|
|
Create a separate "move" function? |
One is there from the beginning, so that makes two out of four. |
When I tried it once before, my program crashed. Or does this mean add_ordered() is still wrong somehow? |
So if a list pointer was just declared and there's a danger of some garbage pointer address being there, would it be fine to call add_ordered() on it and insert a node anyway? |
|
|
|
|
|
|
This keeps going into an infinite loop after a while. |
It seems like it can't get past a certain point in the source list. |
And having trav move to the next node is not also not helping because that also makes it get stuck in an infinite loop eventually. |
By the way, do you know enough about Wt to be able to help someone learn it |
|
|
Unhandled exception thrown: read access violation. _Right_data was nullptr. |
|
|
|
|
The name string is known at compile-time. What I'm doing is a little different, though, isn't it? |
Notice that mine is very similar to this and yet it doesn't work for trying to get multiple nodes matching the desired criteria into the other list. |
And I did copy the code for insert() almost just as it was in the book. Here's the one from the book: |
I forgot and made some stuff different (I'll go change it back right now), but I aside from that it's the same. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
norse_gods list: { Name: Frejya; Myth: Norse; Vehicle: Chariot pulled by two cats; Weapon: Magic called seidr Name: Odin; Myth: Norse; Vehicle: Eight-legged flying horse called Sleipnir; Weapon: Spear called Gungnir Name: Odin; Myth: Norse; Vehicle: Eight-legged flying horse called Sleipnir; Weapon: Spear called Gungnir Name: Thor; Myth: Norse; Vehicle: Chariot pulled by goats Tanngrisnir and Tanngnjostr; Weapon: Hammer called Mjolnir } |
|
|
Really erroneous, right? |
|
|
Not only is one god missing, there's one god mentioned twice as well. |
Even though adding a conditional check for trav's name string being the same as one already in the destination list didn't help, which is why I tried taking it out to see what happens. |
Is there something I should do in add_ordered() to make sure there are no duplicate nodes? |
I tried running the code through my debugger a few times, but I can't see what the problem really is. |
norse_gods list: { Name: Baldr; Myth: Norse; Vehicle: A giant ship called Hringorni; Weapon: None Name: Frejya; Myth: Norse; Vehicle: Chariot pulled by two cats; Weapon: Magic called seidr Name: Odin; Myth: Norse; Vehicle: Eight-legged flying horse called Sleipnir; Weapon: Spear called Gungnir Name: Odin; Myth: Norse; Vehicle: Eight-legged flying horse called Sleipnir; Weapon: Spear called Gungnir Name: Thor; Myth: Norse; Vehicle: Chariot pulled by goats Tanngrisnir and Tanngnjostr; Weapon: Hammer called Mjolnir } |
|
|
|
|
norse_gods list: { Name: Baldr; Myth: Norse; Vehicle: A giant ship called Hringorni; Weapon: None Name: Frejya; Myth: Norse; Vehicle: Chariot pulled by two cats; Weapon: Magic called seidr Name: Odin; Myth: Norse; Vehicle: Eight-legged flying horse called Sleipnir; Weapon: Spear called Gungnir Name: Odin; Myth: Norse; Vehicle: Eight-legged flying horse called Sleipnir; Weapon: Spear called Gungnir Name: Thor; Myth: Norse; Vehicle: Chariot pulled by goats Tanngrisnir and Tanngnjostr; Weapon: Hammer called Mjolnir } greek_gods list: { Name: Ares; Myth: Greek; Vehicle: War chariot; Weapon: Sword and spear Name: Athena; Myth: Greek; Vehicle: ; Weapon: Allowed to use Zeus's Thunderbolt and the Aegis Name: Hera; Myth: Greek; Vehicle: A chariot drawn by peacocks; Weapon: Her intelligence Name: Zeus; Myth: Greek; Vehicle: A chariot pulled by the four major winds shaped as horses; Weapon: Thunderbolt and the shield called Aegis } jap_gods list: { Name: Amaterasu; Myth: Japanese; Vehicle: ; Weapon: Sword of Kusanagi, Jewel of Yasakani, Mirror of Yata Name: Bishamonten; Myth: Japanese; Vehicle: ; Weapon: A spear } |
|
|
|
|
|
|
|
|
|
|
|
|
norse_gods list: { Name: Baldr; Myth: Norse; Vehicle: A giant ship called Hringorni; Weapon: None Name: Frejya; Myth: Norse; Vehicle: Chariot pulled by two cats; Weapon: Magic called seidr Name: Odin; Myth: Norse; Vehicle: Eight-legged flying horse called Sleipnir; Weapon: Spear called Gungnir Name: Thor; Myth: Norse; Vehicle: Chariot pulled by goats Tanngrisnir and Tanngnjostr; Weapon: Hammer called Mjolnir } greek_gods list: { Name: Ares; Myth: Greek; Vehicle: War chariot; Weapon: Sword and spear Name: Athena; Myth: Greek; Vehicle: N/A; Weapon: Allowed to use Zeus's Thunderbolt and the Aegis Name: Hera; Myth: Greek; Vehicle: A chariot drawn by peacocks; Weapon: Her intelligence Name: Zeus; Myth: Greek; Vehicle: A chariot pulled by the four major winds shaped as horses; Weapon: Thunderbolt and the shield called Aegis } jap_gods list: { Name: Amaterasu; Myth: Japanese; Vehicle: N/A; Weapon: Sword of Kusanagi, Jewel of Yasakani, Mirror of Yata Name: Izanagi; Myth: Japanese; Vehicle: N/A; Weapon: Sword of Totsuka (later given to Susanoo) Name: Susanoo; Myth: Japanese; Vehicle: N/A; Weapon: Sword of Totsuka } gods list: { Name: Bishamonten; Myth: Japanese; Vehicle: N/A; Weapon: A spear } |