Author |
Message |
Initrd.gz Seasoned Helper
Joined: Sep 18 2008 Posts: 134 Location: Over there ---> Offline
|
Posted: Tue Feb 24, 2009 7:49 pm Post subject: <C> Lockon |
|
|
|
|
Lockon: A highly configurable turret module, similar to HS's pointdefense.
NOTE: In testing, upload will come after
Here's a complete list of things you can do with it:
Create a turret that attaches to you.
Set it to aim at enemies, aim in your direction, or disable it.
Make it shoot bombs, guns, thors, repels, bursts, and mines.
Easy to configure.
Includes an interface that allows you to add turrets, remove turrets, or make them fire where.
You can talk to your turret. Ask it a Yes/no question
A turret can have an optional ammo count, and a reload period when the ammo reaches zero.
It is based on HS's pointdefense.
Last edited by Initrd.gz on Mon Mar 02, 2009 7:56 pm, edited 3 times in total |
|
Back to top |
|
|
tcsoccerman Server Help Squatter
Age:31 Gender: Joined: Jan 15 2007 Posts: 694 Location: Atlantis Offline
|
Posted: Tue Feb 24, 2009 8:11 pm Post subject: |
|
|
|
|
Nice work, should prove useful.
|
|
Back to top |
|
|
Samapico No, these DO NOT look like penises, ok?
Joined: May 08 2003 Posts: 1252 Offline
|
Posted: Tue Feb 24, 2009 10:50 pm Post subject: |
|
|
|
|
Quote: | I have not compiled/tested this yet |
... wut? _________________ (Insert a bunch of dead links here)
|
|
Back to top |
|
|
Dr Brain Flip-flopping like a wind surfer
Age:38 Gender: Joined: Dec 01 2002 Posts: 3502 Location: Hyperspace Offline
|
Posted: Wed Feb 25, 2009 7:33 am Post subject: |
|
|
|
|
Looking through the code I can see it won't compile.
It also looks like you don't handle attaching properly. If you attach to someone that's attached, then later they detach, you'll still be attached to the first player. That's the reason I told you not to use point defense as a reference. _________________ Hyperspace Owner
Smong> so long as 99% deaths feel lame it will always be hyperspace to me
|
|
Back to top |
|
|
Samapico No, these DO NOT look like penises, ok?
Joined: May 08 2003 Posts: 1252 Offline
|
Posted: Wed Feb 25, 2009 10:59 am Post subject: |
|
|
|
|
That's also why any code should be compiled and tested, even if you're sure it works
|
|
Back to top |
|
|
Initrd.gz Seasoned Helper
Joined: Sep 18 2008 Posts: 134 Location: Over there ---> Offline
|
Posted: Wed Feb 25, 2009 5:26 pm Post subject: |
|
|
|
|
Ok, I am sorry. I should have compiled and tested it. I just posted it when I was done with it. I will look over it again and post it when it is done. I apologize again.
|
|
Back to top |
|
|
Cheese Wow Cheese is so helpful!
Joined: Mar 18 2007 Posts: 1017 Offline
|
Posted: Wed Feb 25, 2009 7:00 pm Post subject: |
|
|
|
|
imagine if you bought an untested car...
dealer> look its our new car, we threw some parts in a bucket, but noone has tried to drive it yet! Starting at $11,000! _________________ SSC Distension Owner
SSCU Trench Wars Developer
|
|
Back to top |
|
|
Initrd.gz Seasoned Helper
Joined: Sep 18 2008 Posts: 134 Location: Over there ---> Offline
|
Posted: Thu Feb 26, 2009 7:01 pm Post subject: |
|
|
|
|
Looks like all the syntax errors are gone. I'm ignoring the "Dereferencing void * pointers" errors.
Dr. Brain, I am not sure what you mean by attaching.
Do you mean:
Player A is the fake.
Player B is the owner.
Player C is someone else.
Player B is attached to C, and A attaches to B, so it attaches to C.
Are you saying when B detaches from C, A is still attached? Because it looks like it should detach.
|
|
Back to top |
|
|
Dr Brain Flip-flopping like a wind surfer
Age:38 Gender: Joined: Dec 01 2002 Posts: 3502 Location: Hyperspace Offline
|
Posted: Thu Feb 26, 2009 10:47 pm Post subject: |
|
|
|
|
Initrd.gz wrote: | the "Dereferencing void * pointers" errors. |
That sounds bad. Cast pointers to the correct type before you deref them.
Initrd.gz wrote: | Player B is attached to C, and A attaches to B, so it attaches to C.
Are you saying when B detaches from C, A is still attached? Because it looks like it should detach. |
I didn't see any code to do that, but it should be simple enough to test if it works properly.
|
|
Back to top |
|
|
Initrd.gz Seasoned Helper
Joined: Sep 18 2008 Posts: 134 Location: Over there ---> Offline
|
|
Back to top |
|
|
Samapico No, these DO NOT look like penises, ok?
Joined: May 08 2003 Posts: 1252 Offline
|
Posted: Sun Mar 01, 2009 1:13 am Post subject: |
|
|
|
|
You could also simply do:
(Turret *) (link->data) ->attribute;
Though if you need to access several attributes in the next lines, it's definitely more efficient to create a pointer to link->data first
|
|
Back to top |
|
|
Dr Brain Flip-flopping like a wind surfer
Age:38 Gender: Joined: Dec 01 2002 Posts: 3502 Location: Hyperspace Offline
|
Posted: Sun Mar 01, 2009 9:27 am Post subject: |
|
|
|
|
Samapico wrote: | it's definitely more efficient to create a pointer to link->data first |
Any modern compiler will produce the same code regardless of which way you do it. So always pick the style that is easier to read and understand.
|
|
Back to top |
|
|
Initrd.gz Seasoned Helper
Joined: Sep 18 2008 Posts: 134 Location: Over there ---> Offline
|
Posted: Sun Mar 01, 2009 3:46 pm Post subject: |
|
|
|
|
Ok, as I said, the module compiles into a DLL. However, for some reason, I cannot compile it on Linux with gcc.
Here's the command I am using, and I bet it is wrong:
gcc lockon.c -o lockon.so -I./include -I./ |
The compiler complains about stuff such as LLAlloc and even atan2 not being defined. For some reason it is not including the files.
(I just had an Idea while typing this, I'm going to compile util.c with it like Dev-C++ does)
Edit: Still doesnt work. Output:
$ gcc lockon.c ./main/util.c -o lockon.so -I./include -I./ -Wall
lockon.c: In function ?get_best_target?:
lockon.c:197: warning: statement with no effect
lockon.c: In function ?turret_kickoff?:
lockon.c:480: warning: suggest parentheses around assignment used as truth value
lockon.c: In function ?MM_lockon?:
lockon.c:900: warning: control reaches end of non-void function
lockon.c: At top level:
lockon.c:787: warning: ?interface? defined but not used
/usr/lib/gcc/i486-linux-gnu/4.2.4/../../../../lib/crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
/tmp/ccPNvLFR.o: In function `fireangle':
lockon.c:(.text+0x413): undefined reference to `atan2'
/tmp/cc1H9JJR.o: In function `MPRemove':
util.c:(.text+0x1d27): undefined reference to `__pthread_register_cancel'
util.c:(.text+0x1d74): undefined reference to `__pthread_unregister_cancel'
collect2: ld returned 1 exit status |
|
|
Back to top |
|
|
Dr Brain Flip-flopping like a wind surfer
Age:38 Gender: Joined: Dec 01 2002 Posts: 3502 Location: Hyperspace Offline
|
Posted: Sun Mar 01, 2009 6:22 pm Post subject: |
|
|
|
|
Don't run gcc yourself on linux. Make a new directory in the asss src and put a .mk file in it, along with your source. The format for the .mk can be copied from the turf directory (it's pretty straight forward). Once you've done that:
|
|
Back to top |
|
|
Initrd.gz Seasoned Helper
Joined: Sep 18 2008 Posts: 134 Location: Over there ---> Offline
|
Posted: Sun Mar 01, 2009 9:21 pm Post subject: |
|
|
|
|
For some reason I cannot compile ASSS:
-quote removed-
Edit: Installed a few packages and that part compiles, and I installed libdbd-mysql, but it seems the mysql isnt compiling:
Quote: | gcc -std=gnu99 -pipe -I. -Iinclude -I../build -D_REENTRANT -D_GNU_SOURCE -fPIC -g -Wall -I/opt/db-4.0.14/include -fPIC \
-DNODQ -DNOTREAP -DNOSTRINGCHUNK -DNOMPQUEUE -DNOMMAP \
-o ../build/dbtool ../build/statcodes.o main/util.c main/dbtool.c -L/opt/db-4.0.14/lib -Wl,-rpath,/opt/db-4.0.14/lib -ldb-4
main/dbtool.c: In function ?print_quoted?:
main/dbtool.c:177: warning: pointer targets in passing argument 1 of ?strchr? differ in signedness
main/dbtool.c:178: warning: pointer targets in passing argument 1 of ?fputs? differ in signedness
main/dbtool.c: In function ?stats_print_stats?:
main/dbtool.c:445: warning: pointer targets in passing argument 1 of ?print_quoted? differ in signedness
gcc -std=gnu99 -pipe -I. -Iinclude -I../build -D_REENTRANT -D_GNU_SOURCE -fPIC -g -Wall -I/opt/mysql/include -c -o ../build/mysql.o database/mysql.c
database/mysql.c:17:19: error: mysql.h: No such file or directory
database/mysql.c:44: error: expected ?=?, ?,?, ?;?, ?asm? or ?__attribute__? before ?*? token
database/mysql.c: In function ?do_query?:
database/mysql.c:55: warning: implicit declaration of function ?mysql_real_query?
database/mysql.c:55: error: ?mydb? undeclared (first use in this function)
database/mysql.c:55: error: (Each undeclared identifier is reported only once
database/mysql.c:55: error: for each function it appears in.)
database/mysql.c:60: warning: implicit declaration of function ?mysql_error?
database/mysql.c:60: warning: format ?%s? expects type ?char *?, but argument 3 has type ?int?
database/mysql.c:62: warning: implicit declaration of function ?mysql_errno?
database/mysql.c:66: warning: implicit declaration of function ?mysql_field_count?
database/mysql.c:74: error: ?MYSQL_RES? undeclared (first use in this function)
database/mysql.c:74: error: ?res? undeclared (first use in this function)
database/mysql.c:74: warning: implicit declaration of function ?mysql_store_result?
database/mysql.c:79: warning: format ?%s? expects type ?char *?, but argument 3 has type ?int?
database/mysql.c:89: warning: implicit declaration of function ?mysql_free_result?
database/mysql.c: In function ?close_db?:
database/mysql.c:97: warning: implicit declaration of function ?mysql_close?
database/mysql.c:97: error: ?MYSQL? undeclared (first use in this function)
database/mysql.c:97: error: expected expression before ?)? token
database/mysql.c: In function ?work_thread?:
database/mysql.c:105: error: ?mydb? undeclared (first use in this function)
database/mysql.c:105: warning: implicit declaration of function ?mysql_init?
database/mysql.c:109: warning: format ?%s? expects type ?char *?, but argument 3 has type ?int?
database/mysql.c:120: warning: implicit declaration of function ?mysql_real_connect?
database/mysql.c:120: error: ?CLIENT_COMPRESS? undeclared (first use in this function)
database/mysql.c:120: warning: comparison between pointer and integer
database/mysql.c:122: warning: format ?%s? expects type ?char *?, but argument 3 has type ?int?
database/mysql.c:138: warning: implicit declaration of function ?mysql_ping?
database/mysql.c: In function ?Query?:
database/mysql.c:217: warning: implicit declaration of function ?mysql_escape_string?
database/mysql.c: In function ?GetRowCount?:
database/mysql.c:241: warning: implicit declaration of function ?mysql_num_rows?
database/mysql.c:241: error: ?MYSQL_RES? undeclared (first use in this function)
database/mysql.c:241: error: expected expression before ?)? token
database/mysql.c: In function ?GetFieldCount?:
database/mysql.c:246: warning: implicit declaration of function ?mysql_num_fields?
database/mysql.c:246: error: ?MYSQL_RES? undeclared (first use in this function)
database/mysql.c:246: error: expected expression before ?)? token
database/mysql.c: In function ?GetRow?:
database/mysql.c:251: warning: implicit declaration of function ?mysql_fetch_row?
database/mysql.c:251: error: ?MYSQL_RES? undeclared (first use in this function)
database/mysql.c:251: error: expected expression before ?)? token
database/mysql.c: In function ?GetField?:
database/mysql.c:256: error: ?MYSQL_ROW? undeclared (first use in this function)
database/mysql.c:256: error: expected ?)? before ?row?
database/mysql.c:257: warning: control reaches end of non-void function
database/mysql.c: In function ?GetLastInsertId?:
database/mysql.c:261: warning: implicit declaration of function ?mysql_insert_id?
database/mysql.c:261: error: ?mydb? undeclared (first use in this function)
make: *** [../build/mysql.o] Error 1
|
Last edited by Initrd.gz on Sun Mar 01, 2009 10:28 pm, edited 1 time in total |
|
Back to top |
|
|
Dr Brain Flip-flopping like a wind surfer
Age:38 Gender: Joined: Dec 01 2002 Posts: 3502 Location: Hyperspace Offline
|
Posted: Sun Mar 01, 2009 9:43 pm Post subject: |
|
|
|
|
Don't compile the mysql parts then. Set
in system.mk.
|
|
Back to top |
|
|
Initrd.gz Seasoned Helper
Joined: Sep 18 2008 Posts: 134 Location: Over there ---> Offline
|
Posted: Mon Mar 02, 2009 7:55 pm Post subject: |
|
|
|
|
K, thanks.
Gonna test once I move my server ( which requires me getting a static IP address... )
|
|
Back to top |
|
|
Initrd.gz Seasoned Helper
Joined: Sep 18 2008 Posts: 134 Location: Over there ---> Offline
|
Posted: Mon May 25, 2009 10:20 pm Post subject: |
|
|
|
|
Finally fixed it so that it will compile, but I have a problem.
The module compiles, inserts, and attaches, but when I try to use the ?simpleturret command, the server crashes. Source attached.
Nonfunctional Lockon Source Code
lockon.zip - 7.15 KB
File downloaded or viewed 51 time(s)
|
|
Back to top |
|
|
Dr Brain Flip-flopping like a wind surfer
Age:38 Gender: Joined: Dec 01 2002 Posts: 3502 Location: Hyperspace Offline
|
Posted: Tue May 26, 2009 6:42 am Post subject: |
|
|
|
|
If you're running on linux, the server should make a .bt file (backtrace) for every server crash. Take a look inside it. You may need to install gdb to get actual data.
|
|
Back to top |
|
|
|