mirror of
				https://github.com/zenorogue/hyperrogue.git
				synced 2025-10-31 22:12:59 +00:00 
			
		
		
		
	replaced the ugly temps/tempval with tempmonsters
This commit is contained in:
		
							
								
								
									
										12
									
								
								game.cpp
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								game.cpp
									
									
									
									
									
								
							| @@ -129,8 +129,8 @@ vector<cell*> targets; // list of monster targets | |||||||
| // monsters of specific types to move | // monsters of specific types to move | ||||||
| vector<cell*> worms, ivies, ghosts, golems, hexsnakes; | vector<cell*> worms, ivies, ghosts, golems, hexsnakes; | ||||||
|  |  | ||||||
| vector<cell*> temps;  // temporary changes during bfs | /** temporary changes during bfs */ | ||||||
| vector<eMonster> tempval;  // restore temps | vector<pair<cell*, eMonster>> tempmonsters; | ||||||
|  |  | ||||||
| // a bit nicer way of DFS | // a bit nicer way of DFS | ||||||
| vector<int> reachedfrom; | vector<int> reachedfrom; | ||||||
| @@ -2754,7 +2754,8 @@ EX bool cellEdgeUnstable(cell *c, flagtype flags IS(0)) { | |||||||
|  |  | ||||||
| // find worms and ivies | // find worms and ivies | ||||||
| EX void settemp(cell *c) { | EX void settemp(cell *c) { | ||||||
|   temps.push_back(c); tempval.push_back(c->monst); c->monst = moNone; |   tempmonsters.emplace_back(c, (eMonster) c->monst); | ||||||
|  |   c->monst = moNone; | ||||||
|   } |   } | ||||||
|  |  | ||||||
| EX void findWormIvy(cell *c) { | EX void findWormIvy(cell *c) { | ||||||
| @@ -3135,7 +3136,7 @@ EX void bfs() { | |||||||
|   int dcs = isize(dcal); |   int dcs = isize(dcal); | ||||||
|   for(int i=0; i<dcs; i++) dcal[i]->cpdist = INFD; |   for(int i=0; i<dcs; i++) dcal[i]->cpdist = INFD; | ||||||
|   worms.clear(); ivies.clear(); ghosts.clear(); golems.clear();  |   worms.clear(); ivies.clear(); ghosts.clear(); golems.clear();  | ||||||
|   temps.clear(); tempval.clear(); targets.clear();  |   tempmonsters.clear(); targets.clear();  | ||||||
|   statuecount = 0; |   statuecount = 0; | ||||||
|   hexsnakes.clear();  |   hexsnakes.clear();  | ||||||
|  |  | ||||||
| @@ -3368,8 +3369,7 @@ EX void bfs() { | |||||||
|     for(int i=0; i<isize(dcal); i++) checkTide(dcal[i]); |     for(int i=0; i<isize(dcal); i++) checkTide(dcal[i]); | ||||||
|     }     |     }     | ||||||
|    |    | ||||||
|   int qtemp = isize(temps); |   for(auto& t: tempmonsters) t.first->monst = t.second; | ||||||
|   for(int i=0; i<qtemp; i++) temps[i]->monst = tempval[i]; |  | ||||||
|    |    | ||||||
|   buildAirmap(); |   buildAirmap(); | ||||||
|   } |   } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Zeno Rogue
					Zeno Rogue