UFO:Alien Invasion

Development => Coding => Topic started by: Hoehrer on December 18, 2006, 03:15:09 pm

Title: Attention: Current svn code broken
Post by: Hoehrer on December 18, 2006, 03:15:09 pm
I recently committed some major ammo-related changes to trunk (rev 5295+5296) and this broke the compilation process.

Since I'm not really experienced in these compiler-linkage things, could anybody point me to a way to define the INV_AmmoUsableInWeapon function (currently located in scripts.c + .h) so it can be used from every file it is needed?

These file currently are:
* cl_actor.c
* cl_research.c
* cl_team.c
* g_client.c
* q_shared.c
* scripts.c
All of 'em previously used the "objDef_t -> link" attribute instead of the function and still use the objDef struct.

Thanks for any tips.

Sorry for the troubles,
Werner
Title: Attention: Current svn code broken
Post by: Mattn on December 18, 2006, 04:52:43 pm
qcommon/scripts.c:1176 RS_GetTechByProvided:

Problem here is, this function should not be available for the server imo. But if you add it to scripts.c and don't add a #ifndef DEDICATED_ONLY /* */ #endif around it, the server could not be linked.

Code: [Select]

Index: qcommon/scripts.c
===================================================================
--- qcommon/scripts.c   (Revision 5297)
+++ qcommon/scripts.c   (Arbeitskopie)
@@ -1166,12 +1166,12 @@
  */
 void Com_AddObjectLinks(void)
 {
+#ifndef DEDICATED_ONLY
        objDef_t *od = NULL;
        technology_t *tech = NULL;
        int i, j, k;
 
        for (i = 0, od = csi.ods; i < csi.numODs; i++, od++) {
-
                /* Add links to technologies. */
                tech = RS_GetTechByProvided(od->kurz);
                od->tech = tech;
@@ -1179,7 +1179,7 @@
                if (!od->tech)
                        Sys_Error("Com_AddObjectLinks: Could not find a valid tech for item %s\n", od->kurz);
 #endif /* DEBUG */
-
+
                if (!Q_strncmp(od->type, "ammo", 4)) {
                        /* Add weapon-links to ammo items. */
                        k = 0;
@@ -1188,14 +1188,14 @@
                                if (tech->require_AND.type[j] == RS_LINK_WEAPON) {
                                        od->forWeapon[k] = tech->require_AND.idx[j];
                                        k++;
-                               }
+                               }
                        }
                } else {
                        /* Non-ammo items. */
                        od->forWeapon[0] = -1;
                }
        }
-
+#endif
 }
 
 /**
Index: qcommon/common.h
===================================================================
--- qcommon/common.h    (Revision 5297)
+++ qcommon/common.h    (Arbeitskopie)
@@ -72,8 +72,6 @@
 
 /*============================================================================ */
 
-extern qboolean bigendien;
-
 extern short BigShort(short l);
 extern short LittleShort(short l);
 extern int BigLong(int l);


This patch fixes current compile problems for me.

We should talk about your other question via Jabber or IRC
Title: Attention: Current svn code broken
Post by: Hoehrer on December 18, 2006, 05:01:10 pm
Thanks for the patch. I'll try it as soon as possible - which will be most likely tomorrow afternoon (and i hope to be online in Jabber/IRC as well then), so feel free to commit it before that if people start to complain ;)

Just one thing that i think is strange .. why doesn't the dedicated server need to know what ammo can be used in what weapon? Is this all done in the client?

Werner
Title: Attention: Current svn code broken
Post by: Hoehrer on December 18, 2006, 05:32:50 pm
Oh and BTW ... does this mean you can compile the rest of the code (i.e everything except ded-server) without problems?

Because i get linker errors (at least under DevCpp) because of my changes:
Code: [Select]

e.g game.dev

[SNIP]
-DWIN32  -DDEBUG  -D_WINDOWS  -DDEVCPP  -DC_ONLY  -DHAVE_GETTEXT  

dllwrap.exe --output-def ../../base/libgame.def --driver-name c++ --implib ../../base/libgame.a ../../src/game/g_ai.o ../../src/game/g_client.o ../../src/game/g_cmds.o ../../src/game/g_main.o ../../src/game/g_spawn.o ../../src/game/g_svcmds.o ../../src/game/g_utils.o ../../src/game/q_shared.o ../../src/game/g_combat.o  -L"d:/Programme/Dev-Cpp/lib" -lkernel32 -luser32 -lwinmm ../../src/ports/win32/intl.lib  --export-all-symbols    -o ../../base/game.dll

../../src/game/g_client.o(.text+0x3c65):g_client.c: undefined reference to `INV_AmmoUsableInWeapon'
../../src/game/g_client.o(.text+0x3e31):g_client.c: undefined reference to `INV_AmmoUsableInWeapon'
../../src/game/q_shared.o(.text+0x3ba1):q_shared.c: undefined reference to `INV_AmmoUsableInWeapon'
../../src/game/q_shared.o(.text+0x443e):q_shared.c: undefined reference to `INV_AmmoUsableInWeapon'
../../src/game/q_shared.o(.text+0x46ce):q_shared.c: undefined reference to `INV_AmmoUsableInWeapon'
../../src/game/q_shared.o(.text+0x4cf9):q_shared.c: more undefined references to `INV_AmmoUsableInWeapon' follow
collect2: ld returned 1 exit status

dllwrap.exe: no export definition file provided.
Creating one, but that may not be what you want
dllwrap.exe: c++ exited with status 1

make.exe: *** [../../base/game.dll] Error 1

Ausführung beendet


Gotta go now. cu
Werner
Title: Attention: Current svn code broken
Post by: Mattn on December 18, 2006, 09:18:27 pm
yes, that's because qcommon.c is not in the game lib. you have to put your INV_ function in the proper place to fix this. With linux you don't get this error - but you will get unresolved symbols when trying to load the lib.
Title: Darn
Post by: lfloden on December 19, 2006, 04:18:04 am
I tried compiling the code hoping the patch was already in there and it wasn't, now my game.dll is gone until I can compile it. Oh well, probably to busy to "test" the game right now anyway.
Title: Dang
Post by: lfloden on December 20, 2006, 03:30:32 am
I meant can't compile it. I get errors on the game.dll and the ref_gl.dll, how do you apply this patch?
Title: Attention: Current svn code broken
Post by: Hoehrer on December 20, 2006, 10:59:39 am
Quote from: "Mattn"
yes, that's because qcommon.c is not in the game lib. you have to put your INV_ function in the proper place to fix this. With linux you don't get this error - but you will get unresolved symbols when trying to load the lib.

That's exactly the problem i meant ... in what file does this function belong so it can be used in all those files i listed above without creating any compiler-link problems (i.e unresolved symbols).

Werner
Title: Attention: Current svn code broken
Post by: Hoehrer on December 20, 2006, 12:36:52 pm
Revision 5322 should fix this problem.
The function is now located in src/game/q_shared.c
Please report any problems with compilation and loading of ammo into weapons.

Thanks,
Werner
Title: Attention: Current svn code broken
Post by: ubequitz on December 20, 2006, 04:37:57 pm
I haven't looked hard enough at the new code to know the exact cause, but currently no weapon in trunk is reloadable. All normally reloadable weapons are red and attempting to reload results in no useful feedback.
Title: Attention: Current svn code broken
Post by: Hoehrer on December 20, 2006, 08:24:00 pm
Sorry for dropping out of irc, but this just irritated me while programming. :)

Could you please test if there still are weapon-load problems? I tested it a bit and it seems to work fine now.

I also renamed the check-function to a neutral INV_LoadableInWeapon thus avoiding both terms "mag" and "ammo".

Werner
Title: Attention: Current svn code broken
Post by: ubequitz on December 20, 2006, 09:18:00 pm
Thanks Hoehrer, it seems to be working fine now. I'm happy with the function name too now :D (sorry for being way too pedantic!).
Title: Attention: Current svn code broken
Post by: ubequitz on December 22, 2006, 08:41:21 pm
Just discovered multiplayer team reload is broken, I didn't check that one before :(
Title: Attention: Current svn code broken
Post by: Hoehrer on December 23, 2006, 03:11:01 pm
Ah, ok, i kinda expected this :-/ I hope to find some time to fix this after the holidays.

When did it happen (who was the server)?

I think the "linking" of  weapon<->ammo (i.e. info from research-tree vs. inventory) may not be generated in the case of multiplayer right now.

Werner
Title: Attention: Current svn code broken
Post by: Hoehrer on December 23, 2006, 03:19:47 pm
Yes, i just confirmed that this needs to be changed completly again .. i hate that stuff :-/

Werner
Title: Attention: Current svn code broken
Post by: Hoehrer on December 30, 2006, 01:59:53 pm
While i was absent mattn seems to have fixed the re-load problem in multiplayer, thanks mattn.
Are there any problems left?

Werner
Title: Attention: Current svn code broken
Post by: Mattn on December 30, 2006, 03:04:43 pm
i don't know - to be honest i only fixed the reload problem. i'm not sure whether your implementation was already finished.
Title: Attention: Current svn code broken
Post by: Hoehrer on December 30, 2006, 05:15:20 pm
Quote from: "Mattn"
i don't know - to be honest i only fixed the reload problem. i'm not sure whether your implementation was already finished.

The implementation is finished (sans yet unknown bugs of course)

The problem as reported above was that the research tree wasn't loaded OR the links to it weren't created yet - this seems to be solved now after your fixes :)

And further bugs should only be minor ones.

Werner