Skip to content
Permalink
Browse files

Merged PR 571: Merge 633_persist_generated_areas to master

Related work items: #633
  • Loading branch information...
realms-mud committed Sep 6, 2019
1 parent b771ea6 commit 3be1fc394275096ba10b43ae6a195e69dd992044
Showing with 116 additions and 2 deletions.
  1. +18 −2 environment/environment.c
  2. +98 −0 tests/modules/secure/generateDB.sql
@@ -23,6 +23,7 @@ private mapping aliasesToElements = ([]);
protected mapping exits = ([]);
private string State = "default";
private string RegionPath = 0;
private string uniqueIdentifier = 0;
protected int xCoordinate = 0;
protected int yCoordinate = 0;
private nosave string ShortDescription = "";
@@ -403,9 +404,22 @@ protected nomask varargs void addGeneratedExit(string direction, string location
]);
}

/////////////////////////////////////////////////////////////////////////////
protected nomask void setIdentifier(string newIdentifier)
{
uniqueIdentifier = newIdentifier;
}

/////////////////////////////////////////////////////////////////////////////
public nomask string identifiedBy()
{
return uniqueIdentifier ? uniqueIdentifier :
sprintf("%s-%s", object_name(this_object()), currentState());
}

/////////////////////////////////////////////////////////////////////////////
public nomask varargs object addGeneratedRegion(string direction, string type,
int x, int y, string state)
int x, int y, string name, string state)
{
object ret = 0;
if (!member(environmentalElements["regions"], direction))
@@ -417,7 +431,9 @@ public nomask varargs object addGeneratedRegion(string direction, string type,
ret->setDimensions(x, y);
}

ret->setRegionName(sprintf("%s start", object_name(this_object())));
ret->setRegionName(name ? name :
sprintf("%s-%s", identifiedBy(), direction));

ret->setRegionType(type);

ret->createRegion(ret->getEnterFromDirection(direction),
@@ -82,6 +82,18 @@ drop function if exists saveBasicPlayerInformation;
##
drop function if exists saveResearchChoice;
##
drop table if exists environmentDescriptions;
##
drop table if exists environmentShops;
##
drop table if exists environmentInstances;
##
drop table if exists environmentalElements;
##
drop table if exists environmentalObjects;
##
drop table if exists regions;
##
drop table if exists domainUnitTraits;
##
drop table if exists domainUnits;
@@ -597,6 +609,92 @@ CREATE TABLE `domainUnitTraits` (
CONSTRAINT `unit_trait` FOREIGN KEY (`unitId`) REFERENCES `domainUnits` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
##
CREATE TABLE `regions` (
`id` INT NOT NULL AUTO_INCREMENT,
`name` VARCHAR(256) NOT NULL,
`type` VARCHAR(45) NOT NULL,
`x-dimension` TINYINT NOT NULL,
`y-dimension` TINYINT NOT NULL,
`entryPoint` VARCHAR(256) NOT NULL,
`entryDirection` VARCHAR(20) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE INDEX `id_UNIQUE` (`id` ASC),
UNIQUE INDEX `name_UNIQUE` (`name` ASC)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
##
CREATE TABLE `environmentInstances` (
`id` INT NOT NULL AUTO_INCREMENT,
`regionId` INT NULL,
`x-coordinate` INT NULL,
`y-coordinate` INT NULL,
`identifier` VARCHAR(256) NOT NULL,
`name` VARCHAR(128) NULL,
`isCloned` BINARY NOT NULL DEFAULT false,
PRIMARY KEY (`id`),
UNIQUE INDEX `id_UNIQUE` (`id` ASC),
INDEX `instance_region_idx` (`regionId` ASC),
CONSTRAINT `instance_region` FOREIGN KEY (`regionId`) REFERENCES `regions` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
##
CREATE TABLE `environmentDescriptions` (
`id` INT NOT NULL AUTO_INCREMENT,
`environmentId` INT NOT NULL,
`state` VARCHAR(80) NULL,
`description` LONGTEXT NOT NULL,
PRIMARY KEY (`id`),
UNIQUE INDEX `id_UNIQUE` (`id` ASC),
INDEX `environment_description_idx` (`environmentId` ASC),
CONSTRAINT `environment_description`
FOREIGN KEY (`environmentId`)
REFERENCES `environmentInstances` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
##
CREATE TABLE `environmentShops` (
`id` INT NOT NULL AUTO_INCREMENT,
`environmentId` INT NOT NULL,
`shop` VARCHAR(256) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE INDEX `id_UNIQUE` (`id` ASC),
INDEX `environment_shop_idx` (`environmentId` ASC),
CONSTRAINT `environment_shop`
FOREIGN KEY (`environmentId`)
REFERENCES `environmentInstances` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
##
CREATE TABLE `environmentalElements` (
`id` INT NOT NULL AUTO_INCREMENT,
`environmentId` INT NOT NULL,
`type` VARCHAR(45) NOT NULL,
`value` VARCHAR(256) NOT NULL,
`state` VARCHAR(80) NULL,
`location` VARCHAR(40) NULL,
`x-coordinate` INT NULL,
`y-coordinate` INT NULL,
`z-coordinate` INT NULL,
PRIMARY KEY (`id`),
UNIQUE INDEX `id_UNIQUE` (`id` ASC),
INDEX `environment_element_idx` (`environmentId` ASC),
CONSTRAINT `environment_element` FOREIGN KEY (`environmentId`) REFERENCES `environmentInstances` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
##
CREATE TABLE `environmentalObjects` (
`id` INT NOT NULL AUTO_INCREMENT,
`environmentId` INT NOT NULL,
`path` VARCHAR(256) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE INDEX `id_UNIQUE` (`id` ASC),
INDEX `environment_object_idx` (`environmentId` ASC),
CONSTRAINT `environment_object`
FOREIGN KEY (`environmentId`)
REFERENCES `environmentInstances` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
##
CREATE VIEW `basicPlayerData` AS select `players`.`name` AS `name`,
`players`.`race` AS `race`,
`players`.`age` AS `age`,

0 comments on commit 3be1fc3

Please sign in to comment.
You can’t perform that action at this time.