(Keeps Hive Alive)
Go Back   The Hive Workshop - A Warcraft III Modding Site > Warcraft III Resources > Submissions

Submissions Submit JASS resources! If approved, they will be moved to their proper section.
Please read me first.

Reply
 
LinkBack Thread Tools Display Modes
Old 07-20-2008, 11:40 AM   #1 (permalink)

Anozer jasser
 
Join Date: Apr 2008
Posts: 237

Troll-Brain has little to show at this moment (13)Troll-Brain has little to show at this moment (13)


Detect Resources Exchange System

1234

Last edited by Troll-Brain; 01-05-2009 at 08:02 PM..
Troll-Brain is offline   Reply With Quote
Old 07-22-2008, 03:30 PM   #2 (permalink)
 
Earth-Fury's Avatar

Inside You <3
 
Join Date: Feb 2004
Posts: 545

Earth-Fury is a glorious beacon of light (532)Earth-Fury is a glorious beacon of light (532)Earth-Fury is a glorious beacon of light (532)Earth-Fury is a glorious beacon of light (532)Earth-Fury is a glorious beacon of light (532)

PayPal Donor: This user has donated to The Hive. 

You pollute the global textmacro name table with the inaptly named "Macro". You declare variables outside of the macro that should be inside the macro. I do believe scope initializers work when nested in libraries, so you have no excuse for not using a scope with an initializer in the macro.

You use the type conditionfunc instead of boolexpr. While Filter() and Condition() return subtypes of boolexpr, all functions take values of type boolexpr. Using the subtypes is just unnecessary and confusing, adding needlessly to code complexity. The subtypes act the same, so use the parent type.

Register$TYPE$Exchange breaks with the convention of trigger event registration functions starting with "TriggerRegister".

Your whole system breaks JASS convention by specifying a pair of function sets, instead of a single function set which take a constant.

Your Get functions to get the value of things inside the trigger are not thread-safe. Attach data to the trigger and retrieve it on Get call to make them thread-safe. (GetTriggeringTrigger() is your friend.)

You provide two internal implementations. For a system this simple, that's bad. Pick the best way, and stick to it.

I'm too lazy to examine the actual logic and functionality of this, but I think my current gripes are enough for now.
__________________
Giving reputation is a nice way to say thank you to someone that helps you!
Earth-Fury is offline   Reply With Quote
Old 07-22-2008, 06:56 PM   #3 (permalink)

Anozer jasser
 
Join Date: Apr 2008
Posts: 237

Troll-Brain has little to show at this moment (13)Troll-Brain has little to show at this moment (13)


Quote:
Originally Posted by Earth-Fury
You pollute the global textmacro name table with the inaptly named "Macro".
Who care really ? This part of the code should not be edited.

Quote:
Originally Posted by Earth-Fury
You declare variables outside of the macro that should be inside the macro. I do believe scope initializers work when nested in libraries, so you have no excuse for not using a scope with an initializer in the macro.
Ok i will edit that. I though it was just more readable.

Quote:
Originally Posted by Earth-Fury
You use the type conditionfunc instead of boolexpr. While Filter() and Condition() return subtypes of boolexpr, all functions take values of type boolexpr. Using the subtypes is just unnecessary and confusing, adding needlessly to code complexity. The subtypes act the same, so use the parent type.
Ok.

Quote:
Originally Posted by Earth-Fury
Register$TYPE$Exchange breaks with the convention of trigger event registration functions starting with "TriggerRegister".
I though it was annoying long, or not ?

Quote:
Originally Posted by Earth-Fury
Your whole system breaks JASS convention by specifying a pair of function sets, instead of a single function set which take a constant.
You want mean something like that ?
TriggerRegisterResourceExchange(<yourTrigger>,<yourForce>, <an integer constant names like GOLD, LUMBER>)

Quote:
Originally Posted by Earth-Fury
Your Get functions to get the value of things inside the trigger are not thread-safe. Attach data to the trigger and retrieve it on Get call to make them thread-safe. (GetTriggeringTrigger() is your friend.)
But what happens if a trigger is destroyed ?
I know that's a bad thing and we should recycle them.
But is there a safe method to "store" triggers and manage the leaks if the user create and destroy triggers during the game ?

Quote:
Originally Posted by Earth-Fury
You provide two internal implementations. For a system this simple, that's bad. Pick the best way, and stick to it.
True i will make only one.

Quote:
Originally Posted by Earth-Fury
I'm too lazy to examine the actual logic and functionality of this, but I think my current gripes are enough for now.
Enough, that's the word :p

Last edited by Troll-Brain; 07-22-2008 at 09:37 PM..
Troll-Brain is offline   Reply With Quote
Old 07-23-2008, 12:40 AM   #4 (permalink)
 
Earth-Fury's Avatar

Inside You <3
 
Join Date: Feb 2004
Posts: 545

Earth-Fury is a glorious beacon of light (532)Earth-Fury is a glorious beacon of light (532)Earth-Fury is a glorious beacon of light (532)Earth-Fury is a glorious beacon of light (532)Earth-Fury is a glorious beacon of light (532)

PayPal Donor: This user has donated to The Hive. 

Quote:
Originally Posted by Troll-Brain View Post
Who care really ? This part of the code should not be edited.
When someone else creates a system that uses a textmacro named "Macro", you will see the problem...


Quote:
Originally Posted by Troll-Brain View Post
I though it was annoying long, or not ?
If you're going to make a system that follows the convention of using triggers, instead of using Function Interfaces (Which really, kick ass.), you should follow convention.


Quote:
Originally Posted by Troll-Brain View Post
You want mean something like that ?
TriggerRegisterResourceExchange(<yourTrigger>,<yourForce>, <an integer constant names like GOLD, LUMBER>)
Yes.


Quote:
Originally Posted by Troll-Brain View Post
But what happens if a trigger is destroyed ?
I know that's a bad thing and we should recycle them.
But is there a safe method to "store" triggers and manage the leaks if the user create and destroy triggers during the game ?
Use a storage system that doesn't need to be cleaned. Arrays, after allocated, will not ever take up less space again. Considering you only need to store native values, and not pointers on the trigger, you also don't have to worry about deallocation of handles. Something like DataSystem should do:
credit to grim001 - Wc3campaigns
__________________
Giving reputation is a nice way to say thank you to someone that helps you!
Earth-Fury is offline   Reply With Quote
Old 07-23-2008, 04:39 PM   #5 (permalink)

Anozer jasser
 
Join Date: Apr 2008
Posts: 237

Troll-Brain has little to show at this moment (13)Troll-Brain has little to show at this moment (13)


Quote:
Originally Posted by Earth-Fury
When someone else creates a system that uses a textmacro named "Macro", you will see the problem...
Have you seen that i add "once" to the macro ?
Anyway i will change the name.

Quote:
Originally Posted by Earth-Fury
If you're going to make a system that follows the convention of using triggers, instead of using Function Interfaces (Which really, kick ass.), you should follow convention.
What did you mean. I should use function interfaces instead or not ?
Troll-Brain is offline   Reply With Quote
Old 07-24-2008, 12:28 AM   #6 (permalink)
 
Earth-Fury's Avatar

Inside You <3
 
Join Date: Feb 2004
Posts: 545

Earth-Fury is a glorious beacon of light (532)Earth-Fury is a glorious beacon of light (532)Earth-Fury is a glorious beacon of light (532)Earth-Fury is a glorious beacon of light (532)Earth-Fury is a glorious beacon of light (532)

PayPal Donor: This user has donated to The Hive. 

Quote:
Originally Posted by Troll-Brain View Post
Have you seen that i add "once" to the macro ?
Anyway i will change the name.
JassHelper 0.9.9.9

Quote:
The library_once keyword works exactly like library but you can declare the same library name twice, it would just ignore the second declaration and avoid to add its contents instead of showing a syntax error, it is useful in combination with textmacros.
Quote:
Hint: You can use textmacro_once in a similar way to library_once.
According to the documentation, //! textmacro_once simply causes any additional declarations to be completely ignored instead of throwing a syntax error (which SHOULD occur in this case, considering your macro _needs_ to execute properly for the library to work.)

Quote:
Originally Posted by Troll-Brain View Post
What did you mean. I should use function interfaces instead or not ?
Completely up to you. The trigger event design pattern is perfectly valid. I just really like the simplicity function interfaces can give to a lot of things.
__________________
Giving reputation is a nice way to say thank you to someone that helps you!

Last edited by Earth-Fury; 07-24-2008 at 08:13 AM..
Earth-Fury is offline   Reply With Quote
Old 07-28-2008, 02:55 PM   #7 (permalink)

Anozer jasser
 
Join Date: Apr 2008
Posts: 237

Troll-Brain has little to show at this moment (13)Troll-Brain has little to show at this moment (13)


As the library DataSystem, i update my system as well.
Troll-Brain is offline   Reply With Quote
Old 08-14-2008, 03:35 PM   #8 (permalink)

Anozer jasser
 
Join Date: Apr 2008
Posts: 237

Troll-Brain has little to show at this moment (13)Troll-Brain has little to show at this moment (13)


It seems that' a "nice" (i can't be objective) useless system.
Troll-Brain is offline   Reply With Quote
Old 10-30-2008, 06:42 PM   #9 (permalink)

Anozer jasser
 
Join Date: Apr 2008
Posts: 237

Troll-Brain has little to show at this moment (13)Troll-Brain has little to show at this moment (13)


Do you want a replay which prove it works as intended ?
Troll-Brain is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Something to detect these? Dracula Triggers & Scripts 6 01-01-2008 07:12 PM
[AI] Seeking for a ressource... or maybe just an information ^^ LordZsar1 Triggers & Scripts 4 07-30-2007 04:32 PM
Hero Stat Exchange FuryOfASquirrel World Editor Help Zone 15 06-10-2007 12:14 PM
Skills exchange. Want a trigger made? Rapture Map Development 1 05-19-2005 09:50 PM

All times are GMT. The time now is 09:35 AM.






Your link here 
Guitar Lessons | Dish Network | Guitar Lessons | Credit Score | Loans
Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
Copyright©Ralle