Some other tweaks and fixes got pulled in along the way. Details: - Improved const-correctness - The scenario is now part of the universe, so now there's no global scenario object in the game or the PC editor. (Of course, the scenario editor has no universe, so it still has a global scenario object.) - Towns and outdoors now store a reference to the scenario; the party, current town, and current outdoors store a reference to the universe. Altogether this means that the data module has no need for global scenario or universe objects. - The fileio routines now take a scenario or universe reference as a parameter, so they don't need the global scenario or universe objects either. - cCurOut now has an arrow operator for accessing the current outdoor section, instead of a 2x2 subset of the outdoors; this replaces using i_w_c to index the 2x2 subset. (And it's much less verbose!) - cCurTown no longer stores a pointer to the town record, since it can simply access it through the universe instance which it stores a reference to. - Tweaked how the monster roster menu works (it now caches up to 60 monsters) - The operator= functions that convert from legacy to new scenario/save format are now ordinary functions rather than operators. - The bizarre use of assigning a cCreature to itself to populate certain fields has been nuked. - When at the corner of an outdoor sector, the scenario editor now shows the cornermost terrain in the diagonally adjacent sector. - There was a missing check to prevent horses entering dangerous terrain (eg, swamp) while in town. - Fix cancelling load party dialog causing a party to appear
118 lines
2.8 KiB
C++
118 lines
2.8 KiB
C++
/*
|
|
* tmpltown.h
|
|
* BoE
|
|
*
|
|
* Created by Celtic Minstrel on 24/04/09.
|
|
*
|
|
*/
|
|
|
|
#ifndef BOE_DATA_TMPLTOWN_H
|
|
#define BOE_DATA_TMPLTOWN_H
|
|
|
|
#include <iosfwd>
|
|
|
|
#include "location.h"
|
|
#include "monster.h"
|
|
#include "simpletypes.h"
|
|
#include "regtown.h"
|
|
|
|
class cTemplTown {
|
|
public:
|
|
class cCityBlock { // formerly city_block_type
|
|
public:
|
|
short type;
|
|
short destroy_time;
|
|
short alignment;
|
|
short key_time;
|
|
location where;
|
|
};
|
|
class cTerRect { // formerly city_ter_rect_type
|
|
public:
|
|
rectangle rect;
|
|
ter_num_t ter_type;
|
|
unsigned char hollow;
|
|
};
|
|
cCityBlock blocks[15];
|
|
cTerRect ter_rects[10];
|
|
};
|
|
|
|
class cBigTemplTown : public cBigTown, cTemplTown {
|
|
private:
|
|
//cCreature _creatures[60];
|
|
//ter_num_t _terrain[64][64];
|
|
//rectangle _room_rect[16];
|
|
//unsigned char _lighting[4][32];
|
|
public:
|
|
ter_num_t& terrain(size_t x, size_t y);
|
|
rectangle& room_rect(size_t i);
|
|
cCreature& creatures(size_t i);
|
|
unsigned char& lighting(size_t i, size_t r);
|
|
short max_dim() const;
|
|
short max_monst() const;
|
|
short max_items() const;
|
|
void writeTerrainTo(std::ostream& file);
|
|
void readTerrainFrom(std::istream& file);
|
|
explicit cBigTemplTown(cScenario& scenario, bool init_strings = false);
|
|
};
|
|
|
|
class cMedTemplTown : public cMedTown, cTemplTown {
|
|
private:
|
|
//cCreature _creatures[40];
|
|
//ter_num_t _terrain[48][48];
|
|
//rectangle _room_rect[16];
|
|
//unsigned char _lighting[4][32];
|
|
public:
|
|
ter_num_t& terrain(size_t x, size_t y);
|
|
rectangle& room_rect(size_t i);
|
|
cCreature& creatures(size_t i);
|
|
unsigned char& lighting(size_t i, size_t r);
|
|
short max_dim() const;
|
|
short max_monst() const;
|
|
short max_items() const;
|
|
void writeTerrainTo(std::ostream& file);
|
|
void readTerrainFrom(std::istream& file);
|
|
explicit cMedTemplTown(cScenario& scenario, bool init_strings = false);
|
|
};
|
|
|
|
class cTinyTemplTown : public cTinyTown, cTemplTown {
|
|
private:
|
|
//cCreature _creatures[30];
|
|
//ter_num_t _terrain[32][32];
|
|
//rectangle _room_rect[16];
|
|
//unsigned char _lighting[4][32];
|
|
public:
|
|
ter_num_t& terrain(size_t x, size_t y);
|
|
rectangle& room_rect(size_t i);
|
|
cCreature& creatures(size_t i);
|
|
unsigned char& lighting(size_t i, size_t r);
|
|
short max_dim() const;
|
|
short max_monst() const;
|
|
short max_items() const;
|
|
void writeTerrainTo(std::ostream& file);
|
|
void readTerrainFrom(std::istream& file);
|
|
explicit cTinyTemplTown(cScenario& scenario, bool init_strings = false);
|
|
};
|
|
|
|
// City blocks - I want to figure out how to use these sometime.
|
|
|
|
//struct city_block_type {
|
|
// short block_type;
|
|
// short block_destroy_time;
|
|
// char block_alignment;
|
|
// char block_key_time;
|
|
// location block_loc;
|
|
//};
|
|
//
|
|
//struct city_ter_rect_type {
|
|
// Rect what_rect;
|
|
// unsigned char ter_type;
|
|
// unsigned char hollow;
|
|
//};
|
|
//
|
|
//struct template_town_type {
|
|
// creature_start_type creatures[30];
|
|
// city_block_type city_block[15];
|
|
// city_ter_rect_type city_ter_rect[10];
|
|
//};
|
|
|
|
#endif |