Development > Newbie Coding

Undefined Reference

<< < (3/6) > >>

geever:

--- Quote from: criusmac on September 17, 2009, 09:56:23 pm ---IE: If different memory pools are being used, then I can't create my own linked list to get around it anyways. My code absolutely *must* be able to transfer the memory contents between the dll portion and the rest of the code since wounds need to be handled in combat, and hospitals, and save files, and etc. Is what I'm trying to do impossible due to this?

--- End quote ---

I don't know this (dll) part but did you check how character data shared? There is a communication in both directions (client->game, game->client) for sure...

-geever

criusmac:
Sort of. The character data appears to be stored in character_t create in inv_shared.h. This already has a linked list built into it via teamDef_t, and so I included my linked list into character_t's data structure. The teamDef_t data structure appeared to be used in both the g_ and cp_ places, but I didn't pay attention to where its memory is allocated. Now that I look, it appears the memory is allocated only in the cp_ code.

Unfortunately, I can't do that the same way since memory has to be allocated and deallocated with regards to my linked list in both the g_ code, and the cp_ code.

For example:
Every time a wound is created I need to allocate in the g_ code since it happens in combat.
Every time a wound is healed, I need to deallocate in the cp_ code since it happens outside of combat.

*Edit*

--- Quote from: geever on September 17, 2009, 10:04:43 pm ---I don't know this (dll) part but did you check how character data shared? There is a communication in both directions (client->game, game->client) for sure...

-geever

--- End quote ---

On second thought, I am unsure of what you are asking. It appears you are asking if I realize that the dll and non dll portions of the game can share data.. This is, at its surface an odd question since anyone can't avoid knowing that dlls share data with application code... So, you must be asking something else.. Are you asking if I've look at how memory is allocated between the client and the game? No, I never did. I did not even realize the game project was a dll since I don't know how to see that in code blocks.

I was unable to find g_actor.c in my current project, so I imagine I have to download everything again. From rereading Mattn's comments, it *sounds* like I need to move my code out of g_combat.c, and put it into inv_shared.c, which is in the src/shared, and go from there.

Duke:

--- Quote from: criusmac on September 17, 2009, 10:15:02 pm ---I was unable to find g_actor.c in my current project,

--- End quote ---
In C:B, 'game' project, it's pretty much the first source you see if you open the 'sources' folder.
No need to re-download...

criusmac:
It is pretty obvious that I can't do a malloc in a dll and get away with it now that I know it's a dll.

Obviously, being a dll, it has to be used by multiple pieces of software. Doing a dir indicates:
ufo.exe
ufo2map.exe
ufo_ded.exe

so, probably between a couple of those at least. I have never known another reason to use a dll myself, other than to share code between software...

Looking at ufo2map.exe, it looks like some sort of map editor, maybe it has something to do with radiant.
ufo.exe is the game, so that needs the dll.
ufo_ded.exe looks like a server or something. It appears to have connections to the game library as well. inv_shared.c is here, so it appears that inv_shared is purely exe code, and not available in the dll. Putting my code in it won't help at all. Hmmm...

Ok, my code absolutely has to be called during combat, and that appears to all take place in the dll. The memory for this has to be used outside of combat... so I really should allocate everything outside of the dll. Oops, I shouldn't keep thinking out loud. I'm making too much noise.


Reply posted while typing, so...
dir *g_actor* /s
was done before, and it showed no files found.
Looking at the game project indicates the first file is g_ai.c, not g_actor.c, and so I don't have the same project.
Since my last download before I started work was:
07/31/2009  11:40 AM       620,577,731 ufoai-2.3-dev-win32-25511.exe

Best I can assume is this g_actor.c did not exist when I did the download about a month ago. Does anyone have a small patch file for the changes since 25511? I don't have the bandwidth to download 600+ megs for about 20 days. (Until the eighth of October, my billing date)

criusmac:
I guess it is wrong of me to expect help with my code the way it is. I have already started to beautify it to the coding standards in place. I expect it to take about 3-5 hours to complete, but I will post it when done.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version