void EditableLevelPaletteHeaders::setIndexOfMapNum(
                      int primaryNum,
                      int subNum,
                      int index) {
  // Throw if primary key out of range
  if (primaryNum >= mapnumToIndex_.numPrimaryKeys()) {
    throw OutOfRangeIndexException(TALES_SRCANDLINE,
                                   "EditableLevelPaletteHeaders::"
                                   "setIndexOfMapNum(int,int,int) [PRIMARY]",
                                   primaryNum);
  }
  
  // Throw if subkey out of range
  if (subNum >= mapnumToIndex_.subKeyTable()[primaryNum]) {
    throw OutOfRangeIndexException(TALES_SRCANDLINE,
                                   "EditableLevelPaletteHeaders::"
                                   "setIndexOfMapNum(int,int,int) [SUB]",
                                   subNum);
  }
  
  // Set index
  mapnumToIndex_.refDataByKeys(primaryNum,
                               subNum)
    = index;
}
Esempio n. 2
0
const TileReference& TileMap::tileData(int x, int y) const {
    if ((x >= w_)) {
        throw OutOfRangeIndexException(TALES_SRCANDLINE,
                                       "TileMap::tileData(int,int)"
                                       " [x]",
                                       x);
    }

    if ((y >= h_)) {
        throw OutOfRangeIndexException(TALES_SRCANDLINE,
                                       "TileMap::tileData(int,int)"
                                       " [y]",
                                       y);
    }

    return tileData_[x][y];
}
Esempio n. 3
0
wxColour& Theme::getFloor(int number){
	if (number > 5)
		throw OutOfRangeIndexException(number);
	else if (number < 0)
		throw NegativeIndexException(number);
	else{
		return _floors[number];
	}
}
Esempio n. 4
0
Theme& Theme::loadFloor(const int i, const unsigned char R, const unsigned char G, const unsigned char B){
	if (i > 5)
		throw OutOfRangeIndexException(i);
	else if (i < 0)
		throw NegativeIndexException(i);
	else{
		_floors[i].Set(R, G, B);
		return *this;
	}
}
Esempio n. 5
0
Theme& Theme::loadFloor(const int i, const wxColour& floor){
	if (i > 6)
		throw OutOfRangeIndexException(i);
	else if (i < 0)
		throw NegativeIndexException(i);
	else{
		_floors[i] = floor;
		return *this;
	}
}
Esempio n. 6
0
const MapLayout& MapLayouts::mapAtIndex(int index) const {
  // Throw if index out of range
  if ((unsigned int)index >= mapLayouts_.size()) {
    throw OutOfRangeIndexException(TALES_SRCANDLINE,
                                   "MapLayouts::mapAtIndex(int) const",
                                   index);
  }

  return mapLayouts_[index];
}
RawObjectGraphicSubheader& RawObjectGraphicsHeader::subheader(int index) {
  // Throw if index out of range
  if ((unsigned int)index >= rawObjectGraphicSubheaders_.size()) {
    throw OutOfRangeIndexException(TALES_SRCANDLINE,
                                   "RawObjectGraphicsHeader::subheader(int)",
                                   index);
  }

  return rawObjectGraphicSubheaders_[index];
}
Esempio n. 8
0
const LengthMapValue& MetatileLengthMap::lengths(int index) const {
  // Throw if index out of range
  if ((unsigned int)index >= numElements) {
    throw OutOfRangeIndexException(TALES_SRCANDLINE,
                                   "MetatileLengthMap::lengthAt(int)",
                                   index);
  }

  return lengths_[index];
}
SlopeSpeedValue& EditableSlopeSpeedValues::speedValue(int index) {
  // Throw if index out of range
  if ((unsigned int)index >= speedValues_.size()) {
    throw OutOfRangeIndexException(TALES_SRCANDLINE,
                                   "EditableSlopeSpeedValues::speedValue(int)",
                                   index);
  }
  
  return speedValues_[index];
}
Esempio n. 10
0
unsigned int& EditablePowerUpData::flightTimePerPowerup(int powerups) {
  if (powerups >= numPowerUps_) {
    throw OutOfRangeIndexException(TALES_SRCANDLINE,
                                   "EditablePowerUpData"
                                   "::maxHealthPerPowerup(int)",
                                   powerups);
  }
  
  return flightTimePerPowerup_[powerups];
}
SpriteMappingCoordinateTableEntry& SpriteMappingCoordinateTable
    ::entry(int index) {
  if (index >= spriteCoordinates_.size()) {
    throw OutOfRangeIndexException(TALES_SRCANDLINE,
                                   "SpriteMappingCoordinateTable"
                                   "::entry(int)",
                                   index);
  }
  
  return spriteCoordinates_[index];
}
LevelObjectEntryGroup& EditableLevelObjectEntryGroups::group(int groupIndex) {
  // Throw if index out of range
  if ((unsigned int)groupIndex >= primaryStorage_.size()) {
    throw OutOfRangeIndexException(TALES_SRCANDLINE,
                                   "EditableLevelObjectEntryGroups"
                                   "::group(int)",
                                   groupIndex);
  }

  return primaryStorage_[groupIndex];
}
Esempio n. 13
0
void MetatileLengthMap::setLengthAt(int index, LengthMapValue value) {
  // Throw if index out of range
  if ((unsigned int)index >= numElements) {
    throw OutOfRangeIndexException(TALES_SRCANDLINE,
                                   "MetatileLengthMap::setLengthAt(int,"
                                   "LengthMapValue)",
                                   index);
  }
  
  lengths_[index] = value;
}
LevelObjectEntryCollection::const_iterator EditableLevelObjectEntryGroups
    ::groupCend(int groupIndex) const {
  // Throw if index out of range
  if ((unsigned int)groupIndex >= primaryStorage_.size()) {
    throw OutOfRangeIndexException(TALES_SRCANDLINE,
                                   "EditableLevelObjectEntryGroups"
                                   "::groupCend(int) const",
                                   groupIndex);
  }

  return primaryStorage_[groupIndex].cend();
}
void EditableLevelObjectEntryGroups::eraseEntry(int groupIndex,
                const LevelObjectEntryCollection::iterator& entryIt) {
  // Throw if index out of range
  if ((unsigned int)groupIndex >= primaryStorage_.size()) {
    throw OutOfRangeIndexException(TALES_SRCANDLINE,
                                   "EditableLevelObjectEntryGroups"
                                   "::eraseEntry(int, const"
                                   " LevelObjectEntryCollection::iterator&)",
                                   groupIndex);
  }

  primaryStorage_[groupIndex].eraseEntry(entryIt);
}
LevelPaletteHeader& EditableLevelPaletteHeaders::headerByIndex(
                                   int index) {
  // Throw if index out of range
  if ((unsigned int)index >= primaryStorage_.size()) {
    throw OutOfRangeIndexException(TALES_SRCANDLINE,
                                   "EditableLevelPaletteHeaders::"
                                   "headerByIndex(int)",
                                   index);
  }
  
  // Return corresponding header
  return primaryStorage_[index];
}
int EditableLevelPaletteHeaders::indexOfMapNum(
                                   int primaryNum,
                                   int subNum) {
  // Throw if primary key out of range
  if (primaryNum >= mapnumToIndex_.numPrimaryKeys()) {
    throw OutOfRangeIndexException(TALES_SRCANDLINE,
                                   "EditableLevelPaletteHeaders::"
                                   "indexOfMapNum(int,int) [PRIMARY]",
                                   primaryNum);
  }
  
  // Throw if subkey out of range
  if ((subNum - TwoKeyedAddress::subKeyBase)
        >= mapnumToIndex_.subKeyTable()[primaryNum]) {
    throw OutOfRangeIndexException(TALES_SRCANDLINE,
                                   "EditableLevelPaletteHeaders::"
                                   "indexOfMapNum(int,int) [SUB]",
                                   subNum);
  }
  
  // Return index
  return mapnumToIndex_.refDataByKeys(primaryNum,
                                      subNum);
}
void EditableLevelObjectEntryGroups::addEntry(int groupIndex,
              const LevelObjectEntry& entry) {
  // Throw if index out of range
  if ((unsigned int)groupIndex >= primaryStorage_.size()) {
    throw OutOfRangeIndexException(TALES_SRCANDLINE,
                                   "EditableLevelObjectEntryGroups"
                                   "::addEntry(int, const LevelObjectEntry&)",
                                   groupIndex);
  }
  
  // Throw if max number of objects reached
  if (totalEntries() >= maxTotalEntries()) {
    throw TGenericException(TALES_SRCANDLINE,
                                   "EditableLevelObjectEntryGroups"
                                   "::addEntry(int, const LevelObjectEntry&)",
                                   "Max object limit exceeded");
  }

  primaryStorage_[groupIndex].addEntry(entry);
}
Esempio n. 19
0
void TileMapEditor::changeTileMap(int index) {
  if (index >= numTileMaps()) {
    throw OutOfRangeIndexException(TALES_SRCANDLINE,
                                   "TileMapEditor::changeTileMap(int)",
                                   index);
  }
  
  TileMapInfo info = TileMapInfos::tileMapInfo(index);
  
  tileMapPreview_ = TileMapPickerScene(
                        toolManager_,
                        tileMaps_.tileMap(index),
                        levelGraphicsData_.compressedGraphic(
                          info.graphicNum),
                        standardPalettes_.palette(
                          info.paletteNum),
                        info.offset);
  tileMapPreview_.setGridLayerEnabled(gridEnabled_);
  tileMapPreview_.setSceneScale(2.00);
  
  tilePickerPreview_ = GraphicTilePickerScene(
                        toolManager_,
                        levelGraphicsData_.compressedGraphic(
                          info.graphicNum),
                        standardPalettes_.palette(
                          info.paletteNum),
                        info.offset);
  tilePickerPreview_.setGridLayerEnabled(gridEnabled_);
  tilePickerPreview_.setSceneScale(2.00);
  
  currentIndex_ = index;
  
  toolManager_.resetTools();
  // Set upper-left tile as pencil tool target
  toolManager_.setPencilDrawIndex(
    currentTileMap().tileData(0, 0).tileNum());
  
  updateFromTileMap();
}