This Trac instance is not used for development anymore!

We migrated our development workflow to git and Gitea.
To test the future redirection, replace trac by ariadne in the page URL.

Changeset 9610 for ps


Ignore:
Timestamp:
06/10/11 01:52:29 (14 years ago)
Author:
ben
Message:
 
Location:
ps/trunk/binaries/data
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • ps/trunk/binaries/data/mods/public/gui/common/functions_utility.js

    r8800 r9610  
    163163// ====================================================================
    164164
     165// Load map size data
     166function initMapSizes()
     167{
     168    var filename = "simulation/data/map_sizes.json";
     169    var sizes = {
     170        names: [],
     171        tiles: [],
     172        default: 0
     173    };
     174    var rawData = readFile(filename);
     175    if (!rawData)
     176        error("Failed to read map sizes file: "+filename);
     177   
     178    try
     179    {   // Catch nasty errors from JSON parsing
     180        // TODO: Need more info from the parser on why it failed: line number, position, etc!
     181        var data = JSON.parse(rawData);
     182        if (!data || !data.Sizes)
     183            error("Failed to parse map sizes in: "+filename+" (check for valid JSON data)");
     184       
     185        for (var i = 0; i < data.Sizes.length; ++i)
     186        {
     187            sizes.names.push(data.Sizes[i].LongName);
     188            sizes.tiles.push(data.Sizes[i].Tiles);
     189           
     190            if (data.Sizes[i].Default)
     191                sizes.default = i;
     192        }
     193    }
     194    catch(err)
     195    {
     196        error(err.toString()+": parsing map sizes in "+filename);
     197    }
     198   
     199    return sizes;
     200}
     201
     202// ====================================================================
     203
    165204// Convert integer color values to string (for use in GUI objects)
    166205function iColorToString(color)
  • ps/trunk/binaries/data/mods/public/gui/gamesetup/gamesetup.js

    r9507 r9610  
    11////////////////////////////////////////////////////////////////////////////////////////////////
    22// Constants
    3 // TODO: Move these into common location (other scripts may need)
    4 const MAP_SIZES_TEXT = ["Tiny (2 player)", "Small (3 player)", "Medium (4 player)", "Normal (6 player)", "Large (8 player)", "Very Large", "Giant"];
    5 const MAP_SIZES_DATA = [128, 192, 256, 320, 384, 448, 512];
    6 const MAP_SIZES_DEFAULTIDX = 2;
    7 
     3// TODO: Move these somewhere like simulation\data\game_types.json, Atlas needs them too
    84const VICTORY_TEXT = ["Conquest", "None"];
    95const VICTORY_DATA = ["conquest", "endless"];
     
    3329};
    3430
     31var g_MapSizes = {};
     32
    3533var g_AIs = [];
    3634
     
    8583    g_DefaultPlayerData = initPlayerDefaults();
    8684    g_DefaultPlayerData.shift();
     85   
     86    g_MapSizes = initMapSizes();
    8787
    8888    // Init civs
     
    139139       
    140140        var mapSize = getGUIObjectByName("mapSize");
    141         mapSize.list = MAP_SIZES_TEXT;
    142         mapSize.list_data = MAP_SIZES_DATA;
     141        mapSize.list = g_MapSizes.names;
     142        mapSize.list_data = g_MapSizes.tiles;
    143143        mapSize.onSelectionChange = function()
    144144        {   // Update attributes so other players can see change
    145145            if (this.selected != -1)
    146146            {
    147                 g_GameAttributes.settings.Size = MAP_SIZES_DATA[this.selected];
     147                g_GameAttributes.settings.Size = g_MapSizes.tiles[this.selected];
    148148            }
    149149           
     
    769769    var numPlayersBox = getGUIObjectByName("numPlayersBox");
    770770
    771     var sizeIdx = (MAP_SIZES_DATA.indexOf(mapSettings.Size) != -1 ? MAP_SIZES_DATA.indexOf(mapSettings.Size) : MAP_SIZES_DEFAULTIDX);
     771    var sizeIdx = (g_MapSizes.tiles.indexOf(mapSettings.Size) != -1 ? g_MapSizes.tiles.indexOf(mapSettings.Size) : g_MapSizes.default);
    772772    var victoryIdx = (VICTORY_DATA.indexOf(mapSettings.GameType) != -1 ? VICTORY_DATA.indexOf(mapSettings.GameType) : VICTORY_DEFAULTIDX);
    773773   
     
    797797        else
    798798        {   // Client
    799             mapSizeText.caption = "Map size: " + MAP_SIZES_TEXT[sizeIdx];
     799            mapSizeText.caption = "Map size: " + g_MapSizes.names[sizeIdx];
    800800            revealMapText.caption = "Reveal map: " + (mapSettings.RevealMap ? "Yes" : "No");
    801801            victoryConditionText.caption = "Victory condition: " + VICTORY_TEXT[victoryIdx];
  • ps/trunk/binaries/data/tools/atlas/lists.xml

    r9271 r9610  
    2626
    2727  <animations>
    28 
    29     <item>attack1     </item>
    30     <item>attack2     </item>
    31     <item>build       </item>
    32     <item>corpse      </item>
    33     <item>death       </item>
    34     <item>gather_fruit</item>
    35     <item>gather_grain</item>
    36     <item>gather_wood </item>
    37     <item>gather_stone</item>
    38     <item>gather_metal</item>
    39     <item>gather_ruins</item>
     28    <item>idle          </item>
     29    <item>walk          </item>
     30    <item>run           </item>
     31    <item>melee         </item>
     32    <item>death         </item>
     33    <item>build         </item>
     34    <item>gather_fruit  </item>
     35    <item>gather_grain  </item>
     36    <item>gather_meat   </item>
     37    <item>gather_tree   </item>
     38    <item>gather_rock   </item>
     39    <item>gather_ore    </item>
     40    <item>gather_ruins  </item>
    4041    <item>gather_treasure</item>
    41     <item>idle        </item>
    42     <item>melee       </item>
    43     <item>run         </item>
    44     <item>walk        </item>
    4542  </animations>
    4643
     
    5754  </playercolours>
    5855 
    59   <mapsizes>
    60     <size name="Tiny" tiles="128"/>
    61     <size name="Small" tiles="192"/>
    62     <size name="Medium" tiles="256"/>
    63     <size name="Normal" tiles="320"/>
    64     <size name="Large" tiles="384"/>
    65     <size name="Very Large" tiles="448"/>
    66     <size name="Giant" tiles="512"/>
    67   </mapsizes>
    68 
    6956</lists>
Note: See TracChangeset for help on using the changeset viewer.