============== idProgram::Restart Restores all variables to their initial value ============== */
| 2131 | ============== |
| 2132 | */ |
| 2133 | void idProgram::Restart( void ) { |
| 2134 | int i; |
| 2135 | |
| 2136 | idThread::Restart(); |
| 2137 | |
| 2138 | // |
| 2139 | // since there may have been a script loaded by the map or the user may |
| 2140 | // have typed "script" from the console, free up any types and vardefs that |
| 2141 | // have been allocated after the initial startup |
| 2142 | // |
| 2143 | for( i = top_types; i < types.Num(); i++ ) { |
| 2144 | delete types[ i ]; |
| 2145 | } |
| 2146 | types.SetNum( top_types, false ); |
| 2147 | |
| 2148 | for( i = top_defs; i < varDefs.Num(); i++ ) { |
| 2149 | delete varDefs[ i ]; |
| 2150 | } |
| 2151 | varDefs.SetNum( top_defs, false ); |
| 2152 | |
| 2153 | for( i = top_functions; i < functions.Num(); i++ ) { |
| 2154 | functions[ i ].Clear(); |
| 2155 | } |
| 2156 | functions.SetNum( top_functions ); |
| 2157 | |
| 2158 | statements.SetNum( top_statements ); |
| 2159 | fileList.SetNum( top_files, false ); |
| 2160 | filename.Clear(); |
| 2161 | |
| 2162 | // reset the variables to their default values |
| 2163 | numVariables = variableDefaults.Num(); |
| 2164 | for( i = 0; i < numVariables; i++ ) { |
| 2165 | variables[ i ] = variableDefaults[ i ]; |
| 2166 | } |
| 2167 | } |
| 2168 | |
| 2169 | /* |
| 2170 | ================ |