[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus/src editor/editloop.c include/icons.h...
From: |
address@hidden |
Subject: |
[Stratagus-CVS] stratagus/src editor/editloop.c include/icons.h... |
Date: |
31 Jan 2004 02:52:14 +1100 |
CVSROOT: /home/strat
Module name: stratagus
Changes by: <address@hidden> 04/01/31 02:52:14
Modified files:
src/editor : editloop.c
src/include : icons.h
src/ui : icons.c
src/unit : upgrade.c
Log message:
Applied jarod's patches.
Patches:
Index: stratagus/src/editor/editloop.c
diff -u stratagus/src/editor/editloop.c:1.161
stratagus/src/editor/editloop.c:1.162
--- stratagus/src/editor/editloop.c:1.161 Thu Jan 29 21:20:08 2004
+++ stratagus/src/editor/editloop.c Sat Jan 31 02:52:11 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: editloop.c,v 1.161 2004/01/29 10:20:08 nobody_ Exp $
+// $Id: editloop.c,v 1.162 2004/01/30 15:52:11 nobody_ Exp $
//@{
@@ -73,6 +73,10 @@
-- Variables
----------------------------------------------------------------------------*/
+global int IconWidth; /// Icon width in panels
+global int IconHeight; /// Icon height in panels
+
+
global char EditorRunning; /// True editor is running
global char EditorMapLoaded; /// Map loaded in editor
@@ -345,7 +349,7 @@
x += IconHeight + 2;
}
x = TheUI.ButtonPanelX + 10;
- while (x < TheUI.ButtonPanelX + 146) {
+ while (x < TheUI.ButtonPanelX + TheUI.ButtonPanel.Graphic->Width) {
count += i;
x += IconWidth + 8;
}
@@ -353,6 +357,32 @@
}
/**
+** Calculate the max height and the max widht of icons,
+** and assign them to IconHeight and IconWidth
+*/
+local void CalculateMaxIconSize()
+{
+ int i;
+ const UnitType* type;
+ const Icon* icon;
+
+ IconWidth = 0;
+ IconHeight = 0;
+ for (i = 0; i < MaxUnitIndex; ++i) {
+ type = UnitTypeByIdent(EditorUnitTypes[i]);
+ DebugCheck(!type || !type->Icon.Icon);
+ icon = type->Icon.Icon;
+ if (IconWidth < icon->Width) {
+ IconWidth = icon->Width;
+ }
+ if (IconHeight < icon->Height) {
+ IconHeight = icon->Height;
+ }
+ }
+}
+
+
+/**
** Recalculate the shown units.
*/
local void RecalculateShownUnits(void)
@@ -620,15 +650,14 @@
// Draw the unit icons.
//
y = TheUI.ButtonPanelY + 24;
-
i = UnitIndex;
- while (y < TheUI.ButtonPanelY +
- 640/3 - IconHeight) {
+ while (y < TheUI.ButtonPanelY + TheUI.ButtonPanel.Graphic->Height
+ - IconHeight) {
if (i >= MaxShownUnits) {
break;
}
x = TheUI.ButtonPanelX + 10;
- while (x < TheUI.ButtonPanelX + 146) {
+ while (x + IconWidth < TheUI.ButtonPanelX +
TheUI.ButtonPanel.Graphic->Width) {
if (i >= MaxShownUnits) {
break;
}
@@ -1930,7 +1959,7 @@
}
MaxUnitIndex = n - 1;
}
-
+ CalculateMaxIconSize();
ShowUnitsToSelect = 1; // Show all units as default
ShowBuildingsToSelect = 1;
#if 0
Index: stratagus/src/include/icons.h
diff -u stratagus/src/include/icons.h:1.41 stratagus/src/include/icons.h:1.42
--- stratagus/src/include/icons.h:1.41 Mon Dec 22 12:50:36 2003
+++ stratagus/src/include/icons.h Sat Jan 31 02:52:12 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: icons.h,v 1.41 2003/12/22 01:50:36 wizzard Exp $
+// $Id: icons.h,v 1.42 2004/01/30 15:52:12 nobody_ Exp $
#ifndef __ICONS_H__
#define __ICONS_H__
@@ -176,8 +176,8 @@
IconFile* File; /// File containing the data
unsigned Index; /// Index into file
- unsigned Width; /// Icon width
- unsigned Height; /// Icon height
+ int Width; /// Icon width
+ int Height; /// Icon height
// --- FILLED UP ---
Graphic* Sprite; /// Graphic data loaded
Index: stratagus/src/ui/icons.c
diff -u stratagus/src/ui/icons.c:1.67 stratagus/src/ui/icons.c:1.68
--- stratagus/src/ui/icons.c:1.67 Sat Jan 17 02:17:32 2004
+++ stratagus/src/ui/icons.c Sat Jan 31 02:52:13 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: icons.c,v 1.67 2004/01/16 15:17:32 wizzard Exp $
+// $Id: icons.c,v 1.68 2004/01/30 15:52:13 nobody_ Exp $
//@{
@@ -57,10 +57,6 @@
*/
global char** IconWcNames;
-// FIXME: Can be removed:
-global int IconWidth; /// Icon width in panels
-global int IconHeight; /// Icon height in panels
-
local Icon** Icons; /// Table of all icons.
local int NumIcons; /// Number of icons in Icons.
@@ -425,7 +421,7 @@
int i;
CLprintf(file, "\n--- -----------------------------------------\n");
- CLprintf(file, "--- MODULE: icons $Id: icons.c,v 1.67 2004/01/16
15:17:32 wizzard Exp $\n\n");
+ CLprintf(file, "--- MODULE: icons $Id: icons.c,v 1.68 2004/01/30
15:52:13 nobody_ Exp $\n\n");
//
// Mapping the original icon numbers in puds to our internal strings
@@ -578,20 +574,6 @@
return 0;
}
-/**
-** Set icon size
-** FIXME: can be removed:
-*/
-local int CclSetIconSize(lua_State* l)
-{
- if (lua_gettop(l) != 2) {
- lua_pushstring(l, "incorrect argument");
- lua_error(l);
- }
- IconWidth = LuaToNumber(l, 1);
- IconHeight = LuaToNumber(l, 2);
- return 0;
-}
/**
** Register CCL features for icons.
@@ -604,9 +586,6 @@
lua_register(Lua, "DefineIconAlias", CclDefineIconAlias);
lua_register(Lua, "DefineIconWcNames", CclDefineIconWcNames);
-
- // FIXME: can be removed:
- lua_register(Lua, "SetIconSize", CclSetIconSize);
}
//@}
Index: stratagus/src/unit/upgrade.c
diff -u stratagus/src/unit/upgrade.c:1.76 stratagus/src/unit/upgrade.c:1.77
--- stratagus/src/unit/upgrade.c:1.76 Sat Jan 24 10:43:57 2004
+++ stratagus/src/unit/upgrade.c Sat Jan 31 02:52:13 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: upgrade.c,v 1.76 2004/01/23 23:43:57 wizzard Exp $
+// $Id: upgrade.c,v 1.77 2004/01/30 15:52:13 nobody_ Exp $
//@{
@@ -549,7 +549,7 @@
int j;
CLprintf(file, "\n;;; -----------------------------------------\n");
- CLprintf(file, ";;; MODULE: upgrades $Id: upgrade.c,v 1.76 2004/01/23
23:43:57 wizzard Exp $\n\n");
+ CLprintf(file, ";;; MODULE: upgrades $Id: upgrade.c,v 1.77 2004/01/30
15:52:13 nobody_ Exp $\n\n");
//
// Save all upgrades
@@ -820,6 +820,7 @@
convert_to = UnitTypeByIdent(value);
} else {
lua_pushfstring(l, "wrong tag: %s", temp);
+ lua_error(l);
return 0;
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Stratagus-CVS] stratagus/src editor/editloop.c include/icons.h...,
address@hidden <=