powergrid-viewer 1.9.5 → 1.9.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "powergrid-viewer",
3
- "version": "1.9.5",
3
+ "version": "1.9.7",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/boardgamers/powergrid.git",
@@ -18,7 +18,7 @@
18
18
  "vue": "^2.6.11",
19
19
  "vue-class-component": "^7.2.3",
20
20
  "vue-property-decorator": "^8.4.2",
21
- "powergrid-engine": "1.13.4"
21
+ "powergrid-engine": "1.13.6"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@types/assert": "^1.4.7",
@@ -56,6 +56,7 @@
56
56
  :polygons="G.map.polygons"
57
57
  :buildableCities="getBuildableCities()"
58
58
  :devBackdrop="G.map.devBackdrop"
59
+ :mapRotation="G.map.mapRotation || 0"
59
60
  @build="build($event)"
60
61
  />
61
62
 
@@ -458,6 +459,7 @@ import Resources from './boards/Resources.vue';
458
459
  import { LogMove } from 'powergrid-engine/src/log';
459
460
  import { Phase, PowerPlant, PowerPlantType, ResourceType } from 'powergrid-engine/src/gamestate';
460
461
  import { City } from 'powergrid-engine/src/maps';
462
+ import { countNetworks } from 'powergrid-engine/src/available-moves';
461
463
 
462
464
  @Component({
463
465
  created(this: Game) {
@@ -1036,7 +1038,16 @@ export default class Game extends Vue {
1036
1038
  }
1037
1039
 
1038
1040
  playerHasUsedFreeJump(playerIndex: number): boolean {
1039
- return !!this.G?.players[playerIndex]?.usedFreeJump;
1041
+ const player = this.G?.players[playerIndex];
1042
+ if (!player) return false;
1043
+ // Primary: trust the engine flag (set for all new games).
1044
+ if (player.usedFreeJump) return true;
1045
+ // Fallback: detect from network topology for game states where
1046
+ // usedFreeJump wasn't tracked (games started before that field existed).
1047
+ if (player.cities.length >= 2) {
1048
+ return countNetworks(this.G!.map.connections, player.cities.map(c => c.name)) >= 2;
1049
+ }
1050
+ return false;
1040
1051
  }
1041
1052
 
1042
1053
  canBuild(city: City) {
@@ -113,6 +113,13 @@
113
113
  fill="black"
114
114
  :x="(getX1(connection) + getX2(connection)) / 2"
115
115
  :y="(getY1(connection) + getY2(connection)) / 2"
116
+ :transform="
117
+ mapRotation
118
+ ? `rotate(${-mapRotation}, ${(getX1(connection) + getX2(connection)) / 2}, ${
119
+ (getY1(connection) + getY2(connection)) / 2
120
+ })`
121
+ : undefined
122
+ "
116
123
  >
117
124
  {{ connection.cost }}
118
125
  </text>
@@ -167,6 +174,7 @@
167
174
  font-weight="bold"
168
175
  fill="black"
169
176
  text-anchor="middle"
177
+ :transform="mapRotation ? `rotate(${-mapRotation}, ${city.x - 20}, ${city.y + 19})` : undefined"
170
178
  >10</text
171
179
  >
172
180
  <!-- [15,20] city: X at top-middle -->
@@ -231,6 +239,7 @@ export default class Map extends Vue {
231
239
  @Prop() playerColors?: string[];
232
240
  @Prop() buildableCities?: string[];
233
241
  @Prop() devBackdrop?: { src: string; width: number; height: number; opacity?: number };
242
+ @Prop({ default: 0 }) mapRotation!: number;
234
243
 
235
244
  @Inject() preferences!: Preferences;
236
245