I have this classes tree
GameManager 1 object
Game Multiple objects
Map 1 object
Player Multiple objects
Squads Multiple objects
Units Multiple objects
Now each Squad or Units have to know about data on it's Map
Say I have Game1 and Game 2
Game2 have different map than Game1
any unit1_1 of branch Game1 need to know about Map1
any unit1_2 of branch Game2 need to know about Map2
How to accomplish that?
Should I pass to Unit1_1 the Game1 instance?
I whould like the Map1 shared to all Game1 children objects somehow..the
same with Map2 and Game2
Right now I keep passing the map arround each time I need it way down to a
unit that move or do stuffs
--
Cheers,
Crirus
------------------------------
If work were a good thing, the boss would take it all from you
------------------------------ 5 1024
What I want to know is if it is possible to make some kind of xml tree
walking, so I can go up and access any ancestor of a node... i my case nore
is a reference to a class instance
--
Cheers,
Crirus
------------------------------
If work were a good thing, the boss would take it all from you
------------------------------
"Crirus" <Cr****@datagro up.ro> wrote in message
news:e5******** ******@TK2MSFTN GP09.phx.gbl... I have this classes tree
GameManager 1 object Game Multiple objects Map 1 object Player Multiple objects Squads Multiple objects Units Multiple objects
Now each Squad or Units have to know about data on it's Map
Say I have Game1 and Game 2 Game2 have different map than Game1 any unit1_1 of branch Game1 need to know about Map1 any unit1_2 of branch Game2 need to know about Map2
How to accomplish that?
Should I pass to Unit1_1 the Game1 instance?
I whould like the Map1 shared to all Game1 children objects somehow..the same with Map2 and Game2
Right now I keep passing the map arround each time I need it way down to a unit that move or do stuffs
-- Cheers, Crirus
------------------------------ If work were a good thing, the boss would take it all from you
------------------------------
On Wed, 14 Jan 2004 11:14:32 +0200, Crirus wrote: GameManager 1 object Game Multiple objects Map 1 object Player Multiple objects Squads Multiple objects Units Multiple objects
I don't know fully what you are designing, but to my mind, Player should
not be on the same level as Game but rather a sub level of game:
GameManager
Game
Map
Player
Squads
Units
Player, to me is an element of a Map. It seems like it would be a child of
map. A GameManager contains Games which contain maps which contain players
which have squads of units.
If this is the case, then a single unit can traverse up through it parents
to get the map info.
Just my thoughts.
--
Chris
To send me an E-mail, remove the underscores and lunchmeat from my E-Mail
address.
the players are indeed childs of game.. was a TAB missing there
Map is a separate class only with data of the terrain
Players join to game not to map in my design
How to traverse up such a graph?
--
Cheers,
Crirus
------------------------------
If work were a good thing, the boss would take it all from you
------------------------------
"Chris Dunaway" <dunawayc@_lunc hmeat_sbcglobal .net> wrote in message
news:1f******** *************** *******@40tude. net... On Wed, 14 Jan 2004 11:14:32 +0200, Crirus wrote:
GameManager 1 object Game Multiple objects Map 1 object Player Multiple objects Squads Multiple objects Units Multiple objects
I don't know fully what you are designing, but to my mind, Player should not be on the same level as Game but rather a sub level of game:
GameManager Game Map Player Squads Units
Player, to me is an element of a Map. It seems like it would be a child
of map. A GameManager contains Games which contain maps which contain
players which have squads of units.
If this is the case, then a single unit can traverse up through it parents to get the map info.
Just my thoughts.
-- Chris
To send me an E-mail, remove the underscores and lunchmeat from my E-Mail address.
On Thu, 15 Jan 2004 09:47:30 +0200, Crirus wrote: the players are indeed childs of game.. was a TAB missing there Map is a separate class only with data of the terrain Players join to game not to map in my design How to traverse up such a graph?
My only thought on that would be that each object would have a "parent"
property or perhaps a "ContainedB y" proprty that contains a reference to
the object that contains them. As each object is created, its parent
object could be set. I don't know how a heirarchy like this might affect
performance.
So a Unit could get the map data by using something like
Squad = Unit.Parent 'Get the squad the unit is in
Player = Squad.Parent 'Get the Player that owns the squad
Map = Player.Parent 'Get the map object for the player
Game = Map.Parent 'Get the game object for that map
There may be better ways, though
--
Chris
To send me an E-mail, remove the underscores and lunchmeat from my E-Mail
address.
Yes, that can be a solution, or even better to make a parent or grand parent
reference only in the classes that need it....
But I was wander if there could be a way to get this automatically without
my concern, but I guess a child class have no ideea about a parent that hold
it's reference
--
Cheers,
Crirus
------------------------------
If work were a good thing, the boss would take it all from you
------------------------------
"Chris Dunaway" <dunawayc@_lunc hmeat_sbcglobal .net> wrote in message
news:nc******** *************** ******@40tude.n et... On Thu, 15 Jan 2004 09:47:30 +0200, Crirus wrote:
the players are indeed childs of game.. was a TAB missing there Map is a separate class only with data of the terrain Players join to game not to map in my design How to traverse up such a graph?
My only thought on that would be that each object would have a "parent" property or perhaps a "ContainedB y" proprty that contains a reference to the object that contains them. As each object is created, its parent object could be set. I don't know how a heirarchy like this might affect performance.
So a Unit could get the map data by using something like
Squad = Unit.Parent 'Get the squad the unit is in Player = Squad.Parent 'Get the Player that owns the squad Map = Player.Parent 'Get the map object for the player Game = Map.Parent 'Get the game object for that map
There may be better ways, though
-- Chris
To send me an E-mail, remove the underscores and lunchmeat from my E-Mail address. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Ernst Murnleitner |
last post by:
Dear Readers,
Is it possible to forbid conversion from this or use of this in general
except where it is explicitly wanted?
Reason:
I changed my program from using normal pointers to classes A, ...
typedef A * APtr;
|
by: John Phelan |
last post by:
I have created a front-end application and back-end database.
Everytime that I opened the program in the past, it open just fine
with no errors when linking to the back-end tables.
lately, I get the following error message whenever I open my
application:
ERROR: "Method 'Connection' of object '_Current Project' failed.
Check to see if...
|
by: John Phelan Cummings |
last post by:
I have created a front-end application and back-end database. Everytime
that I opened the program in the past, it open just fine with no errors
when linking to the back-end tables.
Lately, I get the following error message whenever I open my
application:
ERROR: "Method 'Connection' of object '_Current Project' failed. Check
to see if...
|
by: John Phelan |
last post by:
I have created a front-end application and back-end database. I have
code that automatically links the front-end application to the
back-end database for whenever I provide a patch or upgrade.
Everytime that I opened the program in the past using either Access
2002 and 2003, it open just fine with no errors when linking to the
back-end...
|
by: John Phelan |
last post by:
Continue to get error message.
Here is an update of my problem and everything that I have done to
correct it.
I have created a front-end application and back-end database. I have
code that automatically links the front-end application to the
back-end database for whenever I provide a patch or upgrade. Everytime
that I opened the program...
| |
by: Hasan O. Zavalsiz |
last post by:
Hi , i am trying to figure out which approach is better to use .
let me explain the scenario.
i am using the "Nortwind" database . in this database i have "Customers "
table .The following is the two different ways to handle this table.
CASE 1 :
create a struct that encaplusates table "Customers" columns
public struct structCustomers
{...
|
by: Samuel R. Neff |
last post by:
When is it appropriate to use "volatile" keyword? The docs simply
state:
"
The volatile modifier is usually used for a field that is accessed by
multiple threads without using the lock Statement (C# Reference)
statement to serialize access.
"
But when is it better to use "volatile" instead of "lock" ?
|
by: letz |
last post by:
Hi,
We have a class whose objects are to be allocated in shared memory. To
do that a ShmManager base class is defined so that operator new and
delete are redefined to allocate segments in shared memory. A typical
class "Foo" then inherit from ShmManager to have get this behaviour.
class ShmManager {
|
by: =?ISO-8859-1?Q?Une_B=E9v?==?ISO-8859-1?Q?ue?= |
last post by:
lets say i have two objects with the same properties and rge same values
:
var o1={element:one, type:'keyup',code:82,action:setToRed};
var o2={element:one, type:'keyup',code:82,action:setToRed};
the variable "one" being a DIV Element and "setToRed" a function.
doing alert(o1===o2) gave me false.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |