/** ** Define the group. ** ** @param l Lua state. */ static int CclGroup(lua_State *l) { int i; CUnitGroup *grp; int args; int j; LuaCheckArgs(l, 3); InitGroups(); grp = &Groups[(int)LuaToNumber(l, 1)]; grp->NumUnits = LuaToNumber(l, 2); i = 0; args = lua_objlen(l, 3); for (j = 0; j < args; ++j) { const char *str; lua_rawgeti(l, 3, j + 1); str = LuaToString(l, -1); lua_pop(l, 1); grp->Units[i++] = UnitSlots[strtol(str + 1, NULL, 16)]; } return 0; }
BOOL CGroupDlg::OnInitDialog() { CDialog::OnInitDialog(); m_imgList.Create(IDB_BITMAP_GROUPS, 16, 0, ILC_COLOR); m_wndTree.SetImageList(&m_imgList, TVSIL_NORMAL); InitGroups(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
void blSignalEventTable::LoadAllEventTables() { if ( m_EventMap.size() ) { return; } m_FilePathVector.push_back( GDFFilePathName ); m_FilePathVector.push_back( CISTIBFilePathName ); for ( unsigned i = 0 ; i < m_FilePathVector.size() ; i++ ) { LoadEventTable( m_FilePathVector[ i ] ); } InitGroups( ); SelectAll(); }
/** ** Define the group. ** ** @param l Lua state. */ static int CclGroup(lua_State *l) { LuaCheckArgs(l, 3); InitGroups(); const int grpNum = LuaToNumber(l, 1); if (NUM_GROUPS <= grpNum) { LuaError(l, "grpIndex out of bound"); } CUnitGroup &grp = Groups[grpNum]; grp.NumUnits = LuaToNumber(l, 2); int i = 0; const int args = lua_rawlen(l, 3); for (int j = 0; j < args; ++j) { const char *str = LuaToString(l, 3, j + 1); grp.Units[i++] = &UnitManager.GetSlotUnit(strtol(str + 1, NULL, 16)); } return 0; }
void __fastcall TConstructorForm::FormActivate(TObject *Sender) { InitGroups(); InitRef(); if (ListBoxGrops->ItemIndex == -1) { OraQueryGrops->Close(); ButtonAddField->Enabled = false; ButtonDelField->Enabled = false; ButtonChange->Enabled = false; } if (ListBoxRef->ItemIndex == -1) { OraTableRef->Close(); ButtonAddRefVal->Enabled = false; ButtonDelRefVal->Enabled = false; } m_update = false; }
/** ** CreateGame. ** ** Load map, graphics, sounds, etc ** ** @param filename map filename ** @param map map loaded ** ** @todo FIXME: use in this function InitModules / LoadModules!!! */ void CreateGame(const char *filename, CMap *map) { int i; if (SaveGameLoading) { SaveGameLoading = 0; // Load game, already created game with Init/LoadModules CommandLog(NULL, NoUnitP, FlushCommands, -1, -1, NoUnitP, NULL, -1); return; } InitVisionTable(); // build vision table for fog of war InitPlayers(); if (Map.Info.Filename.empty() && filename) { char path[PATH_MAX]; Assert(filename); LibraryFileName(filename, path, sizeof(path)); if(strcasestr(filename, ".smp")) { LuaLoadFile(path); } } for (i = 0; i < PlayerMax; ++i) { int playertype = Map.Info.PlayerType[i]; // Network games only: if (GameSettings.Presets[i].Type != SettingsPresetMapDefault) { playertype = GameSettings.Presets[i].Type; } CreatePlayer(playertype); } if (filename) { if (CurrentMapPath != filename) { strcpy_s(CurrentMapPath, sizeof(CurrentMapPath), filename); } // // Load the map. // InitUnitTypes(1); LoadMap(filename, map); // HARDCODING FOG OF WAR TRUE. It doesn't currently use preferences on a game restart - Should be changed map->NoFogOfWar = true; Map.Reveal(); } GameCycle = 0; FastForwardCycle = 0; SyncHash = 0; InitSyncRand(); if (IsNetworkGame()) { // Prepare network play DebugPrint("Client setup: Calling InitNetwork2\n"); InitNetwork2(); } else { if (LocalPlayerName && strcmp(LocalPlayerName, "Anonymous")) { ThisPlayer->SetName(LocalPlayerName); } } CallbackMusicOn(); #if 0 GamePaused = true; #endif if (FlagRevealMap) { Map.Reveal(); } // // Setup game types // // FIXME: implement more game types if (GameSettings.GameType != SettingsGameTypeMapDefault) { switch (GameSettings.GameType) { case SettingsGameTypeMelee: break; case SettingsGameTypeFreeForAll: GameTypeFreeForAll(); break; case SettingsGameTypeTopVsBottom: GameTypeTopVsBottom(); break; case SettingsGameTypeLeftVsRight: GameTypeLeftVsRight(); break; case SettingsGameTypeManVsMachine: GameTypeManVsMachine(); break; case SettingsGameTypeManTeamVsMachine: GameTypeManTeamVsMachine(); // Future game type ideas #if 0 case SettingsGameTypeOneOnOne: break; case SettingsGameTypeCaptureTheFlag: break; case SettingsGameTypeGreed: break; case SettingsGameTypeSlaughter: break; case SettingsGameTypeSuddenDeath: break; case SettingsGameTypeTeamMelee: break; case SettingsGameTypeTeamCaptureTheFlag: break; #endif } } // // Graphic part // SetPlayersPalette(); InitIcons(); LoadIcons(); LoadCursors(PlayerRaces.Name[ThisPlayer->Race]); UnitUnderCursor = NoUnitP; InitMissileTypes(); #ifndef DYNAMIC_LOAD LoadMissileSprites(); #endif InitConstructions(); LoadConstructions(); LoadUnitTypes(); LoadDecorations(); InitSelections(); InitUserInterface(); UI.Load(); UI.Minimap.Create(); Map.Init(); PreprocessMap(); // // Sound part // LoadUnitSounds(); MapUnitSounds(); if (SoundEnabled()) { InitSoundClient(); } // // Spells // InitSpells(); // // Init units' groups // InitGroups(); // // Init players? // DebugPlayers(); PlayersInitAi(); // // Upgrades // InitUpgrades(); // // Dependencies // InitDependencies(); // // Buttons (botpanel) // InitButtons(); // // Triggers // InitTriggers(); SetDefaultTextColors(UI.NormalFontColor, UI.ReverseFontColor); #if 0 if (!UI.SelectedViewport) { UI.SelectedViewport = UI.Viewports; } #endif UI.SelectedViewport->Center( ThisPlayer->StartX, ThisPlayer->StartY, TileSizeX / 2, TileSizeY / 2); // // Various hacks wich must be done after the map is loaded. // // FIXME: must be done after map is loaded InitAStar(); // // FIXME: The palette is loaded after the units are created. // FIXME: This loops fixes the colors of the units. // for (i = 0; i < NumUnits; ++i) { // I don't really think that there can be any rescued // units at this point. if (Units[i]->RescuedFrom) { Units[i]->Colors = &Units[i]->RescuedFrom->UnitColors; } else { Units[i]->Colors = &Units[i]->Player->UnitColors; } } GameResult = GameNoResult; CommandLog(NULL, NoUnitP, FlushCommands, -1, -1, NoUnitP, NULL, -1); Video.ClearScreen(); }