| 1623 | } |
| 1624 | |
| 1625 | void ASModule::LoadGlobalVars() { |
| 1626 | const std::list<VarStorage>& storage = saved_vars_; |
| 1627 | std::list<ScriptObjectInstanceHandleRemap> app_obj_handle_offset; |
| 1628 | |
| 1629 | std::list<VarStorage>::const_iterator iter = storage.begin(); |
| 1630 | for (; iter != storage.end(); ++iter) { |
| 1631 | const VarStorage& vs = (*iter); |
| 1632 | int index = module_->GetGlobalVarIndexByName(vs.name.c_str()); |
| 1633 | void* ptr = module_->GetAddressOfGlobalVar(index); |
| 1634 | if (ptr) { |
| 1635 | LoadVar(_vp_Global, module_, index, vs, ptr, saved_handle_vars_, app_obj_handle_offset, module_); |
| 1636 | } |
| 1637 | } |
| 1638 | |
| 1639 | std::list<ScriptObjectInstanceHandleRemap>::iterator soihr_it; |
| 1640 | std::list<ScriptObjectInstance>::iterator hvs_it; |
| 1641 | for (soihr_it = app_obj_handle_offset.begin(); |
| 1642 | soihr_it != app_obj_handle_offset.end(); |
| 1643 | soihr_it++) { |
| 1644 | for (hvs_it = saved_handle_vars_.begin(); |
| 1645 | hvs_it != saved_handle_vars_.end(); |
| 1646 | hvs_it++) { |
| 1647 | if (hvs_it->ptr == soihr_it->orig_ptr) { |
| 1648 | void* ptr = NULL; |
| 1649 | switch (soihr_it->var_type) { |
| 1650 | case _vp_Global: |
| 1651 | ptr = static_cast<asIScriptModule*>(soihr_it->parent_ptr)->GetAddressOfGlobalVar(soihr_it->parent_index); |
| 1652 | break; |
| 1653 | case _vp_ScriptObject: |
| 1654 | ptr = static_cast<asIScriptObject*>(soihr_it->parent_ptr)->GetAddressOfProperty(soihr_it->parent_index); |
| 1655 | break; |
| 1656 | case _vp_Array: |
| 1657 | ptr = static_cast<CScriptArray*>(soihr_it->parent_ptr)->At(soihr_it->parent_index); |
| 1658 | break; |
| 1659 | } |
| 1660 | |
| 1661 | if (hvs_it->new_ptr && ptr) { |
| 1662 | (*(asIScriptObject**)ptr) = hvs_it->new_ptr; |
| 1663 | (*(asIScriptObject**)ptr)->AddRef(); |
| 1664 | } else { |
| 1665 | LOGE << "No pointer created for ScriptObjectType, it should have." << std::endl; |
| 1666 | } |
| 1667 | } |
| 1668 | } |
| 1669 | } |
| 1670 | } |
| 1671 | |
| 1672 | void ASModule::Recompile() { |
| 1673 | PROFILER_ZONE(g_profiler_ctx, "Recompile"); |
no test coverage detected