[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[pbmserv-dev] about board2d.cpp and multiple boards
I was wondering if it would be advantageous to create a set of functions
like those found in board2d but only make it possible to access other
boards than just the one named 'board' for example, I am writing a
game (BattleShip) and I wish to keep two identically-sized boards but one
I wish to use for the fleets of the two players and the other I wish to
use for the bombed-out locations where the players had attacked each other.
I realize that I could just place everything on one board with special
characters for each object (a digit for the player's ships and something
else for bombed out locations) but I think it would be neat if I could
use several boards and simply pass a parameter to the functions to
determine which [ReadWriteStringList] I wish to use.
I tried to figure out how to write this by looking at the lists.h and
lists.cpp files and I found something like where it used the variable
'*this' plus there were some functions like abc::abc and abc::~abc
and abc::&abc etc...
I was wondering how easy it would be to rewrite these functions so
that they could be used for a board that was named, like, board2 or
boardbombs instead of just using 'board' only.
Could this be done and then the default is to use the variable named,
'board', and if someone wanted to overwrite them using a different
variable name they could? Is this advisable?