Wc3C.net

Wc3C.net (http://www.wc3c.net/forums.php)
-   Scripts (http://www.wc3c.net/forumdisplay.php?f=737)
-   -   Board (http://www.wc3c.net/showthread.php?t=108150)

Earth-Fury 11-07-2009 02:12 AM

Board
 
Zoom (requires log in)
Multiboard Decorators
Version 0.2.01
Introduction
Board is written in vJass and requires the NewGen editor, or Jass Helper in some other configuration. Board requires the latest version of Jass Helper.

Board is a library that eases the work of dealing with multiboards. It provides simple decorators around the natives, which allow for simpler code. There is a speed penalty associated with these decorators, as compared to using the multiboard natives.

Note that these decorators do not limit the number of rows or columns you can have in a multiboard. You can have dozens of Board objects with hundreds of cells each, and this system will work just fine.

Documentation of the API is available in the library's documentation.
Credits
The Board Library
Requirements:
To add Board to your map, copy and paste the below library in to a custom-text trigger in your map.
Expand Board:

Change Log

Change Log

  • 0.2.01:
    • Fixed default width bug
  • 0.2:
    • Code refactoring
    • Fixed memory leaks
    • Added more debug-mode error messages
  • 0.1:
    • Initial version


Rising_Dusk 11-07-2009 03:36 AM

This is so amazing if it does all of the things it says it does.

Rising_Dusk 11-09-2009 03:34 PM

1 Attachment(s)
Review:
  • Just a small thing that would be cool: rowInsert and colInsert that insert a row/col respectively into an already created Board. It could be really handy with dynamic multiboards for certain maps.
Is that really the only comment I had? It seemed to do everything the API said it would do and I couldn't think of much else I wanted to actually test / could need for a Board after the test. I attached a picture of my Board.

Good stuff. Just respond about the row/col insertion stuff and we'll go from there.

Anachron 11-09-2009 03:50 PM

Works perfectly, just one thing: Could you please add some basic functions, such as board.showAll(bool), board.showPlayer(p, bool), board.minimize(), board.maximize?

Thanks alot!

Rising_Dusk 11-09-2009 04:18 PM

Quote:

Originally Posted by Anachron
Could you please add some basic functions, such as board.showAll(bool), board.showPlayer(p, bool), board.minimize(), board.maximize?

Quote:

Originally Posted by Documentation
Collapse JASS:
// set board.visible = true
//     Makes the board visible for all players if set to true, and hidden for all
//     players if set to false.
//
// set board.visible[Player(0)] = false
//     Makes the board visible/hidden for the given player
// 
// local boolean b = board.visible[Player(0)]
//     Returns true if the board is visible for the given player; false otherwise.
// 
// 
// set board.minimized = true
//     Minimizes/restores the board for all players.
//
// set board.minimized[Player(0)] = false
//     Minimizes/restores the board for the given player only.

And:
Quote:

Originally Posted by Rising_Dusk
Just a small thing that would be cool: rowInsert and colInsert that insert a row/col respectively into an already created Board. It could be really handy with dynamic multiboards for certain maps.

The converse would also be valuable, with .removeCol and .removeRow

Anachron 11-09-2009 04:23 PM

RD, I am really blind. Sorry.
I read it but somehow wasn't there with my thoughts.

About the removeCol and addCol, that would be really great too.

Earth-Fury 11-09-2009 07:20 PM

The problem with dynamic addition and removal of rows and columns in the middle and left/top of the board is that it would require storing all of the settings for all of the cells. (There are no getters for multiboard item properties.) This is of course impossible to do in a by-value struct, without using hashtables.

So, if people are really willing to add the cost of hashtable manipulation to every operation the library performs, for the benefit of more clean middle-of-the-board insertions and deletions, then so shall it be.

It's even conceivable that the hashtable handling could be turned off if it's not required. Of course, I don't know if I have the sanity to write so many static ifs...

So. Post your opinions on the matter, and I'll either get coding a hellish mixture of modulo math and hashtables, or not.

Anachron 11-09-2009 08:06 PM

Make a new module for this and use hashtable. Its not that bad actually.

ploks 11-09-2009 08:28 PM

Quote:

Originally Posted by Earth-Fury
So. Post your opinions on the matter, and I'll either get coding a hellish mixture of modulo math and hashtables, or not.


It would be very cool to have a dynamic multiboard and even more cool if you could chose whether its active or not.

fX_ 11-09-2009 09:35 PM

if you use dynamic multiboards items will have to be regarded 'in context'. you will need to know when the multiboard is changed - which rows/columns added/removed - and the 'positions' of each item.
(i dunno, multiboards might not always be handled by a 'single operator'/'in context' - could be done, say, per 'module' or 'section'.)
if you 'bunch them up' (like according to structs/'names'/objects), you dont need this 'in context'-ness and you can just mind whatever row/column/struct/name/object you're manipulating.

ex:
1 row corresponds to data for 1 unit. units monitored in multiboard dynamically; rows are dynamic.
set this unit's data (in field X) to 'value'. but which row, now? i can know only if i did all the row/column adding/removing, other manipulations, etc.
(maybe multiboards are handled this way as by a 'single operator'/in'in context', maybe not. i dunno.)
but if the multiboard is manipulated 'modularly', you cant do this. you need to refer to the 'row' as 'row of this unit'/object.

...but then this is all unimportant if, in the first place, multiboards ought not to be manipulated 'modularly' (i dunno).

Rising_Dusk 11-12-2009 03:59 PM

So what is the verdict on this? Are you too lazy or not clever enough (:P) to implement the row/col insertions? Everything else about this is fine, it's just that one feature could be really useful. I know I'd use it.

Anachron 11-12-2009 04:13 PM

Quote:

Are you too lazy or not clever enough (:P)
I lol'ed.

Quote:

I know I'd use it.
Not only you.

Soo please do it.

Rising_Dusk 11-25-2009 04:27 PM

You should initialize board items to a non-zero width to fix that bug you figured out last night. It's a real pain in the f*cking ass, especially since it isn't mentioned anywhere.

Anachron 12-04-2009 11:02 AM

Could you please fix the bug? I can do it myself, but I guess it will make this resource a lot better and maybe worth for approval.

Rising_Dusk 12-04-2009 01:11 PM

He's doing everything at once. It's okay to use the library, he's going to maintain backwards compatibility. I use it already and it works great.


All times are GMT. The time now is 12:17 PM.

Powered by vBulletin (Copyright ©2000 - 2019, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services