public structures.memory[] findAllSince(byte type, int turns) { structures.memory[] retour = new xycv_ppc.structures.memory[0]; for (int i = list.Length - 1; i >= 0; i--) { if (list[i].turn < player.game.curTurn - turns) { break; } else if (list[i].type == type) { structures.memory[] buffer = retour; retour = new xycv_ppc.structures.memory[buffer.Length + 1]; for (int j = 0; j < buffer.Length; j++) { retour[j] = buffer[j]; } retour[buffer.Length] = list[i]; } } return(retour); }
public structures.memory findLatest(byte type) { for ( int i = list.Length - 1; i >= 0; i-- ) if ( list[ i ].type == type ) return list[ i ]; structures.memory retour = new xycv_ppc.structures.memory(); retour.ind = new int[ 0 ]; return retour; }
public structures.memory findLatest(byte type) { for (int i = list.Length - 1; i >= 0; i--) { if (list[i].type == type) { return(list[i]); } } structures.memory retour = new xycv_ppc.structures.memory(); retour.ind = new int[0]; return(retour); }
public structures.memory[] findAllSinceAndDeletePrevious(byte type, int turns) { structures.memory[] retour = new xycv_ppc.structures.memory[0]; bool[] toBeRemoved = new bool[list.Length]; int totToBeRemoved = 0; for (int i = list.Length - 1; i >= 0; i--) { if (list[i].turn < player.game.curTurn - turns) { if (list[i].type == type) { totToBeRemoved++; toBeRemoved[i] = true; } } else if (list[i].type == type) { structures.memory[] buffer = retour; retour = new xycv_ppc.structures.memory[buffer.Length + 1]; for (int j = 0; j < buffer.Length; j++) { retour[j] = buffer[j]; } retour[buffer.Length] = list[i]; } } if (totToBeRemoved > 0) { structures.memory[] buffer = list; list = new structures.memory[buffer.Length - totToBeRemoved]; for (int i = 0, j = 0; i < buffer.Length; i++) { if (!toBeRemoved[i]) { list[j] = buffer[i]; j++; } } } return(retour); }
public structures.memory findInTheLast(byte type, int turn) { for (int i = list.Length - 1; i >= 0; i--) { if (list[i].type == type) { return(list[i]); } else if (list[i].turn < player.game.curTurn - turn) { break; } } structures.memory retour = new xycv_ppc.structures.memory(); retour.ind = new int[0]; return(retour); }
public structures.memory[] findAllSince(byte type, int turns) { structures.memory[] retour = new xycv_ppc.structures.memory[ 0 ]; for ( int i = list.Length - 1; i >= 0; i-- ) if ( list[ i ].turn < player.game.curTurn - turns ) break; else if ( list[ i ].type == type ) { structures.memory[] buffer = retour; retour = new xycv_ppc.structures.memory[ buffer.Length + 1 ]; for ( int j = 0; j < buffer.Length; j++ ) retour[ j ] = buffer[ j ]; retour[ buffer.Length ] = list[ i ]; } return retour; }
public structures.memory findAndDeleteLatest(byte type) { int foundAt = -1; for (int i = list.Length - 1; i >= 0; i--) { if (list[i].type == type) { foundAt = i; break; } } structures.memory retour = new xycv_ppc.structures.memory(); if (foundAt != -1) { structures.memory[] buffer = new structures.memory[list.Length]; list = new structures.memory[buffer.Length - 1]; for (int i = foundAt; i < list.Length; i++) { list[i] = buffer[i + 1]; } for (int i = 0; i < foundAt; i++) { list[i] = buffer[i]; } } else { retour = new xycv_ppc.structures.memory(); retour.ind = new int[0]; } return(retour); }
public structures.memory[] findAll(byte type) { structures.memory[] retour = new xycv_ppc.structures.memory[list.Length]; int pos = 0; for (int i = 0; i < list.Length; i++) { if (list[i].type == type) { retour[pos] = list[i]; pos++; } } structures.memory[] retour1 = new xycv_ppc.structures.memory[pos]; for (int i = 0; i < retour1.Length; i++) { retour1[i] = retour[i]; } return(retour1); }
public structures.memory findInTheLast(byte type, int turn) { for ( int i = list.Length - 1; i >= 0; i-- ) if ( list[ i ].type == type ) return list[ i ]; else if ( list[ i ].turn < player.game.curTurn - turn ) break; structures.memory retour = new xycv_ppc.structures.memory(); retour.ind = new int[ 0 ]; return retour; }
public structures.memory[] findAllSinceAndDeletePrevious(byte type, int turns ) { structures.memory[] retour = new xycv_ppc.structures.memory[ 0 ]; bool[] toBeRemoved = new bool[ list.Length ]; int totToBeRemoved = 0; for ( int i = list.Length - 1; i >= 0; i-- ) if ( list[ i ].turn < player.game.curTurn - turns ) { if ( list[ i ].type == type ) { totToBeRemoved ++; toBeRemoved[ i ] = true; } } else if ( list[ i ].type == type ) { structures.memory[] buffer = retour; retour = new xycv_ppc.structures.memory[ buffer.Length + 1 ]; for ( int j = 0; j < buffer.Length; j++ ) retour[ j ] = buffer[ j ]; retour[ buffer.Length ] = list[ i ]; } if ( totToBeRemoved > 0 ) { structures.memory[] buffer = list; list = new structures.memory[ buffer.Length - totToBeRemoved ]; for ( int i = 0, j = 0; i < buffer.Length; i++ ) if ( !toBeRemoved[ i ] ) { list[ j ] = buffer[ i ]; j++; } } return retour; }
public structures.memory findAndDeleteLatest(byte type) { int foundAt = -1; for ( int i = list.Length - 1; i >= 0; i-- ) if ( list[ i ].type == type ) { foundAt = i; break; } structures.memory retour = new xycv_ppc.structures.memory(); if ( foundAt != -1 ) { structures.memory[] buffer = new structures.memory[ list.Length ]; list = new structures.memory[ buffer.Length - 1 ]; for ( int i = foundAt; i < list.Length; i++ ) list[ i ] = buffer[ i + 1 ]; for ( int i = 0; i < foundAt; i++ ) list[ i ] = buffer[ i ]; } else { retour = new xycv_ppc.structures.memory(); retour.ind = new int[ 0 ]; } return retour; }
public structures.memory[] findAll(byte type) { structures.memory[] retour = new xycv_ppc.structures.memory[ list.Length ]; int pos = 0; for ( int i = 0; i < list.Length; i++ ) if ( list[ i ].type == type ) { retour[ pos ] = list[ i ]; pos++; } structures.memory[] retour1 = new xycv_ppc.structures.memory[ pos ]; for ( int i = 0; i < retour1.Length; i++ ) retour1[ i ] = retour[ i ]; return retour1; }