mirror of
				https://github.com/zenorogue/hyperrogue.git
				synced 2025-10-31 05:52:59 +00:00 
			
		
		
		
	removed redundant pre-changes orbused rollback, and made it more elegant in movegolem
This commit is contained in:
		| @@ -200,8 +200,6 @@ EX bool monstersnear_aux() { | |||||||
|   changes.value_set(passive_switch, (gold() & 1) ? moSwitch1 : moSwitch2); |   changes.value_set(passive_switch, (gold() & 1) ? moSwitch1 : moSwitch2); | ||||||
|   multi::cpid++; |   multi::cpid++; | ||||||
|   bool b = false; |   bool b = false; | ||||||
|   bool recorduse[ittypes]; |  | ||||||
|   for(int i=0; i<ittypes; i++) recorduse[i] = orbused[i]; |  | ||||||
|   if(multi::cpid == multi::players || multi::players == 1 || multi::checkonly) { |   if(multi::cpid == multi::players || multi::players == 1 || multi::checkonly) { | ||||||
|  |  | ||||||
|     if(shmup::delayed_safety) return false; |     if(shmup::delayed_safety) return false; | ||||||
| @@ -235,7 +233,6 @@ EX bool monstersnear_aux() { | |||||||
|     } |     } | ||||||
|   else b = !multimove(); |   else b = !multimove(); | ||||||
|   multi::cpid--; |   multi::cpid--; | ||||||
|   for(int i=0; i<ittypes; i++) orbused[i] = recorduse[i]; |  | ||||||
|   return b; |   return b; | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @@ -296,10 +293,6 @@ EX void checkmove() { | |||||||
|  |  | ||||||
|   if(multi::players > 1 && !multi::checkonly) return; |   if(multi::players > 1 && !multi::checkonly) return; | ||||||
|   if(hardcore) return; |   if(hardcore) return; | ||||||
|   bool orbusedbak[ittypes]; |  | ||||||
|    |  | ||||||
|   // do not activate orbs! |  | ||||||
|   for(int i=0; i<ittypes; i++) orbusedbak[i] = orbused[i]; |  | ||||||
|    |    | ||||||
|   legalmoves.clear(); legalmoves.resize(cwt.at->type+1, false); |   legalmoves.clear(); legalmoves.resize(cwt.at->type+1, false); | ||||||
|   move_issues.clear(); move_issues.resize(cwt.at->type, 0); |   move_issues.clear(); move_issues.resize(cwt.at->type, 0); | ||||||
| @@ -356,7 +349,6 @@ EX void checkmove() { | |||||||
|     } |     } | ||||||
|   items[itWarning]-=2; |   items[itWarning]-=2; | ||||||
|  |  | ||||||
|   for(int i=0; i<ittypes; i++) orbused[i] = orbusedbak[i]; |  | ||||||
|   if(recallCell.at && !markOrb(itOrbRecall)) activateRecall();   |   if(recallCell.at && !markOrb(itOrbRecall)) activateRecall();   | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -5115,10 +5115,7 @@ EX void drawthemap() { | |||||||
|     cellwalker cw = cwt; bool f = flipplayer; |     cellwalker cw = cwt; bool f = flipplayer; | ||||||
|     items[itWarning]+=2; |     items[itWarning]+=2; | ||||||
|      |      | ||||||
|     bool recorduse[ittypes]; |  | ||||||
|     for(int i=0; i<ittypes; i++) recorduse[i] = orbused[i]; |  | ||||||
|     movepcto(mousedest.d, mousedest.subdir, true); |     movepcto(mousedest.d, mousedest.subdir, true); | ||||||
|     for(int i=0; i<ittypes; i++) orbused[i] = recorduse[i]; |  | ||||||
|     items[itWarning] -= 2; |     items[itWarning] -= 2; | ||||||
|     if(cw.spin != cwt.spin) mirror::act(-mousedest.d, mirror::SPINSINGLE); |     if(cw.spin != cwt.spin) mirror::act(-mousedest.d, mirror::SPINSINGLE); | ||||||
|     cwt = cw; flipplayer = f; |     cwt = cw; flipplayer = f; | ||||||
|   | |||||||
| @@ -1686,8 +1686,7 @@ EX void movegolems(flagtype flags) { | |||||||
|       if(m == moGolem) qg++; |       if(m == moGolem) qg++; | ||||||
|       if(m == moFriendlyGhost) markOrb(itOrbUndeath); |       if(m == moFriendlyGhost) markOrb(itOrbUndeath); | ||||||
|  |  | ||||||
|       bool recorduse[ittypes]; |       auto recorduse = orbused; | ||||||
|       for(int i=0; i<ittypes; i++) recorduse[i] = orbused[i]; |  | ||||||
|  |  | ||||||
|       DEBB(DF_TURN, ("stayval")); |       DEBB(DF_TURN, ("stayval")); | ||||||
|       int bestv = stayvalue(m, c); |       int bestv = stayvalue(m, c); | ||||||
| @@ -1711,7 +1710,7 @@ EX void movegolems(flagtype flags) { | |||||||
|           } |           } | ||||||
|         } |         } | ||||||
|  |  | ||||||
|       for(int i=0; i<ittypes; i++) orbused[i] = recorduse[i]; |       orbused = recorduse; | ||||||
|        |        | ||||||
| //    printf("stayvalue = %d, result = %d, bq = %d\n", stayvalue(m,c), bestv, bq); | //    printf("stayvalue = %d, result = %d, bq = %d\n", stayvalue(m,c), bestv, bq); | ||||||
|          |          | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Zeno Rogue
					Zeno Rogue