请选择 进入手机版 | 继续访问电脑版

 找回密码
 点一下
查看: 2042|回复: 15

传说中的1.23b

[复制链接]
发表于 2009-6-11 09:04:00 | 显示全部楼层 |阅读模式
http://forums.battle.net/thread.html?topicId=17730193178

Welcome Developers,

This guide has been written to help advanced Warcraft III map developers understand the changes that we’ve made to the JASS functionality. Please note that these changes apply to only a small set of custom map developers, and most Warcraft 3 custom maps remain unaffected. For those developers whose maps are affected by the changes we’ve made, please review the steps below to understand how to bring your map into compliance with our new implementation.

Note: JASS-enabled maps that are not brought into compliance with the may not work correctly or at all after we release the next Warcraft III patch.

Details on our new implementation:

This patch includes 97 new native JASS functions and one new JASS handle type designed to assist map makers. These enhancements are part of a new hashtable storage system which is very similar in structure to the GameCache.

While the original GameCache JASS functions only allowed units and JASS primitives to be stored (Integer, Real, Boolean, and String), hashtables can store most JASS handle types. However unlike the GameCache which uses strings for keys, the hashtable uses integers. Additionally, storing and retrieving data in hashtables are much faster and safer than storing data in the GameCache.

The new functions GetHandleId and StringHash are to assist in turning either a handle or a string into an integer. This indirectly allows handles and strings to be used as hashtable keys.

StringHash:
StringHash takes a string and returns an integer much like S2I, however StringHash can be used on any string.

GetHandleId:
GetHandleId takes a handle and returns an integer. GetHandleId works exactly like H2I functions that were written with the return bug. In order to reduce the number of JASS naming conflicts with existing maps, we named the function GetHandleId. We ask map makers to not create a GetHandleId alias function with the name H2I, as we will add a native H2I function to JASS in the future.

hashtable:
Hashtable variables can be declared using the type name ‘hashtable’. As mentioned before, hashtables work very similar to gamecache objects. To create a new hashtable call InitHashtable. For example local hashtable ht = InitHashtable() will create a new hashtable object and assign it to ht.

All handle types share the same key namespace. For instance, if you call SavePlayerHandle followed by SaveUnitHandle, with the same keys, then the unit handle will overwrite the player handle. Even though the handle functions share the same key space, The SaveXHandle and LoadXHandle functions are type safe. For instance, calling SavePlayerHandle followed by local unit u = LoadUnitHandle will result with u initialized to null.

All handle objects saved or removed from a hashtable are automatically reference-counted (with the exception of TextTag, Lightning, Image, Ubersplat, and FogState). This allows handle objects to be saved in the hashtable without risk of the object’s being prematurely memory freed. The reference counts are updated when an object is either added to, flushed, or overwritten in a hashtable.

The complete list of new jass functions are:

InitHashtable
GetHandleId
StringHash

SaveInteger
SaveReal
SaveBoolean
SaveStr
SavePlayerHandle
SaveWidgetHandle
SaveDestructableHandle
SaveItemHandle
SaveUnitHandle
SaveAbilityHandle
SaveTimerHandle
SaveTriggerHandle
SaveTriggerConditionHandle
SaveTriggerActionHandle
SaveTriggerEventHandle
SaveForceHandle
SaveGroupHandle
SaveLocationHandle
SaveRectHandle
SaveBooleanExprHandle
SaveSoundHandle
SaveEffectHandle
SaveUnitPoolHandle
SaveItemPoolHandle
SaveQuestHandle
SaveQuestItemHandle
SaveDefeatConditionHandle
SaveTimerDialogHandle
SaveLeaderboardHandle
SaveMultiboardHandle
SaveMultiboardItemHandle
SaveTrackableHandle
SaveDialogHandle
SaveButtonHandle
SaveTextTagHandle
SaveLightningHandle
SaveImageHandle
SaveUbersplatHandle
SaveRegionHandle
SaveFogStateHandle
SaveFogModifierHandle

LoadInteger
LoadReal
LoadBoolean
LoadStr
LoadPlayerHandle
LoadWidgetHandle
LoadDestructableHandle
LoadItemHandle
LoadUnitHandle
LoadAbilityHandle
LoadTimerHandle
LoadTriggerHandle
LoadTriggerConditionHandle
LoadTriggerActionHandle
LoadTriggerEventHandle
LoadForceHandle
LoadGroupHandle
LoadLocationHandle
LoadRectHandle
LoadBooleanExprHandle
LoadSoundHandle
LoadEffectHandle
LoadUnitPoolHandle
LoadItemPoolHandle
LoadQuestHandle
LoadQuestItemHandle
LoadDefeatConditionHandle
LoadTimerDialogHandle
LoadLeaderboardHandle
LoadMultiboardHandle
LoadMultiboardItemHandle
LoadTrackableHandle
LoadDialogHandle
LoadButtonHandle
LoadTextTagHandle
LoadLightningHandle
LoadImageHandle
LoadUbersplatHandle
LoadRegionHandle
LoadFogStateHandle
LoadFogModifierHandle

HaveSavedInteger
HaveSavedReal
HaveSavedBoolean
HaveSavedString
HaveSavedHandle

RemoveSavedInteger
RemoveSavedReal
RemoveSavedBoolean
RemoveSavedString
RemoveSavedHandle


FlushParentHashtable
FlushChildHashtable

评分

参与人数 1威望 +50 收起 理由
血戮魔动冰 + 50

查看全部评分

 楼主| 发表于 2009-6-11 09:06:41 | 显示全部楼层
恩。大概意思就是

感谢ccav,ourga,battle.net等单位,感谢亲爱的领导,感谢主席,感谢。。。。。

1.23b将增加传说中的hashtable,并且H2I在未来版本将变成内嵌的(暂时是用一个GetHandleInt(h)代替)。

关于hashtable,用起来就和GameCache差不多,但是更快速,也更安全。

顺带有一票如下函数,功能可以根据字面意思猜测。

另外,hashtable很聪明,知道自己排泄,所以不用为他擦pp .
回复

使用道具 举报

发表于 2009-6-11 12:41:09 | 显示全部楼层
哇哈哈!!!!!!!神奇的东西啊!!!!!
回复

使用道具 举报

发表于 2009-6-11 14:14:30 | 显示全部楼层
期待了多年的东西……终于可以抛弃gamecache和全局数组了……
回复

使用道具 举报

 楼主| 发表于 2009-6-11 15:20:43 | 显示全部楼层
数组看上去还是比较有美感的。。。。

比GetXX看着整齐多了
回复

使用道具 举报

发表于 2009-6-11 20:09:34 | 显示全部楼层
回复

使用道具 举报

发表于 2009-6-11 20:15:01 | 显示全部楼层
用我还没考四级的英语做一个山寨翻译

      这个补丁(1.23b)包含了97条新的本地化jass函数和一个新的handle类型来辅助地图制作者们。这些改进是一个跟游戏缓存类似的一种新的hashtable(可翻译为哈希表)系统的一部分。
    本来的游戏缓存jass函数只允许存储单位和jass基本数据类型(整数,实数,布尔值和字符串)。hashtable可以存储大多数handle类型。不同于游戏缓存用字符串作为索引,hashtable用整数作为索引。而且,在hashtable中存储和读取数据比游戏缓存中快而且安全得多。
    所有的handle类型共用相同的索引名空间。例如,如果你先后用SavePlayerHandle函数和SaveUnitHandle函数,用相同的索引存储数据,那么后调用的SaveUnitHandle函数存储的单位将覆盖先调用的SavePlayerHandle存储的玩家。即使所有的handle函数公用相同的索引名空间,这些形状为SaveXHandleLoadXHandle的函数会保证类型的匹配。例如调用SavePlayerHandle,然后将这个索引对应的值用单位读取函数LoadUnitHandle读取并赋值给一个单位变量u,那么变量u将为空(null)。
    除了漂浮文字,闪电效果,图像,Ubersplat不知道什么东西,迷雾状态之外的所有的handle类型的数据,保存或者从hashtable中移除都会自动计算变量连接数。这样将避免了使用者在讲handle类型的数据存储在hashtalbe中之后(错误的)过早的删除这个数据。当一个物品被增加,清除或者覆盖,变量连接数都将被(自动)更新。
回复

使用道具 举报

发表于 2009-6-11 20:20:53 | 显示全部楼层
We ask map makers to not create a GetHandleId alias function with the name H2I, as we will add a native H2I function to JASS in the future.

这是啥,不让我用custom的H2I么,打那么长一串多麻烦.......

话说所谓的 next patch 是指1.23b还是1.23c或1.24什么的?
回复

使用道具 举报

发表于 2009-6-11 20:32:04 | 显示全部楼层

Re:传说中的1.23b

这个么……文本编辑工具的替换功能很强大的……
回复

使用道具 举报

发表于 2009-6-11 20:59:58 | 显示全部楼层
文本编辑工具的替换功能??
回复

使用道具 举报

发表于 2009-6-11 21:08:36 | 显示全部楼层
吧H2I替换成GetHandleId
回复

使用道具 举报

发表于 2009-6-11 21:28:04 | 显示全部楼层
……
很麻烦啊……

因为这个
刚刚做了一半的研究废了
回复

使用道具 举报

 楼主| 发表于 2009-6-11 21:52:09 | 显示全部楼层
这个很好的呀。
回复

使用道具 举报

发表于 2009-6-11 22:29:36 | 显示全部楼层
在研究handle的运行原理

就是创建连续handle的

这个出来后基本上就废了……
回复

使用道具 举报

发表于 2009-6-11 22:48:48 | 显示全部楼层
疯人真有热情啊................
回复

使用道具 举报

发表于 2009-6-11 23:14:40 | 显示全部楼层
这个补丁对很多人来说都是悲剧呢
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 点一下

本版积分规则

Archiver|移动端|小黑屋|地精研究院

GMT+8, 2024-3-29 18:44 , Processed in 0.135012 second(s), 22 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表