Ticket #1210: input.js.patch
File input.js.patch, 3.3 KB (added by , 12 years ago) |
---|
-
input.js
269 269 break; 270 270 case "setup-trade-route": 271 271 // If ground or sea trade possible 272 if (( entState.trader && hasClass(entState, "Organic") && (playerOwned || allyOwned) && hasClass(targetState, "Market")) ||273 (entState.trader && hasClass(entState, "Ship") && (playerOwned || allyOwned) && hasClass(targetState, "NavalMarket"))) 272 if ((!targetState.foundation) && ((entState.trader && hasClass(entState, "Organic") && (playerOwned || allyOwned) && hasClass(targetState, "Market")) || 273 (entState.trader && hasClass(entState, "Ship") && (playerOwned || allyOwned) && hasClass(targetState, "NavalMarket")))) 274 274 { 275 275 var tradingData = {"trader": entState.id, "target": target}; 276 276 var tradingDetails = Engine.GuiInterfaceCall("GetTradingDetails", tradingData); 277 277 var tooltip; 278 if (tradingDetails === null) 279 return {"possible": false}; 278 280 switch (tradingDetails.type) 279 281 { 280 282 case "is first": … … 376 378 { 377 379 target = targets[0]; 378 380 } 379 381 //targetState = target; 380 382 if (preSelectedAction != ACTION_NONE) 381 383 { 382 384 switch (preSelectedAction) … … 1152 1154 // Called by GUI when user changes preferred trading goods 1153 1155 function selectTradingPreferredGoods(data) 1154 1156 { 1155 Engine.PostNetworkCommand({"type": "select-trading-goods", " trader": data.trader, "preferredGoods": data.preferredGoods});1157 Engine.PostNetworkCommand({"type": "select-trading-goods", "entities": data.entities, "preferredGoods": data.preferredGoods}); 1156 1158 } 1157 1159 1158 1160 // Called by GUI when user clicks exchange resources button … … 1175 1177 } 1176 1178 1177 1179 // Called by GUI when user clicks training button 1178 function addToTrainingQueue(entity, trainEntType )1180 function addToTrainingQueue(entity, trainEntType, selection) 1179 1181 { 1180 1182 if (Engine.HotkeyIsPressed("session.batchtrain")) 1181 1183 { 1182 if ( inputState == INPUT_BATCHTRAINING)1184 if (selection.length == 1) 1183 1185 { 1184 // If we're already creating a batch of this unit, then just extend it 1185 if (batchTrainingEntity == entity && batchTrainingType == trainEntType) 1186 if (inputState == INPUT_BATCHTRAINING) 1186 1187 { 1187 batchTrainingCount += batchIncrementSize; 1188 return; 1188 // If we're already creating a batch of this unit, then just extend it 1189 if (batchTrainingEntity == entity && batchTrainingType == trainEntType) 1190 { 1191 batchTrainingCount += batchIncrementSize; 1192 return; 1193 } 1194 // Otherwise start a new one 1195 else 1196 { 1197 flushTrainingQueueBatch(); 1198 // fall through to create the new batch 1199 } 1189 1200 } 1190 // Otherwise start a new one1191 else1192 {1193 flushTrainingQueueBatch();1194 // fall through to create the new batch1195 }1196 1201 } 1202 else 1203 { 1204 //create a new batch 1205 Engine.PostNetworkCommand({"type": "train", "entity": entity, "template": trainEntType, "count": batchIncrementSize, "entities": selection}); 1206 } 1197 1207 inputState = INPUT_BATCHTRAINING; 1198 1208 batchTrainingEntity = entity; 1199 1209 batchTrainingType = trainEntType; … … 1202 1212 else 1203 1213 { 1204 1214 // Non-batched - just create a single entity 1205 Engine.PostNetworkCommand({"type": "train", "entity": entity, "template": trainEntType, "count": 1 });1215 Engine.PostNetworkCommand({"type": "train", "entity": entity, "template": trainEntType, "count": 1, "entities": selection}); 1206 1216 } 1207 1217 } 1208 1218