1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
#include "support_classes.h"
room_dimensions::room_dimensions (int inX, int inY) // Constructor to call when x and y values are present
{
x = inX;
y = inY;
}
object_id::object_id() // Default constructor - Called if nothing else can be
{
}
object_id::object_id(OBJECT_TYPE intype/*type of object asked for*/) // Primary constructor - called when requested with a defining value from the enum
{
type_of_object = intype; // Assigns type_of_object the value sent to the class when it was called
switch (type_of_object)
case OT_TOOL:
tool.tool(true);
}
tool::tool() : object_id(OT_TOOL) // Default constructor called by OBJECT_ID with a value of OT_TOOL
{
// ERROR CODE
}
tool::tool(bool use) : object_id(OT_TOOL) // Constructor called if there has been a command to use the tool
{
if (use == true) in_use = true; // if constructor has been called with use being true, set in_use to true
if (use == false) in_use = false; // if constructor has been called with use being false, set in_use to false
}
room::room() : object_id(OT_ROOM) // Default constructor, called if room class is called with out input
{
// ERROR CODE
}
room::room(bool enter) : object_id(OT_ROOM) // constructor to call is a boolean value is present, indicating in the room or not
{
if (enter == true) in_room = true; // if the boolean value is true, assign it true
if (enter == false) in_room = false; // if the boolean value is false, assign it false
}
room::room(int size_x, int size_y) : object_id(OT_ROOM) // constructor to call if two integers are present, aka the size of the room
{
/*????????*/ <class room_dimensions> room_grid; // Create a new grid based off room_dimensions, called room_grid
int increment_x = 0; // incremental integers
int increment_y = 0;
if (increment_x == 0, increment_x == size_x, increment_x++) // if the count is at the start, continue untill its at the defined size
{
if (increment_y == 0, increment_y == size_y, increment_y++)
{
room_dimensions *new_room = NULL; // make a pointer out of room_dimensions, initialise to null
if ((new_room = new room_dimensions(increment_x, increment_y)) != 0) // as long as the created pointer doesn't come up empty, point new_room to it
room_grid. /*???????*/ (new_room); // put X and Y at the end of the room_grid list
if (increment_y > size_y) { increment_y = 0; } // if y is bigger then the limit, set it to 0
}
}
}
|