Skip to content

Commit 41ad02f

Browse files
authored
Merge pull request #4 from Redex-Developers/cogStreetBuildings
Add DNA functions for Cog Buildings
2 parents a1cf266 + 285e032 commit 41ad02f

File tree

3 files changed

+65
-1
lines changed

3 files changed

+65
-1
lines changed

panda/src/toontown/dna/dnaStorage.I

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ INLINE void DNAStorage::reset_hood() {
9898
reset_place_nodes();
9999
reset_suit_points();
100100
reset_battle_cells();
101+
reset_suit_blocks();
101102
}
102103

103104

@@ -145,6 +146,16 @@ INLINE void DNAStorage::reset_battle_cells() {
145146
}
146147

147148

149+
////////////////////////////////////////////////////////////////////
150+
// Function: reset_suit_blocks
151+
// Access: Public
152+
// Description: clear out the dict
153+
////////////////////////////////////////////////////////////////////
154+
INLINE void DNAStorage::reset_suit_blocks() {
155+
_suit_blocks_map.clear();
156+
}
157+
158+
148159
////////////////////////////////////////////////////////////////////
149160
// Function: reset_DNAGroups
150161
// Access: Public

panda/src/toontown/dna/dnaStorage.cxx

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,50 @@ int DNAStorage::remove_suit_point(PT(DNASuitPoint) point) {
378378
}
379379

380380

381+
////////////////////////////////////////////////////////////////////
382+
// Function: store_suit_block
383+
// Access: Public
384+
// Description: Store a block number in the SuitBlocks map
385+
////////////////////////////////////////////////////////////////////
386+
void DNAStorage::store_suit_block(const int block_number, const std::string& dept) {
387+
_suit_blocks_map[block_number] = dept;
388+
}
389+
390+
////////////////////////////////////////////////////////////////////
391+
// Function: get_suit_blocks
392+
// Access: Public
393+
// Description: Return the SuitBlocks map
394+
////////////////////////////////////////////////////////////////////
395+
SuitBlockMap DNAStorage::get_suit_blocks() const {
396+
return _suit_blocks_map;
397+
}
398+
399+
////////////////////////////////////////////////////////////////////
400+
// Function: is_suit_block
401+
// Access: Public
402+
// Description: Check if block number is in the SuitBlocks map
403+
////////////////////////////////////////////////////////////////////
404+
bool DNAStorage::is_suit_block(int block_number) const {
405+
return _suit_blocks_map.find(block_number) != _suit_blocks_map.end();
406+
}
407+
408+
////////////////////////////////////////////////////////////////////
409+
// Function: get_suit_block_track
410+
// Access: Public
411+
// Description: Get the department that's stored in the block number
412+
////////////////////////////////////////////////////////////////////
413+
std::string DNAStorage::get_suit_block_track(int block_number) const {
414+
// Try to find this code in the map
415+
SuitBlockMap::const_iterator i = _suit_blocks_map.find(block_number);
416+
if (i == _suit_blocks_map.end()) {
417+
dna_cat.error()
418+
<< "block number: " << block_number << " not found in SuitBlocks map" << std::endl;
419+
return "";
420+
}
421+
return (*i).second;
422+
}
423+
424+
381425
////////////////////////////////////////////////////////////////////
382426
// Function: store_block_number
383427
// Access: Public
@@ -487,7 +531,6 @@ int DNAStorage::get_num_block_door_pos_hprs() const {
487531
return _block_door_pos_hpr_map.size();
488532
}
489533

490-
491534
////////////////////////////////////////////////////////////////////
492535
// Function: get_door_pos_hpr_block_at
493536
// Access: Public

panda/src/toontown/dna/dnaStorage.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ typedef pmap< std::string, PT(TextFont) > FontMap;
4747
typedef pmap< int, int > BlockToZoneMap;
4848
typedef pmap< int, PosHpr > BlockToPosHprMap;
4949
typedef pmap< int, LMatrix4f > BlockToTransformMap;
50+
typedef pmap< int, std::string > SuitBlockMap;
5051
typedef pmap< int, std::string > BlockToTitleMap;
5152
typedef pmap< int, std::string > BlockToArticleMap;
5253
typedef pmap< int, std::string > BlockToBuildingTypeMap;
@@ -95,6 +96,7 @@ class EXPCL_TOONTOWN DNAStorage {
9596
int store_suit_point(PT(DNASuitPoint));
9697
int get_highest_suit_point_index();
9798
int remove_suit_point(PT(DNASuitPoint));
99+
void store_suit_block(const int block_number, std::string& dept);
98100
void store_block_number(const std::string& block, const std::string& zone_id);
99101
void store_block_door_pos_hpr(const std::string& block, const LPoint3f& pos, const LPoint3f& hpr);
100102
void store_block_sign_transform(const std::string& block, const LMatrix4f& mat);
@@ -121,6 +123,7 @@ class EXPCL_TOONTOWN DNAStorage {
121123
INLINE void reset_suit_points();
122124
INLINE void reset_battle_cells();
123125
INLINE void reset_block_numbers();
126+
INLINE void reset_suit_blocks();
124127
INLINE void reset_block_door_pos_hprs();
125128
INLINE void reset_block_sign_transforms();
126129
INLINE void reset_block_title();
@@ -144,6 +147,11 @@ class EXPCL_TOONTOWN DNAStorage {
144147
PT(DNAGroup) find_DNAGroup(PT(PandaNode)) const;
145148
PT(PandaNode) find_PandaNode(PT(DNAGroup)) const;
146149

150+
// Suit street functions
151+
SuitBlockMap get_suit_blocks() const;
152+
bool is_suit_block(int block_number) const;
153+
std::string get_suit_block_track(int block_number) const;
154+
147155
// Block number functions
148156
int get_zone_from_block_number(int block_number) const;
149157
int get_block_number_at(unsigned int index) const;
@@ -154,6 +162,7 @@ class EXPCL_TOONTOWN DNAStorage {
154162
int get_door_pos_hpr_block_at(unsigned int index) const;
155163
int get_num_block_door_pos_hprs() const;
156164

165+
157166
// Block sign pos hpr functions
158167
const LMatrix4f& get_sign_transform_from_block_number(int block_number) const;
159168
int get_sign_transform_block_at(unsigned int index) const;
@@ -253,6 +262,7 @@ class EXPCL_TOONTOWN DNAStorage {
253262
BlockToZoneMap _block_map;
254263
BlockToPosHprMap _block_door_pos_hpr_map;
255264
BlockToTransformMap _block_sign_transform_map;
265+
SuitBlockMap _suit_blocks_map;
256266
BlockToTitleMap _block_title_map;
257267
BlockToArticleMap _block_article_map;
258268
BlockToBuildingTypeMap _block_building_type_map;

0 commit comments

Comments
 (0)